puppet execution of a python script where os.system(...) command is not working

Posted by philippe on Server Fault See other posts from Server Fault or by philippe
Published on 2012-09-09T09:11:39Z Indexed on 2012/09/09 9:39 UTC
Read the original article Hit count: 157

Filed under:
|
|
|

I am trying to manage Unix users with puppet. Puppet provides enough tools to create accounts and provide authorized_keys files for instance, but no to set up user password, and it tell to the user.

What I have done is a python script which generate a random password and send it to the user by email. The problem is, it is not possible to launch passwd Unix command with python, I have then written a bash script with the command:

echo -ne "$password\n$password\n" | passwd $user
passwd -e $user

Launched manually, the script works fine and the created user has its password sent by email. But when puppet launches it, only the python script gets executed, as if the os.system('/bin/bash my_bash_script') is ignored. No error is displayed. And the user gets its password, but the passwd commands are not launched.

Is there any limitation with puppet preventing to perform what I described? Or, how can I otherwise change the user account, its expiration, and send password by email?

I can provide more information, but right now, I don't know which are accurate.

Many thanks!

© Server Fault or respective owner

Related posts about linux

Related posts about python