Title: Message Title
Christopher Bills updated an issue
Puppet / PUP-4188
Agent incorrectly applies cached catalog when puppetserver dies mid-run
Change By:
Christopher Bills
It seems puppetserver died or was restarted while some agents were updating. The result was the agent created a file as a directory, which broke further runs of the agent, as the file resource did not have 'force' set.Thanks to the advice of Volcane on #puppet (freenode), I have added {{usecacheonfailure = false}} to puppet.conf, which I hope will prevent this in the future.current state: {code} [root@failed_machine ~]# puppet agent --testInfo: Retrieving pluginfactsInfo: Retrieving pluginInfo: Loading factsInfo: Caching catalog for failed_machine.domainInfo: Applying configuration version '1426086826'Notice: /Stage[main]/Base/File[/etc/motd]: Not removing directory; use 'force' to overrideNotice: /Stage[main]/Base/File[/etc/motd]: Not removing directory; use 'force' to overrideError: Could not set 'file' on ensure: Is a directory - /etc/motd20150311-15261-25upep or /etc/motd at 39:/etc/puppet/environments/mcs/modules/base/manifests/init.ppError: Could not set 'file' on ensure: Is a directory - /etc/motd20150311-15261-25upep or /etc/motd at 39:/etc/puppet/environments/mcs/modules/base/manifests/init.ppWrapped exception:Is a directory - /etc/motd20150311-15261-25upep or /etc/motdError: /Stage[main]/Base/File[/etc/motd]/ensure: change from directory to file failed: Could not set 'file' on ensure: Is a directory - /etc/motd20150311-15261-25upep or /etc/motd at 39:/etc/puppet/environments/mcs/modules/base/manifests/init.ppNotice: /Stage[main]/Base/File[/var/run/motd]: Dependency File[/etc/motd] has failures: trueWarning: /Stage[main]/Base/File[/var/run/motd]: Skipping because of failed dependenciesNotice: Finished catalog run in 5.00 seconds {code} class base: {code} class base {$config = hiera_hash('base','')$classes= hiera_hash('classes','')File {# Username instead of UID creates a dependency cycle since user/group# 'require' /etc/passwd, which has 'owner => 'root''...owner => '0',group => '0',mode=> '0644',}package { $config[packages]:ensure => latest,}user { 'root':ensure => present,comment => 'root',password=> $config[root_password],shell => '/bin/bash',uid => 0,gid => 0,require => Group['root'],}group { 'root':ensure => present,gid => 0,system => true,}file { '/etc/nsswitch.conf':ensure => file,content => template('base/nsswitch.conf.erb'),notify => Service['nscd'],}file { '/etc/motd':ensure => file,source => 'puppet:///modules/base/motd',}# For Debian-based systems, doesn't harm RH systemsfile { '/var/run/motd':ensure => link,target => '/etc/motd',}file { '/etc/profile.d':ensure => directory,recurse => true,source => 'puppet:///modules/base/profile.d',}} {code} Log from mishap: {code} 2015-03-11T11:11:46.305405-05:00 failed_machine.domain puppet-agent[10158]: