Skip to content

Commit

Permalink
Merge pull request #296 from SUSE-Enceladus/user-data
Browse files Browse the repository at this point in the history
Use cloud config instead of bash script.
  • Loading branch information
rjschwei authored Apr 7, 2021
2 parents abcd176 + f0b381d commit 77a4865
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions img_proof/ipa_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@
IPA_HISTORY_FILE = os.path.join(HOME, '.config', 'img_proof', '.history')
IPA_RESULTS_PATH = os.path.join(HOME, 'img_proof', 'results')

BASH_SSH_SCRIPT = '''#!/bin/bash
echo {key} >> /home/{user}/.ssh/authorized_keys
BASH_SSH_SCRIPT = '''#cloud-config
disable_root: true
runcmd:
- [ sh, -c, 'echo {key} >> /home/{user}/.ssh/authorized_keys' ]
'''

SYNC_POINTS = (
Expand Down
7 changes: 5 additions & 2 deletions tests/test_ipa_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ def test_cloud_get_user_data(self, mock_get_ssh_key):
result = provider._get_user_data()

assert result == \
'#!/bin/bash\n' \
'echo testkey12345 >> /home/ec2-user/.ssh/authorized_keys\n'
"#cloud-config\n" \
"disable_root: true\n\n" \
"runcmd:\n" \
" - [ sh, -c, 'echo testkey12345 >> " \
"/home/ec2-user/.ssh/authorized_keys' ]\n"

def test_cloud_get_non_null_values(self):
"""Test cloud get non null values method."""
Expand Down

0 comments on commit 77a4865

Please sign in to comment.