0

I have following resource definition

 file { '/usr/lib/oozie/libext/hadoop-lzo-0.5.0.jar':
      ensure  => present,
      group   => 'root', 
      owner   => 'root', 
      source  => '/usr/lib/hadoop/lib/hadoop-lzo-0.5.0.jar',
      mode    => 0755,
      require => [Package['lzo'],Package['lzo-devel'],Package['hadoop-lzo'],Package['hadoop-lzo-native']],
    }

Which essentially copies jar artefact to desired location. The issue here is source definition which point to the location created by installation one of these packages. When running puppet in noop mode this resource definition cause to fail as there is no such source - what is pretty logical.

Is there a way to change this behaviour? I do not want to skip all its dependencies. Or what is the proposed way to do so? I would like to avoid copying the jar to modules file.

I found noop metaparameter, documentation here but seems that doesn't help either. So the resource specification looks like:

file { '/usr/lib/oozie/libext/hadoop-lzo-0.5.0.jar':
      ensure  => present,
      group   => 'root', 
      owner   => 'root', 
      source  => '/usr/lib/hadoop/lib/hadoop-lzo-0.5.0.jar',
      mode    => 0755,
      noop    => false,
      require => [Package['lzo'],Package['lzo-devel'],Package['hadoop-lzo'],Package['hadoop-lzo-native']],
    }

Do I need to switch something on? Or do I misunderstood something? How do I detect that module is run in noop mode? If I would like to to some nasty fix. Something like if noop then skip

thanks

jaksky
  • 3,305
  • 4
  • 35
  • 68
  • The noop metaparameter doesn't do what you think it does. Setting noop=>false means your file resource will always be applied, even in a noop run. From the puppetlabs docs: The noop metaparameter allows you to apply individual resources in noop mode, and will override the global value of the noop setting. This means a resource with noop => false will be changed if necessary, even when running puppet agent with noop = true or --noop. (Conversely, a resource with noop => true will only be simulated, even when noop mode is globally disabled.) – daxlerod Jul 07 '14 at 17:52
  • Thanks. Found that. And is there any way how to achieve desired behaviour? Because I do not really want to include jar into module just because of this. Is there any way how to exclude resource from noop operation or be able to recognize that module is run in noop mode. – jaksky Jul 08 '14 at 06:37
  • Is this a [duplicate](http://stackoverflow.com/questions/24313147/missing-resources-when-running-puppet-agent-noop)? – Felix Frank Jul 08 '14 at 14:12
  • No. Read the documentation carefully. – jaksky Jul 08 '14 at 15:49

1 Answers1

0

The $clientnoop fact will be true when the client is run in noop mode, and false otherwise.

I'm not sure if it is the best solution, but you could include a different resource when $clientnoop is true. Your 'noop resource' could be a file resource with the same parameters, except for the source. This way, other resources that depend on this file can still be applied.

daxlerod
  • 1,136
  • 9
  • 18
  • Couldn't find this fact in facter. Don't you know if this fact is in puppet 2.7 available? – jaksky Jul 08 '14 at 15:57
  • It is set by the agent, added to the facts from facter.http://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#puppet-agent-facts – daxlerod Jul 08 '14 at 17:19