Ask Your Question

invalid resource in hieradata

asked 2014-11-06 05:58:56 -0600

Chutki gravatar image

updated 2014-11-10 07:54:21 -0600

llowder gravatar image


I have written puppet for lvm.

$varx = hiera_hash('log_vol::vol1::base')
create_resources('log_vol::file_cre', $varx)

I got Invalid resource type vol1::file_cre. at /etc/modules/log_vol/manifests/filesys.pp:16 on node

I am passing hieradata(hiera_hash('log_vol::vol1::base') value to file_cre.pp manifest

log_vol::vol1::base, is my hieradata name.

The file_cre.pp manifest:

    class log_vol::file_cre {

  define file_cre (
    $lv_name  = $title

  logical_volume { $lv_name:
      ensure       => present,
      size         => $lvsize,
      volume_group => $vg,
      require      => Volume_group[$vg],

 filesystem { "/dev/${vg}/${lv_name}":
      ensure  => present,
      fs_type => $fstype,
      require => Logical_volume[$lv_name],

    file { $mountpoint:
      ensure  => directory,
      owner   => $fsowner,
      group   => $fsgroup,
      mode    => $fsperms,
      require => Filesystem["/dev/${vg}/${lv_name}"],
 mount { "fstab_${lv_name}":
      ensure  => mounted,
      name    => $mountpoint,
      device  => "/dev/${vg}/${lv_name}",
      fstype  => $fstype,
      options => 'defaults',
      atboot  => true,
      require => File[$mountpoint]

edit retag flag offensive close merge delete


Can you share the content of this `file_cre.pp` either in the question, or by linking to a gist?

llowder gravatar imagellowder ( 2014-11-06 08:54:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-10 08:00:02 -0600

llowder gravatar image

You should not define the defined resource type inside the class definition.

You also cannot use create_resources() with a class. Classes are singletons and can only be in a catalog once.

Since the class log_vol::file_cre only defines file_cre, you should just completely remove the line define file_cre ( and change class log_vol::file_cre { to define log_vol::file_cre (.

Then, assuming that your hiera data is valid this code will work:

$varx = hiera_hash('log_vol::vol1::base')
create_resources('log_vol::file_cre', $varx)
edit flag offensive delete link more


Thanks. I fixed the error

Chutki gravatar imageChutki ( 2014-11-11 04:38:29 -0600 )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


Asked: 2014-11-06 05:58:56 -0600

Seen: 567 times

Last updated: Nov 10 '14