Login with 'centos' user for node launch
HP Cloud centos7 images are currently failing with 'Please login as the user "centos" rather than the user "root"'. This adds the 'centos' user as one of the logins to try, and adds a little documentation to the subsequent fixup of the authorized_keys file Change-Id: I46b62c8c4aed7a1c9522d60db7f726ebcb30281c
This commit is contained in:
parent
7b9c047612
commit
11c08e0055
@ -64,7 +64,7 @@ def bootstrap_server(server, admin_pass, key, cert, environment, name,
|
|||||||
else:
|
else:
|
||||||
ssh_kwargs['password'] = admin_pass
|
ssh_kwargs['password'] = admin_pass
|
||||||
|
|
||||||
for username in ['root', 'ubuntu']:
|
for username in ['root', 'ubuntu', 'centos']:
|
||||||
ssh_client = utils.ssh_connect(ip, username, ssh_kwargs, timeout=600)
|
ssh_client = utils.ssh_connect(ip, username, ssh_kwargs, timeout=600)
|
||||||
if ssh_client:
|
if ssh_client:
|
||||||
break
|
break
|
||||||
@ -72,6 +72,9 @@ def bootstrap_server(server, admin_pass, key, cert, environment, name,
|
|||||||
if not ssh_client:
|
if not ssh_client:
|
||||||
raise Exception("Unable to log in via SSH")
|
raise Exception("Unable to log in via SSH")
|
||||||
|
|
||||||
|
# cloud-init puts the "please log in as user foo" message and
|
||||||
|
# subsequent exit() in root's authorized_keys -- overwrite it with
|
||||||
|
# a normal version to get root login working again.
|
||||||
if username != 'root':
|
if username != 'root':
|
||||||
ssh_client.ssh("sudo cp ~/.ssh/authorized_keys"
|
ssh_client.ssh("sudo cp ~/.ssh/authorized_keys"
|
||||||
" ~root/.ssh/authorized_keys")
|
" ~root/.ssh/authorized_keys")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user