Ask Your Question
0

Alter the behaviour when noop runs-noop metaparameter doesn't work?

asked 2014-06-10 05:55:24 -0600

jaksky gravatar image

updated 2014-07-07 11:00:03 -0600

Hello,

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-08 17:44:29 -0600

TerriHaber gravatar image

Unfortunately, that is the way noop works. --noop is a great tool, but it's not entirely perfect. So in circumstances where a file does not exist and there is a dependency, it will complain. In this case, it is safe to assume, since you are requiring the package that places the file on the system, that the file will be in place and will be sourced properly.

edit flag offensive delete link more

Comments

Is is possible somehow switch the resource off when running in noop. Because your rationale is correct but not everyone might be aware of this logic. Is if as a module creator I am aware of this logic I should be able to customize that that if a user runs noop he doesn't see any errors - meaning all is as expected instead of seeing errors.

jaksky gravatar imagejaksky ( 2014-08-05 03:21:04 -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

Stats

Asked: 2014-06-10 05:55:24 -0600

Seen: 519 times

Last updated: Jul 08 '14