Drew Raines
2014-Apr-02  17:12 UTC
[Puppet Users] Service[foo] fails under --noop if its package has never been installed
Hello!
I'm running `apply --noop` regularly.  I would really like to also 
do it on a fresh machine before changing bits on the disk. 
Unfortunately this fails for Service types because their init 
scripts don't yet exist.  For example, take ntp:
    package { "ntp":
      ensure => present,
    } ->
    service { "ntp":
      ensure => running,
    }
If I run `sudo puppet apply --noop foo.pp` I get:
    Debug: /Stage[main]/Main/Service[ntp]/require: requires 
    Package[ntp]
    Info: Applying configuration version '1396455554'
    Debug: Prefetching apt resources for package
    Debug: Executing '/usr/bin/dpkg-query -W --showformat 
    '${Status} ${Package} ${Version}\n''
    Debug: Executing '/usr/bin/dpkg-query -W --showformat 
    '${Status} ${Package} ${Version}\n' ntp'
    Notice: /Stage[main]/Main/Package[ntp]/ensure: current_value 
    purged, should be present (noop)
    Debug: /Stage[main]/Main/Package[ntp]: The container 
    Class[Main] will propagate my refresh event
    Debug: Service[ntp](provider=upstart): Could not find ntp.conf 
    in /etc/init
    Debug: Service[ntp](provider=upstart): Could not find ntp.conf 
    in /etc/init.d
    Debug: Service[ntp](provider=upstart): Could not find ntp in 
    /etc/init
    Debug: Service[ntp](provider=upstart): Could not find ntp in 
    /etc/init.d
    Debug: Service[ntp](provider=upstart): Could not find ntp.sh 
    in /etc/init
    Debug: Service[ntp](provider=upstart): Could not find ntp.sh 
    in /etc/init.d
    Error: /Stage[main]/Main/Service[ntp]: Could not evaluate: 
    Could not find init script or upstart conf file for 'ntp'
I get why this fails.  Package["ntp"] hasn't written anything to 
disk during the dry run, so Service["ntp"] can't find the right 
pieces that it would have needed.  I was hoping the 
`Package["ntp"] -> Service["ntp"]` relationship would
have
accounted for this.
This thread from years ago touches on this but quickly gets into a 
semantic discussion about include/require: 
https://groups.google.com/d/msg/puppet-users/vTDoxY3OdNI/HOWeN_ZhDJ8J.
I'm mostly curious if I'm cutting across the grain here.  I'm 
relatively new to Puppet.  Is --noop not universally useful for 
dry runs?  If it is, how can I work around this issue?
Thanks!
Drew
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/m2fvlvlkpd.fsf%40mid.raines.me.
For more options, visit https://groups.google.com/d/optout.