Exported Concat::Fragment not using concat_basedir

201 views
Skip to first unread message

treydock

unread,
May 2, 2014, 6:29:13 PM5/2/14
to puppet...@googlegroups.com
I am having a very odd issue when exporting Concat::Fragment resources.  They export just fine, but if the node that exported the resource tries to also realize that resource, the fragment loses the path defined by "concat_basedir".

The export:

  @@concat::fragment { "slurm.conf-nodelist_${::hostname}":
    tag     => 'slurm_nodelist',
    target  => '/etc/slurm/slurm.conf',
    content => template('slurm/slurm.conf/worker/slurm.conf.nodelist.erb'),
    order   => 2,
  }

In the same class, the resource is realized:

  Concat::Fragment <<| tag == 'slurm_nodelist' |>>

That same collector is used by another class and it successfully realized the resource at '/var/lib/puppet/concat/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b'.

The node that exported the resource is trying to create the fragment at '/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b'.  This is the error I get

Error: Could not set 'present' on ensure: cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9' at 66:/etc/puppet/environments/production/modules/concat/manifests/fragment.pp
Error: Could not set 'present' on ensure: cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9' at 66:/etc/puppet/environments/production/modules/concat/manifests/fragment.pp
Wrapped exception:
cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9'
Error: /Stage[main]/Slurm::Worker::Config/Concat::Fragment[slurm.conf-nodelist_c0926b]/File[/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b]/ensure: change from absent to present failed: Could not set 'present' on ensure: cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9' at 66:/etc/puppet/environments/production/modules/concat/manifests/fragment.pp

The module I'm working on is at https://github.com/treydock/puppet-slurm.

As a temporary workaround I've done 'mkdir -p /_etc_slurm_slurm.conf/fragments' to allow the fragments to be created, as I'm still unsure if I want to use concat or file_line exports.



The node does have the concat_basedir fact present:

# facter -p concat_basedir
/var/lib/puppet/concat

Both systems are on Puppet 3.4.3.  I'm using PuppetDB 1.6.2 and puppetlabs-concat-1.0.2.

Thanks
- Trey

jcbollinger

unread,
May 5, 2014, 12:15:29 PM5/5/14
to puppet...@googlegroups.com


On Friday, May 2, 2014 5:29:13 PM UTC-5, treydock wrote:
I am having a very odd issue when exporting Concat::Fragment resources.  They export just fine, but if the node that exported the resource tries to also realize that resource, the fragment loses the path defined by "concat_basedir".



That's pretty unlikely, as concat_basedir is not a property of individual fragments in the first place.

 
The export:

  @@concat::fragment { "slurm.conf-nodelist_${::hostname}":
    tag     => 'slurm_nodelist',
    target  => '/etc/slurm/slurm.conf',
    content => template('slurm/slurm.conf/worker/slurm.conf.nodelist.erb'),
    order   => 2,
  }

In the same class, the resource is realized:

  Concat::Fragment <<| tag == 'slurm_nodelist' |>>

That same collector is used by another class and it successfully realized the resource at '/var/lib/puppet/concat/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b'.

The node that exported the resource is trying to create the fragment at '/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b'.  This is the error I get

Error: Could not set 'present' on ensure: cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9' at 66:/etc/puppet/environments/production/modules/concat/manifests/fragment.pp
Error: Could not set 'present' on ensure: cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9' at 66:/etc/puppet/environments/production/modules/concat/manifests/fragment.pp
Wrapped exception:
cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9'
Error: /Stage[main]/Slurm::Worker::Config/Concat::Fragment[slurm.conf-nodelist_c0926b]/File[/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b]/ensure: change from absent to present failed: Could not set 'present' on ensure: cannot generate tempfile `/_etc_slurm_slurm.conf/fragments/2_slurm.conf-nodelist_c0926b20140502-22071-9r3m7r-9' at 66:/etc/puppet/environments/production/modules/concat/manifests/fragment.pp



It is likely that the difference is tried to the target nodes, as opposed to being tied to the class where the collector appears.  It looks like the class for which the fragments are working as you expect may be intended for use on different nodes than the ones for which fragments are not working; if so, that would explain the correlation you observed with the location of the collector.

It is the node in whose catalog the fragments appear that must provide $::config_basedir, not the nodes that export the fragments.  I recommend first verifying more directly that that node is providing the fact by adding a Notify just before the collector:

notify { 'verify $::concat_basedir value':
  message => "The concat base directory is '$::concat_basedir'"
}


John

Reply all
Reply to author
Forward
0 new messages