-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Authorized SSH keys for VM's based on cloud image
- Loading branch information
Showing
5 changed files
with
144 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,18 @@ class TestMachinesCreate(VirtualMachinesCase): | |
self.login_and_go("/machines") | ||
self.waitPageInit() | ||
|
||
# user password | ||
runner.checkDialogFormValidationTest(TestMachinesCreate.VmDialog(self, sourceType='cloud', | ||
storage_size=10, storage_size_unit='MiB', | ||
location=config.VALID_DISK_IMAGE_PATH, | ||
root_password="foobar", | ||
user_login="", | ||
ssh_keys=[ | ||
"ssh-ed25519 aaaac3nzac1lzdi1nte5aaaaimtkmgapextexfd9bndtq23udz5dsdexaat9y16t7lgw [email protected]" | ||
], | ||
create_and_run=True), | ||
{"create-vm-dialog-user-login": "User login must not be empty when SSH keys are set"}) | ||
|
||
# test create and import [VM] buttons show appropriate tooltips when hovered over | ||
runner.createAndImportTooltipsTest() | ||
|
||
|
@@ -276,6 +288,37 @@ class TestMachinesCreate(VirtualMachinesCase): | |
os_short_id=config.FEDORA_28_SHORTID, | ||
create_and_run=True)) | ||
|
||
# Try to create VM with 1 SSH key | ||
runner.createCloudBaseImageTest(TestMachinesCreate.VmDialog(self, sourceType='cloud', | ||
storage_size=10, storage_size_unit='MiB', | ||
location=config.VALID_DISK_IMAGE_PATH, | ||
os_name=config.FEDORA_28, | ||
os_short_id=config.FEDORA_28_SHORTID, | ||
user_password="catsaremybestfr13nds", | ||
user_login="foo", | ||
root_password="dogsaremybestfr13nds", | ||
ssh_keys=[ | ||
"ssh-ed25519 aaaac3nzac1lzdi1nte5aaaaimtkmgapextexfd9bndtq23udz5dsdexaat9y16t7lgw [email protected]" | ||
], | ||
create_and_run=True)) | ||
|
||
# try to create VM with multiple SSH keys | ||
# --cloud-init user-data option exists since virt-install >= 3.0.0 | ||
runner.createCloudBaseImageTest(TestMachinesCreate.VmDialog(self, sourceType='cloud', | ||
storage_size=10, storage_size_unit='MiB', | ||
location=config.VALID_DISK_IMAGE_PATH, | ||
os_name=config.FEDORA_28, | ||
os_short_id=config.FEDORA_28_SHORTID, | ||
user_password="catsaremybestfr13nds", | ||
user_login="foo", | ||
root_password="dogsaremybestfr13nds", | ||
ssh_keys=[ | ||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMTkmGaPexteXFD9bNdTq23UdZ5dsDexAAT9Y16T7lgW [email protected]", | ||
"ssh-dss AAAAB3NzaC1kc3MAAACBAKCR4rAzAT5K1RAwFehM+LyXN4/y9XNf+nzafUXVi9UptLf9/RxMAmlNpXERAL3Mx2vHeaN89I5pe/lBnSvywy2nO9Rxv+y2RQOhEV8UBkJ+i/xU1VWCxVTH1xjMIbopFt76Rs9TPsd6ZwjQM4W05BY5+87kFACSlLVqUZcP6VabAAAAFQCinamJ3el0kZvVTUSqb/dyjpFUkwAAAIB11fpN/V5taX83nvwwtEhRw7e1j450/neR7Ybfi2P6OKtBOc/AHO8F3s1rpZDqbtXrVFui3xUTpn2qofkxntpXi2/vSEma8y/fCuLV1IHU5Lc5Hczhjtuh2MoY1afEGT5FkMQuDeiT8rIV5IEgV+mcubS6bHHY6Cb8ZtGJG5okWgAAAIBif7pE29kRKYtoC/6WiwLBTwHM92vJeA5+hl4b3dRVRVYQ8kQzN28cZ0cmbDJsJ00rS4ZnOS7+zrRzx1ERx8q7LxvLQMpZ1dnV4vp+29ZNzxzH6A9c9xwOAg3jHG7cUfevGOu/WU9B0Yy0aOMRAt1nMhsdps5ce6bLxufWNy2Xsg== skobyda@fedora", # noqa: E501 | ||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDDgWb+2py/yxLEj9+wB+q35vQ1wnHtVLKMzuTZP6mMvDwFllFhne3CcDfQwn/mRSbAdeWUmbNQrAXrbzg+IzRk69ma78wZ/8VaA/wD8BKmRL+qjBVVV5RmNG5FyGLejmiTMSsqTN19Vsjk9k02KZ4LDK+Vg8Pb467chNac684G1wtsGhyVXuYHK2xjyK2dkcev7En8SKulE2xKOVqeztQJ8dIdqV7nFmcmr1yYiiPzgVm/29rgan8YBp6YoZ8ux4F1QBx0tPvTNczDJh5AAKxwU23ZgKYsdp4JP2NQ7UbydPmsiSwjHwYCuQ2MHunRrxWlDi0UGrjQWbJad/UCSpbNHmQ5J+SNixOvtb5F4xg3uoXf9NTlK8B+hAPghNnWTsZrCcBdSNg2puqsJV2fIdxkUlS1dJWo7nTGt4WqaN7tAS/3zL6zIxiKjyjf6jiTZMCs56/+iWmiaitW0YLAGG1JXiClbfjbzAPM4FyWF2XOdK0nuazGH1UOKaVyaCcykg8=", # noqa: E501 | ||
], | ||
create_and_run=True)) | ||
|
||
def testCreateDownloadAnOS(self): | ||
runner = TestMachinesCreate.CreateVmRunner(self) | ||
config = TestMachinesCreate.TestCreateConfig | ||
|
@@ -802,6 +845,7 @@ vnc_password= "{vnc_passwd}" | |
root_password=None, | ||
user_password=None, | ||
user_login=None, | ||
ssh_keys=None, | ||
storage_pool=NEW_VOLUME_QCOW2, storage_volume='', | ||
create_and_run=False, | ||
delete=True, | ||
|
@@ -847,6 +891,7 @@ vnc_password= "{vnc_passwd}" | |
self.root_password = root_password | ||
self.user_password = user_password | ||
self.user_login = user_login | ||
self.ssh_keys = ssh_keys | ||
self.create_and_run = create_and_run or is_unattended | ||
self.storage_pool = storage_pool | ||
self.storage_volume = storage_volume | ||
|
@@ -1072,6 +1117,10 @@ vnc_password= "{vnc_passwd}" | |
|
||
self.assertIn("\nssh_pwauth: true", user_data) | ||
|
||
if self.ssh_keys is not None: | ||
for key in self.ssh_keys: | ||
self.assertIn(key, user_data) | ||
|
||
# --unattended option is conflicting with --cloud-init option, resulting --cloud-init user_data being ignored | ||
# https://bugzilla.redhat.com/show_bug.cgi?id=2096200#c14 | ||
self.assertNotIn("--unattended", virt_install_cmd_out) | ||
|
@@ -1233,6 +1282,12 @@ vnc_password= "{vnc_passwd}" | |
b.set_input_text("#user-login", self.user_login) | ||
if self.root_password: | ||
b.set_input_text("#create-vm-dialog-root-password-pw1", self.root_password) | ||
if self.ssh_keys is not None: | ||
for idx, key in enumerate(self.ssh_keys): | ||
b.click("button:contains(Add SSH keys)") | ||
b.set_input_text(f"#create-vm-dialog-ssh-key-{idx} textarea", key, value_check=False, blur=False) | ||
# Check that ssh key was validated | ||
# TODO b.wait_visible(f"#create-vm-dialog-ssh-key-{idx} #validated") | ||
|
||
if self.is_unattended: | ||
b.wait_visible("#create-and-edit[aria-disabled=true]") | ||
|
Submodule reference
updated
10 files