mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修复只设置公钥不推送的问题
parent
b5aa69db61
commit
d0c74a7704
|
@ -374,19 +374,16 @@ def test_system_user_connectivity_period():
|
||||||
#### Push system user tasks ####
|
#### Push system user tasks ####
|
||||||
|
|
||||||
def get_push_linux_system_user_tasks(system_user):
|
def get_push_linux_system_user_tasks(system_user):
|
||||||
tasks = []
|
tasks = [
|
||||||
if system_user.password:
|
{
|
||||||
tasks.append({
|
|
||||||
'name': 'Add user {}'.format(system_user.username),
|
'name': 'Add user {}'.format(system_user.username),
|
||||||
'action': {
|
'action': {
|
||||||
'module': 'user',
|
'module': 'user',
|
||||||
'args': 'name={} shell={} state=present password={}'.format(
|
'args': 'name={} shell={} state=present'.format(
|
||||||
system_user.username, system_user.shell,
|
system_user.username, system_user.shell,
|
||||||
encrypt_password(system_user.password, salt="K3mIlKK"),
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
tasks.extend([
|
|
||||||
{
|
{
|
||||||
'name': 'Check home dir exists',
|
'name': 'Check home dir exists',
|
||||||
'action': {
|
'action': {
|
||||||
|
@ -403,7 +400,18 @@ def get_push_linux_system_user_tasks(system_user):
|
||||||
},
|
},
|
||||||
'when': 'home_existed.stat.exists == true'
|
'when': 'home_existed.stat.exists == true'
|
||||||
}
|
}
|
||||||
])
|
]
|
||||||
|
if system_user.password:
|
||||||
|
tasks.append({
|
||||||
|
'name': 'Set {} password'.format(system_user.username),
|
||||||
|
'action': {
|
||||||
|
'module': 'user',
|
||||||
|
'args': 'name={} shell={} state=present password={}'.format(
|
||||||
|
system_user.username, system_user.shell,
|
||||||
|
encrypt_password(system_user.password, salt="K3mIlKK"),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
})
|
||||||
if system_user.public_key:
|
if system_user.public_key:
|
||||||
tasks.append({
|
tasks.append({
|
||||||
'name': 'Set {} authorized key'.format(system_user.username),
|
'name': 'Set {} authorized key'.format(system_user.username),
|
||||||
|
|
Loading…
Reference in New Issue