Trey Dockendorf
2011-Jun-07 13:40 UTC
[Puppet Users] Issue with "change from absent to present failed...no such file or directory"
I''m working on a DHCP module, modeled after this https://github.com/camptocamp/puppet-dhcp . Mine is just a much simpler version as I don''t manage multiple OSes in my environment. However I cannot get my subnet file to create, this is the error from debug I get "err: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/ensure: change from absent to present failed: Could not set ''present on ensure: No such file or directory - /etc/subnets/10.1.0.1.conf.puppettmp_5637 at /etc/puppet/modules/dhcp/manifests/definitions/subnet.pp:18" See below for the full output and my modules. Been pulling my hair out for past day over this so any help is greatly appreciated. Thanks - Trey == modules/dhcp/manifests/init.pp =import "classes/*.pp" import "definitions/*.pp" class dhcp { $dhcp_config_dir = "/etc/dhcp" include dhcp::server } == modules/dhcp/manifests/classes/server.pp =class dhcp::server { package {"dhcp": ensure => present, } service {"dhcpd": ensure => running, enable => true, require => Package["dhcp"], } file {"$dhcp_config_dir": ensure => directory, source => ''puppet:///dhcp/empty'', recurse => true, purge => true, owner => ''root'', group => ''root'', mode => ''755'', require => Package[''dhcp''], } file {"$dhcp_config_dir/subnets": ensure => directory, source => ''puppet:///dhcp/empty'', recurse => true, purge => true, owner => ''root'', group => ''root'', mode => ''755'', notify => Service[''dhcpd''], require => File["$dhcp_config_dir"], } file {"/etc/dhcpd.conf": content => template("dhcp/dhcpd_conf.erb"), ensure => present, require => Package["dhcp"], notify => Service["dhcpd"], } } == modules/dhcp/manifests/definitions/subnets.pp =define dhcp::subnet ( $name=false, $netmask=false, $range_start=false, $range_end=false, $router=false, $domain_name=false, $dns_servers=false, $pxe_opts=false) { file {"/etc/subnets/$name.conf": ensure => present, owner => ''root'', group => ''root'', content => template("dhcp/subnet_conf.erb"), notify => Service["dhcpd"], require => File[''/etc/dhcp/subnets''], } } == manifests/roles.pp =class role_dhcp_server { $my_role = "dhcp_server" $dhcpd_domain_name = "tamu.edu" $dhcpd_dns_servers = "0.0.0.0, 0.0.0.0" $dhcpd_authoritative = true $dhcpd_ddns_update = "interim" $dhcpd_opts = [ ''allow booting'', ''allow bootp'', ''use-host-decl-names on'', ''ignore client-updates'' ] include dhcp dhcp::subnet { "10.1.0.1": name => ''10.1.0.1'', netmask => ''255.255.255.0'', range_start => ''10.1.0.10'', range_end => ''10.1.0.254'', router => ''10.1.0.1'', domain_name => ''tamu.edu'', dns_servers => "0.0.0.0, 0.0.0.0", pxe_opts => [ ''filename "pxelinux.0";'' ], } } == The error = # puppetd --test --debug -vvv debug: Failed to load library ''ldap'' for feature ''ldap'' debug: Puppet::Type::User::ProviderLdap: feature ldap is missing debug: Puppet::Type::User::ProviderUser_role_add: file rolemod does not exist debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist debug: Puppet::Type::User::ProviderPw: file pw does not exist debug: Failed to load library ''rubygems'' for feature ''rubygems'' debug: Failed to load library ''selinux'' for feature ''selinux'' debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows is missing debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet] debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet] debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet] debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/lib/puppet/state] debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring File[/var/lib/puppet/state] debug: /File[/var/log/puppet/http.log]: Autorequiring File[/var/log/puppet] debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/public_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys] debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state] debug: /File[/var/lib/puppet/classes.txt]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state] debug: /File[/var/lib/puppet/ssl/private_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys] debug: /File[/var/lib/puppet/ssl/certs/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet] debug: Finishing transaction 23631659864180 debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet] debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/public_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys] debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/certs/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet] debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet] debug: /File[/var/log/puppet/http.log]: Autorequiring File[/var/log/puppet] debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl] debug: /File[/var/lib/puppet/ssl/private_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys] debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet] debug: Finishing transaction 23631658931580 debug: Using cached certificate for ca debug: Using cached certificate for itscfognode.tamu.edu notice: Ignoring --listen on onetime run debug: Finishing transaction 23631660726540 debug: Loaded state in 0.00 seconds debug: Using cached certificate for ca debug: Using cached certificate for itscfognode.tamu.edu debug: Using cached certificate_revocation_list for ca debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw yaml; using pson debug: Puppet::Type::Package::ProviderRpm: Executing ''/bin/rpm --version'' debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm --version'' debug: Puppet::Type::Package::ProviderUrpmi: Executing ''/bin/rpm -ql rpm'' debug: Puppet::Type::Package::ProviderAptrpm: Executing ''/bin/rpm -ql rpm'' info: Caching catalog for itscfognode.tamu.edu debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does not exist debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svstat does not exist debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not exist debug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist debug: Puppet::Type::Package::ProviderPortupgrade: file /usr/local/sbin/portinstall does not exist debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_info does not exist debug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude does not exist debug: Puppet::Type::Package::ProviderGem: file gem does not exist debug: Puppet::Type::Package::ProviderUrpmi: file urpmi does not exist debug: Puppet::Type::Package::ProviderPkg: file /usr/bin/pkg does not exist debug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not exist debug: Puppet::Type::Package::ProviderSun: file /usr/bin/pkginfo does not exist debug: Puppet::Type::Package::ProviderNim: file /usr/sbin/nimclient does not exist debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix does not exist debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swlist does not exist debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_info does not exist debug: Puppet::Type::Package::ProviderZypper: file /usr/bin/zypper does not exist debug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist debug: Puppet::Type::Package::ProviderAix: file /usr/sbin/installp does not exist debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/portupgrade does not exist debug: Creating default schedules debug: Loaded state in 0.00 seconds debug: Prefetching yum resources for package debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm --version'' debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm -qa --nosignature --nodigest --qf ''%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} '''' debug: /Stage[main]/Timezone::Central/File[/etc/localtime]/require: requires Package[tzdata] debug: /Stage[main]/Dhcp::Server/File[/etc/dhcp/subnets]/require: requires File[/etc/dhcp] debug: /Stage[main]/Dhcp::Server/File[/etc/dhcp/subnets]/notify: subscribes to Service[dhcpd] debug: /Stage[main]/Dhcp::Server/File[/etc/dhcpd.conf]/require: requires Package[dhcp] debug: /Stage[main]/Dhcp::Server/File[/etc/dhcpd.conf]/notify: subscribes to Service[dhcpd] debug: /Stage[main]/Ntp::Base/File[/etc/ntp.conf]/require: requires Package[ntp] debug: /Stage[main]/Ntp::Base/File[/etc/ntp.conf]/notify: subscribes to Service[ntpd] debug: /Stage[main]/Dhcp::Server/File[/etc/dhcp]/require: requires Package[dhcp] debug: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/require: requires File[/etc/dhcp/subnets] debug: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/notify: subscribes to Service[dhcpd] debug: /Stage[main]/Dhcp::Server/Service[dhcpd]/require: requires Package[dhcp] debug: /Stage[main]/Repos::Epel/Yumrepo[epel]/require: requires File[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL] debug: /Stage[main]/Ntp::Base/Service[ntpd]/require: requires Package[ntp] info: Applying configuration version ''1307452961'' debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson err: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/ensure: change from absent to present failed: Could not set ''present on ensure: No such file or directory - /etc/subnets/10.1.0.1.conf.puppettmp_9864 at /etc/puppet/modules/dhcp/manifests/definitions/subnet.pp:18 notice: /Stage[main]/Dhcp::Server/Service[dhcpd]: Dependency File[/etc/subnets/10.1.0.1.conf] has failures: true warning: /Stage[main]/Dhcp::Server/Service[dhcpd]: Skipping because of failed dependencies debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson debug: Service[ntpd](provider=redhat): Executing ''ps -ef'' debug: Service[ntpd](provider=redhat): PID is 2874 debug: Puppet::Type::Service::ProviderRedhat: Executing ''/sbin/chkconfig ntpd'' debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson debug: Finishing transaction 23631658503540 debug: Storing state debug: Stored state in 0.01 seconds notice: Finished catalog run in 0.52 seconds debug: Using cached certificate for ca debug: Using cached certificate for itscfognode.tamu.edu debug: Using cached certificate_revocation_list for ca debug: Value of ''preferred_serialization_format'' (pson) is invalid for report, using default (b64_zlib_yaml) debug: report supports formats: b64_zlib_yaml marshal raw yaml; using b64_zlib_yaml -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jamison Fryman
2011-Jun-07 16:14 UTC
Re: [Puppet Users] Issue with "change from absent to present failed...no such file or directory"
Trey, It looks like the module is attempting to create a file resource in /etc/subnets, versus your intended directory of $dhcp_config_dir/subnets. Puppet is creating an error because the directory /etc/subnets does not exist, and puppet will not automatically create the directory if it is not managed. I''m not sure if this is your intended behavior after looking at your code. Try this instead: In your custom resource block dhcp::subnet, change the file resource from "/etc/subnets/$name.conf" to "${dhcp_config_dir}/subnets/${name}.conf". This might be the behavior you''re looking for. -jamison -- Jamison Fryman jamison@puppetlabs.com ph +1.615.669.2048 | twitter jfryman | gtalk: jamison@puppetlabs.com On Jun 7, 2011, at 8:40 AM, Trey Dockendorf wrote:> I''m working on a DHCP module, modeled after this https://github.com/camptocamp/puppet-dhcp . Mine is just a much simpler version as I don''t manage multiple OSes in my environment. However I cannot get my subnet file to create, this is the error from debug I get > > "err: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/ensure: change from absent to present failed: Could not set ''present on ensure: No such file or directory - /etc/subnets/10.1.0.1.conf.puppettmp_5637 at /etc/puppet/modules/dhcp/manifests/definitions/subnet.pp:18" > > See below for the full output and my modules. > > Been pulling my hair out for past day over this so any help is greatly appreciated. > > Thanks > - Trey > > > == modules/dhcp/manifests/init.pp => import "classes/*.pp" > import "definitions/*.pp" > > class dhcp { > $dhcp_config_dir = "/etc/dhcp" > > include dhcp::server > } > > == modules/dhcp/manifests/classes/server.pp => class dhcp::server { > > package {"dhcp": > ensure => present, > } > > service {"dhcpd": > ensure => running, > enable => true, > require => Package["dhcp"], > } > > file {"$dhcp_config_dir": > ensure => directory, > source => ''puppet:///dhcp/empty'', > recurse => true, > purge => true, > owner => ''root'', > group => ''root'', > mode => ''755'', > require => Package[''dhcp''], > } > > file {"$dhcp_config_dir/subnets": > ensure => directory, > source => ''puppet:///dhcp/empty'', > recurse => true, > purge => true, > owner => ''root'', > group => ''root'', > mode => ''755'', > notify => Service[''dhcpd''], > require => File["$dhcp_config_dir"], > } > > file {"/etc/dhcpd.conf": > content => template("dhcp/dhcpd_conf.erb"), > ensure => present, > require => Package["dhcp"], > notify => Service["dhcpd"], > } > > } > > == modules/dhcp/manifests/definitions/subnets.pp => define dhcp::subnet ( > $name=false, > $netmask=false, > $range_start=false, > $range_end=false, > $router=false, > $domain_name=false, > $dns_servers=false, > $pxe_opts=false) { > > file {"/etc/subnets/$name.conf": > ensure => present, > owner => ''root'', > group => ''root'', > content => template("dhcp/subnet_conf.erb"), > notify => Service["dhcpd"], > require => File[''/etc/dhcp/subnets''], > } > } > > == manifests/roles.pp => class role_dhcp_server { > $my_role = "dhcp_server" > > $dhcpd_domain_name = "tamu.edu" > $dhcpd_dns_servers = "0.0.0.0, 0.0.0.0" > $dhcpd_authoritative = true > $dhcpd_ddns_update = "interim" > $dhcpd_opts = [ ''allow booting'', ''allow bootp'', ''use-host-decl-names on'', ''ignore client-updates'' ] > > include dhcp > > dhcp::subnet { "10.1.0.1": > name => ''10.1.0.1'', > netmask => ''255.255.255.0'', > range_start => ''10.1.0.10'', > range_end => ''10.1.0.254'', > router => ''10.1.0.1'', > domain_name => ''tamu.edu'', > dns_servers => "0.0.0.0, 0.0.0.0", > pxe_opts => [ ''filename "pxelinux.0";'' ], > } > } > > == The error => > # puppetd --test --debug -vvv > debug: Failed to load library ''ldap'' for feature ''ldap'' > debug: Puppet::Type::User::ProviderLdap: feature ldap is missing > debug: Puppet::Type::User::ProviderUser_role_add: file rolemod does not exist > debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist > debug: Puppet::Type::User::ProviderPw: file pw does not exist > debug: Failed to load library ''rubygems'' for feature ''rubygems'' > debug: Failed to load library ''selinux'' for feature ''selinux'' > debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows is missing > debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet] > debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet] > debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet] > debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/lib/puppet/state] > debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring File[/var/lib/puppet/state] > debug: /File[/var/log/puppet/http.log]: Autorequiring File[/var/log/puppet] > debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/public_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys] > debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state] > debug: /File[/var/lib/puppet/classes.txt]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state] > debug: /File[/var/lib/puppet/ssl/private_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys] > debug: /File[/var/lib/puppet/ssl/certs/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet] > debug: Finishing transaction 23631659864180 > debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet] > debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/public_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys] > debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/certs/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet] > debug: /File[/var/log/puppet/http.log]: Autorequiring File[/var/log/puppet] > debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl] > debug: /File[/var/lib/puppet/ssl/private_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys] > debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet] > debug: Finishing transaction 23631658931580 > debug: Using cached certificate for ca > debug: Using cached certificate for itscfognode.tamu.edu > notice: Ignoring --listen on onetime run > debug: Finishing transaction 23631660726540 > debug: Loaded state in 0.00 seconds > debug: Using cached certificate for ca > debug: Using cached certificate for itscfognode.tamu.edu > debug: Using cached certificate_revocation_list for ca > debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw yaml; using pson > debug: Puppet::Type::Package::ProviderRpm: Executing ''/bin/rpm --version'' > debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm --version'' > debug: Puppet::Type::Package::ProviderUrpmi: Executing ''/bin/rpm -ql rpm'' > debug: Puppet::Type::Package::ProviderAptrpm: Executing ''/bin/rpm -ql rpm'' > info: Caching catalog for itscfognode.tamu.edu > debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist > debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist > debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does not exist > debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svstat does not exist > debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not exist > debug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist > debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist > debug: Puppet::Type::Package::ProviderPortupgrade: file /usr/local/sbin/portinstall does not exist > debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_info does not exist > debug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude does not exist > debug: Puppet::Type::Package::ProviderGem: file gem does not exist > debug: Puppet::Type::Package::ProviderUrpmi: file urpmi does not exist > debug: Puppet::Type::Package::ProviderPkg: file /usr/bin/pkg does not exist > debug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not exist > debug: Puppet::Type::Package::ProviderSun: file /usr/bin/pkginfo does not exist > debug: Puppet::Type::Package::ProviderNim: file /usr/sbin/nimclient does not exist > debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist > debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/eix does not exist > debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist > debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swlist does not exist > debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_info does not exist > debug: Puppet::Type::Package::ProviderZypper: file /usr/bin/zypper does not exist > debug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist > debug: Puppet::Type::Package::ProviderAix: file /usr/sbin/installp does not exist > debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist > debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/portupgrade does not exist > debug: Creating default schedules > debug: Loaded state in 0.00 seconds > debug: Prefetching yum resources for package > debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm --version'' > debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm -qa --nosignature --nodigest --qf ''%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} > '''' > debug: /Stage[main]/Timezone::Central/File[/etc/localtime]/require: requires Package[tzdata] > debug: /Stage[main]/Dhcp::Server/File[/etc/dhcp/subnets]/require: requires File[/etc/dhcp] > debug: /Stage[main]/Dhcp::Server/File[/etc/dhcp/subnets]/notify: subscribes to Service[dhcpd] > debug: /Stage[main]/Dhcp::Server/File[/etc/dhcpd.conf]/require: requires Package[dhcp] > debug: /Stage[main]/Dhcp::Server/File[/etc/dhcpd.conf]/notify: subscribes to Service[dhcpd] > debug: /Stage[main]/Ntp::Base/File[/etc/ntp.conf]/require: requires Package[ntp] > debug: /Stage[main]/Ntp::Base/File[/etc/ntp.conf]/notify: subscribes to Service[ntpd] > debug: /Stage[main]/Dhcp::Server/File[/etc/dhcp]/require: requires Package[dhcp] > debug: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/require: requires File[/etc/dhcp/subnets] > debug: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/notify: subscribes to Service[dhcpd] > debug: /Stage[main]/Dhcp::Server/Service[dhcpd]/require: requires Package[dhcp] > debug: /Stage[main]/Repos::Epel/Yumrepo[epel]/require: requires File[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL] > debug: /Stage[main]/Ntp::Base/Service[ntpd]/require: requires Package[ntp] > info: Applying configuration version ''1307452961'' > debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson > debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson > err: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.conf]/ensure: change from absent to present failed: Could not set ''present on ensure: No such file or directory - /etc/subnets/10.1.0.1.conf.puppettmp_9864 at /etc/puppet/modules/dhcp/manifests/definitions/subnet.pp:18 > notice: /Stage[main]/Dhcp::Server/Service[dhcpd]: Dependency File[/etc/subnets/10.1.0.1.conf] has failures: true > warning: /Stage[main]/Dhcp::Server/Service[dhcpd]: Skipping because of failed dependencies > debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson > debug: Service[ntpd](provider=redhat): Executing ''ps -ef'' > debug: Service[ntpd](provider=redhat): PID is 2874 > debug: Puppet::Type::Service::ProviderRedhat: Executing ''/sbin/chkconfig ntpd'' > debug: file_metadata supports formats: b64_zlib_yaml marshal pson raw yaml; using pson > debug: Finishing transaction 23631658503540 > debug: Storing state > debug: Stored state in 0.01 seconds > notice: Finished catalog run in 0.52 seconds > debug: Using cached certificate for ca > debug: Using cached certificate for itscfognode.tamu.edu > debug: Using cached certificate_revocation_list for ca > debug: Value of ''preferred_serialization_format'' (pson) is invalid for report, using default (b64_zlib_yaml) > debug: report supports formats: b64_zlib_yaml marshal raw yaml; using b64_zlib_yaml > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
treydock
2011-Jun-07 18:59 UTC
[Puppet Users] Re: Issue with "change from absent to present failed...no such file or directory"
Ah that did the trick...now a new error. I tried simplifying the module from camptocamp, https://github.com/camptocamp/puppet-dhcp, but a lot of it''s usage I don''t understand, and as such my "simplification" just broke it. I''ve got it much farther now...near the end of puppet run I get this error... err: Could not run Puppet configuration client: Parameter source failed: Could not understand source false: private method `gsub'' called for false:FalseClass at /etc/puppet/modules/common/manifests/ definitions/concatfilepart.pp:51 This is the first time to use the puppet-common, https://github.com/camptocamp/puppet-common, module and that seems to be what''s generating the error. Below is the updated config and debug output...The node I''m testing on has "include fog_server" === manifests/init.pp ==import "classes/*.pp" import "definitions/*.pp" class dhcp { include dhcp::server } === manifests/classes/server.pp ==class dhcp::server { include dhcp::params package {"dhcp": ensure => present, } service {"dhcpd": ensure => running, enable => true, require => Package["dhcp"], } file {"${dhcp::params::dhcp_config_dir}/subnets": ensure => directory, source => ''puppet:///dhcp/empty'', recurse => true, purge => true, owner => ''root'', group => ''root'', mode => ''755'', notify => Service[''dhcpd''], require => Package[''dhcp''], } common::concatfilepart {"00.dhcp.server.base": file => "${dhcp::params::dhcp_config_dir}/dhcpd.conf", ensure => present, require => Package["dhcp"], notify => Service["dhcpd"], } file {"/etc/dhcpd.conf": content => template("dhcp/dhcpd_conf.erb"), ensure => present, require => Package["dhcp"], notify => Service["dhcpd"], } } === manifests/classes/params.pp ==/* = Class: dhcp::params Do NOT include this class - it won''t do anything. Set variables for names and paths */ class dhcp::params { case $operatingsystem { CentOS: { $dhcp_config_dir = $operatingsystemrelease? { 5.6 => "/etc/dhcp", } } } } === manifests/definitions/subnet.pp ==define dhcp::subnet ( $name=false, $netmask=false, $range_start=false, $range_end=false, $router=false, $domain_name=false, $dns_servers=false, $pxe_opts=false) { include dhcp::params common::concatfilepart {"dhcp.${name}": file => "${dhcp::params::dhcp_config_dir}/dhcpd.conf", ensure => $ensure, content => "include \"${dhcp::params::dhcp_config_dir}/subnets/ ${name}.conf\";\n", } file {"${dhcp::params::dhcp_config_dir}/subnets/${name}.conf": ensure => present, owner => ''root'', group => ''root'', content => template("dhcp/subnet_conf.erb"), notify => Service["dhcpd"], } } === manifests/roles.pp == class role_dhcp_server { $my_role = "dhcp_server" $dhcpd_domain_name = "tamu.edu" $dhcpd_dns_servers = "0.0.0.0, 0.0.0.0" $dhcpd_authoritative = true $dhcpd_ddns_update = "interim" $dhcpd_opts = [ ''allow booting'', ''allow bootp'', ''use-host-decl- names on'', ''ignore client-updates;'' ] include dhcp } class fog_server { include role_dhcp_server dhcp::subnet { "10.1.0.1": name => ''10.1.0.1'', netmask => ''255.255.255.0'', range_start => ''10.1.0.10'', range_end => ''10.1.0.254'', router => ''10.1.0.1'', domain_name => ''tamu.edu'', dns_servers => "0.0.0.0, 0.0.0.0", pxe_opts => [ ''filename "pxelinux.0";'' ], } } Thanks - Trey On Jun 7, 11:14 am, Jamison Fryman <jami...@puppetlabs.com> wrote:> Trey, > > It looks like the module is attempting to create a file resource in /etc/subnets, versus your intended directory of $dhcp_config_dir/subnets. Puppet is creating an error because the directory /etc/subnets does not exist, and puppet will not automatically create the directory if it is not managed. I''m not sure if this is your intended behavior after looking at your code. > > Try this instead: In your custom resource block dhcp::subnet, change the file resource from "/etc/subnets/$name.conf" to "${dhcp_config_dir}/subnets/${name}.conf". This might be the behavior you''re looking for. > > -jamison > > -- > Jamison Fryman > jami...@puppetlabs.com > ph +1.615.669.2048 | twitter jfryman | gtalk: jami...@puppetlabs.com > > On Jun 7, 2011, at 8:40 AM, Trey Dockendorf wrote: > > > > > > > > > I''m working on a DHCP module, modeled after thishttps://github.com/camptocamp/puppet-dhcp. Mine is just a much simpler version as I don''t manage multiple OSes in my environment. However I cannot get my subnet file to create, this is the error from debug I get > > > "err: /Stage[main]/Fog_server/Dhcp::Subnet[10.1.0.1]/File[/etc/subnets/10.1.0.1.c onf]/ensure: change from absent to present failed: Could not set ''present on ensure: No such file or directory - /etc/subnets/10.1.0.1.conf.puppettmp_5637 at /etc/puppet/modules/dhcp/manifests/definitions/subnet.pp:18" > > > See below for the full output and my modules. > > > Been pulling my hair out for past day over this so any help is greatly appreciated. > > > Thanks > > - Trey > > > == modules/dhcp/manifests/init.pp => > import "classes/*.pp" > > import "definitions/*.pp" > > > class dhcp { > > $dhcp_config_dir = "/etc/dhcp" > > > include dhcp::server > > } > > > == modules/dhcp/manifests/classes/server.pp => > class dhcp::server { > > > package {"dhcp": > > ensure => present, > > } > > > service {"dhcpd": > > ensure => running, > > enable => true, > > require => Package["dhcp"], > > } > > > file {"$dhcp_config_dir": > > ensure => directory, > > source => ''puppet:///dhcp/empty'', > > recurse => true, > > purge => true, > > owner => ''root'', > > group => ''root'', > > mode => ''755'', > > require => Package[''dhcp''], > > } > > > file {"$dhcp_config_dir/subnets": > > ensure => directory, > > source => ''puppet:///dhcp/empty'', > > recurse => true, > > purge => true, > > owner => ''root'', > > group => ''root'', > > mode => ''755'', > > notify => Service[''dhcpd''], > > require => File["$dhcp_config_dir"], > > } > > > file {"/etc/dhcpd.conf": > > content => template("dhcp/dhcpd_conf.erb"), > > ensure => present, > > require => Package["dhcp"], > > notify => Service["dhcpd"], > > } > > > } > > > == modules/dhcp/manifests/definitions/subnets.pp => > define dhcp::subnet ( > > $name=false, > > $netmask=false, > > $range_start=false, > > $range_end=false, > > $router=false, > > $domain_name=false, > > $dns_servers=false, > > $pxe_opts=false) { > > > file {"/etc/subnets/$name.conf": > > ensure => present, > > owner => ''root'', > > group => ''root'', > > content => template("dhcp/subnet_conf.erb"), > > notify => Service["dhcpd"], > > require => File[''/etc/dhcp/subnets''], > > } > > } > > > == manifests/roles.pp => > class role_dhcp_server { > > $my_role = "dhcp_server" > > > $dhcpd_domain_name = "tamu.edu" > > $dhcpd_dns_servers = "0.0.0.0, 0.0.0.0" > > $dhcpd_authoritative = true > > $dhcpd_ddns_update = "interim" > > $dhcpd_opts = [ ''allow booting'', ''allow bootp'', ''use-host-decl-names on'', ''ignore client-updates'' ] > > > include dhcp > > > dhcp::subnet { "10.1.0.1": > > name => ''10.1.0.1'', > > netmask => ''255.255.255.0'', > > range_start => ''10.1.0.10'', > > range_end => ''10.1.0.254'', > > router => ''10.1.0.1'', > > domain_name => ''tamu.edu'', > > dns_servers => "0.0.0.0, 0.0.0.0", > > pxe_opts => [ ''filename "pxelinux.0";'' ], > > } > > } > > > == The error => > > # puppetd --test --debug -vvv > > debug: Failed to load library ''ldap'' for feature ''ldap'' > > debug: Puppet::Type::User::ProviderLdap: feature ldap is missing > > debug: Puppet::Type::User::ProviderUser_role_add: file rolemod does not exist > > debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist > > debug: Puppet::Type::User::ProviderPw: file pw does not exist > > debug: Failed to load library ''rubygems'' for feature ''rubygems'' > > debug: Failed to load library ''selinux'' for feature ''selinux'' > > debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows is missing > > debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > > debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet] > > debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet] > > debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet] > > debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/lib/puppet/state] > > debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring File[/var/lib/puppet/state] > > debug: /File[/var/log/puppet/http.log]: Autorequiring File[/var/log/puppet] > > debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/public_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys] > > debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state] > > debug: /File[/var/lib/puppet/classes.txt]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state] > > debug: /File[/var/lib/puppet/ssl/private_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys] > > debug: /File[/var/lib/puppet/ssl/certs/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > > debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet] > > debug: Finishing transaction 23631659864180 > > debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/puppet] > > debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/public_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/public_keys] > > debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/certs/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > > debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/certs] > > debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet] > > debug: /File[/var/log/puppet/http.log]: Autorequiring File[/var/log/puppet] > > debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl] > > debug: /File[/var/lib/puppet/ssl/private_keys/itscfognode.tamu.edu.pem]: Autorequiring File[/var/lib/puppet/ssl/private_keys] > > debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet] > > debug: Finishing transaction 23631658931580 > > debug: Using cached certificate for ca > > debug: Using cached certificate for itscfognode.tamu.edu > > notice: Ignoring --listen on onetime run > > debug: Finishing transaction 23631660726540 > > debug: Loaded state in 0.00 seconds > > debug: Using cached certificate for ca > > debug: Using cached certificate for itscfognode.tamu.edu > > debug: Using cached certificate_revocation_list for ca > > debug: catalog supports formats: b64_zlib_yaml dot marshal pson raw yaml; using pson > > debug: Puppet::Type::Package::ProviderRpm: Executing ''/bin/rpm --version'' > > debug: Puppet::Type::Package::ProviderYum: Executing ''/bin/rpm --version'' > > debug: Puppet::Type::Package::ProviderUrpmi: Executing ''/bin/rpm -ql rpm'' > > debug: Puppet::Type::Package::ProviderAptrpm: Executing ''/bin/rpm -ql rpm'' > > info: Caching catalog for itscfognode.tamu.edu > > debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist > > debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist > > debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does not exist > > debug: > > ... > > read more »-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.