Skip to content

Commit

Permalink
plugins: Allow custom engine admin user
Browse files Browse the repository at this point in the history
- Get the engine admin username from ansible code, if passed

- Pass this on to next calls to ansible

Change-Id: I429849451f3d0f538384a2d0869f17b79bd37535
Signed-off-by: Yedidyah Bar David <[email protected]>
  • Loading branch information
didib authored and mrkev-gh committed May 5, 2022
1 parent c2294f1 commit be37321
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/plugins/gr-he-ansiblesetup/core/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,13 @@ def _closeup(self):
except KeyError:
raise RuntimeError(_('Unable to get appliance disk size'))

if 'otopi_he_admin_username' in r:
self.environment[
ohostedcons.EngineEnv.ADMIN_USERNAME
] = r[
'otopi_he_admin_username'
]['ansible_facts']['he_admin_username']

# TODO: get the CPU models list from /ovirt-engine/api/clusterlevels
# once wrapped by ansible facts and filter it by host CPU architecture
# in order to let the user choose the cluster CPU type in advance
Expand Down
14 changes: 13 additions & 1 deletion src/plugins/gr-he-ansiblesetup/core/storage_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ def _query_iscsi_target(
'he_admin_password': self.environment[
ohostedcons.EngineEnv.ADMIN_PASSWORD
],
'he_admin_username': self.environment[
ohostedcons.EngineEnv.ADMIN_USERNAME
],
'he_iscsi_discover_username': discover_username,
'he_iscsi_discover_password': discover_password,
'he_iscsi_portal_addr': portal,
Expand Down Expand Up @@ -320,6 +323,9 @@ def _query_iscsi_lunid(
'he_admin_password': self.environment[
ohostedcons.EngineEnv.ADMIN_PASSWORD
],
'he_admin_username': self.environment[
ohostedcons.EngineEnv.ADMIN_USERNAME
],
'he_iscsi_username': username,
'he_iscsi_password': password,
'he_iscsi_portal_addr': portal,
Expand Down Expand Up @@ -374,7 +380,10 @@ def _query_fc_lunid(self):
],
'he_admin_password': self.environment[
ohostedcons.EngineEnv.ADMIN_PASSWORD
]
],
'he_admin_username': self.environment[
ohostedcons.EngineEnv.ADMIN_USERNAME
],
}
ansible_helper = ansible_utils.AnsibleHelper(
tags=ohostedcons.Const.HE_TAG_FC_GETDEVICES,
Expand Down Expand Up @@ -775,6 +784,9 @@ def _closeup(self):
'he_admin_password': self.environment[
ohostedcons.EngineEnv.ADMIN_PASSWORD
],
'he_admin_username': self.environment[
ohostedcons.EngineEnv.ADMIN_USERNAME
],
'he_local_vm_dir': self.environment[
ohostedcons.CoreEnv.LOCAL_VM_DIR
],
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/gr-he-ansiblesetup/core/target_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def _closeup(self):
'he_admin_password': self.environment[
ohostedcons.EngineEnv.ADMIN_PASSWORD
],
'he_admin_username': self.environment[
ohostedcons.EngineEnv.ADMIN_USERNAME
],
'he_appliance_password': self.environment[
ohostedcons.CloudInit.ROOTPWD
],
Expand Down

0 comments on commit be37321

Please sign in to comment.