Update awxkit to manage Org galaxy credentials

Add the new credential type to the Credential page object and helper
methods to manage the galaxy credentials for the Organization page
object.
This commit is contained in:
Elyézer Rezende 2020-09-01 11:56:46 -04:00 committed by Ryan Petrello
parent 4046b18eff
commit ad85b176f4
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 19 additions and 0 deletions

View File

@ -82,6 +82,7 @@ def config_cred_from_kind(kind):
credential_type_name_to_config_kind_map = {
'amazon web services': 'aws',
'ansible galaxy/automation hub api token': 'galaxy',
'ansible tower': 'tower',
'google compute engine': 'gce',
'insights': 'insights',

View File

@ -22,6 +22,24 @@ class Organization(HasCreate, HasInstanceGroups, HasNotifications, base.Base):
with suppress(exc.NoContent):
self.related.users.post(user)
def add_galaxy_credential(self, credential):
if isinstance(credential, page.Page):
credential = credential.json
with suppress(exc.NoContent):
self.related.galaxy_credentials.post({
"id": credential.id,
})
def remove_galaxy_credential(self, credential):
if isinstance(credential, page.Page):
credential = credential.json
with suppress(exc.NoContent):
self.related.galaxy_credentials.post({
"id": credential.id,
"disassociate": True,
})
def payload(self, **kwargs):
payload = PseudoNamespace(name=kwargs.get('name') or 'Organization - {}'.format(random_title()),
description=kwargs.get('description') or random_title(10))