mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
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:
parent
4046b18eff
commit
ad85b176f4
@ -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',
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user