Ask Your Question
0

Defined resource not being found

asked 2015-06-05 18:01:15 -0500

wgoodric gravatar image

I'm trying to migrate code from Puppet 3.7 to 4.1 and have an issue with a defined resource type that was working. I get the error "Invalid resource type resolv::resolvConf".

It was previously contained in a class but I started to try things to resolve the error, like breaking the defined resource into its own file and various renaming to get past the error now I have this:

Directory structure: Module: /etc/puppetlabs/code/environments/fab8site/modules/resolv/manifests/resolv_conf.pp

Content:

# resolv_conf.pp

class resolv::resolv_conf {

  $searchpath  = "gfoundries.com"
  $domainname  = "gfoundries.com"
  $nameservers = $environment ? {
    "production"  => undef,
    "fab8prod"    => ["10.11.35.236","10.11.39.236"],
    "fab8staging" => ["10.10.35.236","10.10.39.236"],
    "fab8site"    => ["10.10.35.236","10.10.39.236"],
    "fab8gdc"     => ["10.10.35.236","10.10.39.236"],
    "fab8idc"     => ["10.10.35.236","10.10.39.236"],
  }

  resolv::resolvConf {'gfoundries':
    domainname  => $domainname,
    searchpath  => $searchpath,
    nameservers => $nameservers,
  }
}

Defined resource type: /etc/puppetlabs/code/environments/fab8site/modules/resolv/manifests/resolvConf.pp

Content:

# resolvConf.pp

define resolv::resolvConf ($domainname = "$domain", $searchpath, $nameservers) {
  file { "/etc/resolv.conf":
    owner   => root,
    group   => root,
    mode    => 644,
    content => template("resolv/resolv.conf.erb"),
  }
}

Init.pp: /etc/puppetlabs/code/environments/fab8site/modules/resolv/manifests/init.pp

Content:

# init.pp

class resolv {

}

What have I missed?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-06-06 09:32:24 -0500

GregLarkin gravatar image

Uppercase letters are not allowed in class name and defined type names, according to this document: https://docs.puppetlabs.com/puppet/latest/reference/lang_reserved.html#classes-and-types, so "resolvConf" is not a legal name.

However, that page was the same for the 3.7 release, so I'm not sure why it worked before. It might have been loosely enforced before, but the Puppet 4.0+ language parser is stricter than it used to be, so some edge cases may no longer work.

edit flag offensive delete link more

Comments

OK so I renamed resolvConf.pp to resolvconf.pp and changed the define to resolv::resolvconf in resolv_conf.pp and same issue: Invalid resource type resolv::resolvconf at /etc/puppetlabs/code/environments/fab8site/modules/resolv/manifests/resolv_conf.pp:16:3

wgoodric gravatar imagewgoodric ( 2015-06-08 12:47:28 -0500 )edit

Hmm, strange. Other things to check - what is the output of "puppet config print modulepath"? Please post a link to a pastebin of your puppet.conf, too.

GregLarkin gravatar imageGregLarkin ( 2015-06-08 17:19:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-06-05 18:01:15 -0500

Seen: 180 times

Last updated: Jun 06 '15