Bug #3721
cron issues when specifying user on HP-UX
| Status: | Needs More Information | Start date: | 05/04/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | cron | |||
| Target version: | - | |||
| Affected Puppet version: | 0.25.4 | Branch: | http://github.com/jamtur01/puppet/tree/tickets/0.25.x/3721 | |
| Keywords: | ||||
| Votes: | 0 |
Description
Puppet uses ‘crontab -u’ on HP-UX but HP’s crontab doesn’t support -u. For example, with this in a file named ‘pp’:
cron {testcron:
hour => 7,
minute => 0,
command => "echo hi",
ensure => present,
user => happy,
}
I get this:
# puppet --debug --trace --verbose pp
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Creating default schedules
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: Puppet::Type::User::ProviderLdap: feature ldap is missing
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does not exist
debug: /File[/etc/puppet/ssl/certs/ca.pem]: Autorequiring File[/etc/puppet/ssl/certs]
debug: /File[/etc/puppet/ssl/private]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/etc/puppet/ssl/crl.pem]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/etc/puppet/ssl/private_keys]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/etc/puppet/ssl/certs]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/puppet/state/classes.txt]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/state/graphs]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/state/state.yaml]: Autorequiring File[/var/puppet/state]
debug: /File[/etc/puppet/ssl/certificate_requests]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/etc/puppet/ssl]: Autorequiring File[/etc/puppet]
debug: /File[/etc/puppet/ssl/private_keys/latte.gabest.usg.edu.pem]: Autorequiring File[/etc/puppet/ssl/pri
vate_keys]
debug: /File[/var/puppet/run]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/clientbucket]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/ssl/public_keys]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/puppet/client_yaml]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/facts]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/state]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/log]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/lib]: Autorequiring File[/var/puppet]
debug: /File[/etc/puppet/ssl/certs/latte.gabest.usg.edu.pem]: Autorequiring File[/etc/puppet/ssl/certs]
debug: Finishing transaction 546441420 with 0 changes
debug: Prefetching crontab resources for cron
info: Applying configuration version '1273006745'
debug: //Cron[testcron]: Changing ensure
debug: //Cron[testcron]: 1 change(s)
notice: //Cron[testcron]/ensure: created
debug: Flushing cron provider target happy
crontab: illegal option -- u
crontab: proper usage is:
crontab [file]
crontab [-e] [username]
crontab [-r] [username]
crontab [-l] [username]
debug: Finishing transaction 546265980 with 1 changes
History
Updated by James Turnbull almost 2 years ago
- Category set to cron
- Status changed from Unreviewed to Needs Decision
- Assignee set to Luke Kanies
Luke – I can’t see where in the type/provider the command options are set? The -u option doesn’t seem to be populated?
Updated by Luke Kanies almost 2 years ago
- Status changed from Needs Decision to Accepted
- Assignee changed from Luke Kanies to James Turnbull
It’s in lib/puppet/util/filetype.rb. Probably shouldn’t be, but that’s where it is right now.
Updated by James Turnbull over 1 year ago
- Status changed from Accepted to Needs More Information
- Assignee changed from James Turnbull to Mark Plaksin
- Target version set to 49
Mark – excuse my ignorance but what was HPUX return as the Facter value for operatingsystem?
Updated by Mark Plaksin over 1 year ago
We’re running facter 1.5.2 and it returns this: HP-UX
Updated by James Turnbull over 1 year ago
- Branch set to http://github.com/jamtur01/puppet/tree/tickets/0.25.x/3721
Updated by Markus Roberts over 1 year ago
- Status changed from Needs More Information to In Topic Branch Pending Review
I’m assuming you meant to do this James?
Updated by Mark Plaksin over 1 year ago
- Status changed from In Topic Branch Pending Review to Code Insufficient
- Assignee changed from Mark Plaksin to James Turnbull
With this patch it updates root’s crontab instead of the user’s. It looks like on Linux you end up sending ‘crontab -u USER –’ and writing the new crontab to that. HP-UX’s crontab command doesn’t seem to support that—you only get to specify the user then you use -e, -l, or -r. Here’s the HP man page: http://docs.hp.com/en/B2355-90689/crontab.1.html
Note that Solaris' crontab command doesn’t have -u either.
Updated by James Turnbull over 1 year ago
- Assignee changed from James Turnbull to Mark Plaksin
Mark – based on my patch do you have an idea of how it might look? I don’t have a HP-UX box to test on.
Updated by Mark Plaksin over 1 year ago
- Assignee changed from Mark Plaksin to James Turnbull
To make it work across the board (Linux, HP-UX, Solaris, and probably the rest), seems like there are two options:
1) Write the new crontab to a file, become the user and then run ‘crontab FILE’
2) Use ‘crontab -e USER’ and then set EDITOR and use your ed/vi/whatever skills to put the new crontab in place.
Maybe there’s another way but I can’t see it.
FWIW you should be able to work it out on Solaris and have it work on HP-UX.
Updated by Markus Roberts over 1 year ago
I was slow in updating the ticket; this change was pushed to master in commit:584961a82ffbe64c04cb4a7c152f90164274ddb2 for Rowlf.
I’m leaving the ticket open because 1) it isn’t in 0.25.x, 2) it isn’t clear if you thing something else is needed. The commit that was pushed was:
commit 584961a82ffbe64c04cb4a7c152f90164274ddb2 Author: James TurnbullDate: Fri May 14 11:11:05 2010 +1000 Fixed #3721 - Removed -u option from crontab on HP-UX diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 8e8b8dd..3249810 100755 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -198,7 +198,7 @@ class Puppet::Util::FileType # does not think I should be allowed to set the @path to my own user name def cmdbase cmd = nil - if @uid == Puppet::Util::SUIDManager.uid + if @uid == Puppet::Util::SUIDManager.uid || Facter.value(:operatingsystem) == "HP-UX" return "crontab" else return "crontab -u #{@path}"
Updated by James Turnbull about 1 year ago
- Target version deleted (
49)
Updated by James Turnbull 11 months ago
- Assignee deleted (
James Turnbull)
Updated by Nigel Kersten 10 months ago
- Status changed from Code Insufficient to Needs More Information
Mark, can you tell us whether or not this has resolved your issue? I can’t get a clear picture from the ticket history.