Bug #2384
Provider features are validated at instantiation rather than run time
| Status: | Accepted | Start date: | 07/02/2009 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | RAL | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | 0.24.8 | Branch: | ||
| Keywords: | usability | |||
| Votes: | 14 |
Description
I’m attempting to do the following: 1. Install ruby-shadow 2. Create a user account (with a password)
Unfortunately puppet tends to screw up the order. Here’s the test manifest:
package { ruby-shadow: ensure => installed; }
user { testdude:
ensure => present,
gid => users,
password => '$1$loo03Rez$MfxLF/9uMeaeOPCtceYGc0',
require => Package[ruby-shadow],
comment => "test account";
}
Puppet checks for the account’s presence before anything, and complains about ruby-shadow not being there. IMHO it shouldn’t even care about checking anything to do with the account, since I have specified a prerequisite. Anyway, it installs ruby-shadow, then creates the account without a password despite ruby-shadow now being on the system. It takes a second run of puppet to set the password, which is really not ideal.
Here’s the output with debugging and verbose:
[root@test ~]# puppet -d -v test.pp
debug: Puppet::Type::Package::ProviderRpm: Executing '/bin/rpm --version'
debug: Puppet::Type::Package::ProviderUrpmi: Executing '/bin/rpm -ql rpm'
debug: Puppet::Type::Package::ProviderAptrpm: Executing '/bin/rpm -ql rpm'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm --version'
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude does not exist
debug: Puppet::Type::Package::ProviderPkgdmg: file /Library/Receipts does not exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_delete does not exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgrm does not exist
debug: Puppet::Type::Package::ProviderEasy_install: file easy_install does not exist
debug: Puppet::Type::Package::ProviderAppdmg: file /Library/Receipts does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_delete does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/pkg_deinstall does not exist
debug: Puppet::Type::Package::ProviderGem: file gem does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
debug: Puppet::Type::Package::ProviderDarwinport: file /opt/local/bin/port does not exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderApple: file /Library/Receipts does not exist
debug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist
debug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmi does not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does not exist
debug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/emerge does not exist
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does not exist
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderNetinfo: file nireport does not exist
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
info: /User[testdude]: Provider useradd does not support features manages_passwords; not managing attribute password
debug: Creating default schedules
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: /User[testdude]/require: requires Package[ruby-shadow]
debug: Failed to load library 'ldap' for feature 'ldap'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q ruby-shadow --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
'
debug: //Package[ruby-shadow]: Changing ensure
debug: //Package[ruby-shadow]: 1 change(s)
debug: Package[ruby-shadow](provider=yum): Ensuring => present
debug: Puppet::Type::Package::ProviderYum: Executing '/usr/bin/yum -d 0 -e 0 -y install ruby-shadow'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -q ruby-shadow --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
'
notice: //Package[ruby-shadow]/ensure: created
debug: /User[testdude]: Changing ensure
debug: /User[testdude]: 1 change(s)
debug: User[testdude](provider=useradd): Executing '/usr/sbin/useradd -c test account -g users -M testdude'
notice: /User[testdude]/ensure: created
debug: Finishing transaction 23951941785180 with 2 changes
Related issues
History
Updated by Luke Kanies almost 3 years ago
- Subject changed from Odd interaction between user and package types when requiring ruby-shadow to Provider features are validated at instantiation rather than run time
- Category set to RAL
- Status changed from Unreviewed to Accepted
This is basically the problem of when validation happens, and we’re apparently doing the validation too early here.
Updated by Luke Kanies almost 3 years ago
- Target version set to 2.6.0
This is coming up more often, so I’m bumping up its priority.
Updated by James Turnbull over 2 years ago
- Target version changed from 2.6.0 to 2.7.x
Updated by seph seph about 2 years ago
- Affected Puppet version changed from 0.24.8 to 0.25.4
I got here by way of #2475 I routinely hit this with cron, and now with augeas. Though easy to work around, it’s frustrating.
Updated by Dan Carley over 1 year ago
A temporary solution to this issue, rather than modifying your Kickstarts, is to send a dummy provider for the Cron type over with pluginsync. This allows the first run to proceed and install a Cron package, albeit possibly failing to install any Cron resources. A second run will then use the correct provider and mop up any outstanding resources.
# modules/cron/lib/puppet/provider/cron/dummy_issue2384.rb
Puppet::Type.type(:cron).provide :dummy_issue2384 do
desc "Dummy provider for Cron.
Fake nil resources when there is no crontab binary available. Allows
puppetd to run on a bootstrapped machine before a Cron package has been
installed. Workaround for: http://projects.puppetlabs.com/issues/2384
"
def self.instances
[]
end
end
Updated by Peter Meier over 1 year ago
this is quite annoying if you want to distribute a provider and imho it breaks a fundamental feature of puppet… Can we get some priority for this problem?
Updated by Nigel Kersten over 1 year ago
- Priority changed from Normal to High
- Affected Puppet version changed from 0.25.4 to 0.24.8
- Keywords set to usability
Yes. This is immensely frustrating.
Updated by Simon Josi over 1 year ago
Peter Meier wrote:
this is quite annoying if you want to distribute a provider and imho it breaks a fundamental feature of puppet… Can we get some priority for this problem?
+1
Updated by Jordan Raub about 1 year ago
Simon Josi wrote:
Peter Meier wrote:
this is quite annoying if you want to distribute a provider and imho it breaks a fundamental feature of puppet… Can we get some priority for this problem?
+1
+1 anything done with this issue?
Updated by Gary Richards 2 months ago
+1 Just ran into this myself with a custom provider.