2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
2013-08-10 17:12:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SetRootPassword(Task):
|
2016-06-04 11:35:59 +02:00
|
|
|
description = 'Setting the root password'
|
|
|
|
phase = phases.system_modification
|
2013-08-10 17:12:58 +02:00
|
|
|
|
2016-06-04 11:35:59 +02:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
from bootstrapvz.common.tools import log_check_call
|
2017-11-28 09:38:15 -08:00
|
|
|
password_crypted = info.manifest.plugins['root_password'].get('password-crypted', None)
|
|
|
|
if password_crypted is not None:
|
|
|
|
log_check_call(['chpasswd', '--root', info.root, '--encrypted'],
|
|
|
|
'root:' + password_crypted)
|
|
|
|
else:
|
|
|
|
log_check_call(['chroot', info.root, 'chpasswd'],
|
|
|
|
'root:' + info.manifest.plugins['root_password']['password'])
|
|
|
|
|