Enable shell access for nova when resize is enabled
This commit is contained in:
parent
ba437ac3ed
commit
48fc3ff823
@ -48,7 +48,8 @@ from nova_compute_utils import (
|
||||
register_configs,
|
||||
NOVA_CONF,
|
||||
QUANTUM_CONF, NEUTRON_CONF,
|
||||
ceph_config_file, CEPH_SECRET
|
||||
ceph_config_file, CEPH_SECRET,
|
||||
enable_shell, disable_shell
|
||||
)
|
||||
|
||||
from nova_compute_context import CEPH_SECRET_UUID
|
||||
@ -77,7 +78,10 @@ def config_changed():
|
||||
initialize_ssh_keys()
|
||||
|
||||
if config('enable-resize') is True:
|
||||
enable_shell(user='nova')
|
||||
initialize_ssh_keys(user='nova')
|
||||
else:
|
||||
disable_shell(user='nova')
|
||||
|
||||
[compute_joined(rid) for rid in relation_ids('cloud-compute')]
|
||||
|
||||
|
@ -399,3 +399,13 @@ def create_libvirt_secret(secret_file, secret_uuid, key):
|
||||
cmd = ['virsh', 'secret-set-value', '--secret', secret_uuid,
|
||||
'--base64', key]
|
||||
check_call(cmd)
|
||||
|
||||
|
||||
def enable_shell(user):
|
||||
cmd = ['usermod', '-s', '/bin/bash', user]
|
||||
check_call(cmd)
|
||||
|
||||
|
||||
def disable_shell(user):
|
||||
cmd = ['usermod', '-s', '/bin/false', user]
|
||||
check_call(cmd)
|
||||
|
Loading…
Reference in New Issue
Block a user