mirror of
https://github.com/ansible/awx.git
synced 2026-09-15 00:10:09 -02: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:
@@ -82,6 +82,7 @@ def config_cred_from_kind(kind):
|
|||||||
|
|
||||||
credential_type_name_to_config_kind_map = {
|
credential_type_name_to_config_kind_map = {
|
||||||
'amazon web services': 'aws',
|
'amazon web services': 'aws',
|
||||||
|
'ansible galaxy/automation hub api token': 'galaxy',
|
||||||
'ansible tower': 'tower',
|
'ansible tower': 'tower',
|
||||||
'google compute engine': 'gce',
|
'google compute engine': 'gce',
|
||||||
'insights': 'insights',
|
'insights': 'insights',
|
||||||
|
|||||||
@@ -22,6 +22,24 @@ class Organization(HasCreate, HasInstanceGroups, HasNotifications, base.Base):
|
|||||||
with suppress(exc.NoContent):
|
with suppress(exc.NoContent):
|
||||||
self.related.users.post(user)
|
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):
|
def payload(self, **kwargs):
|
||||||
payload = PseudoNamespace(name=kwargs.get('name') or 'Organization - {}'.format(random_title()),
|
payload = PseudoNamespace(name=kwargs.get('name') or 'Organization - {}'.format(random_title()),
|
||||||
description=kwargs.get('description') or random_title(10))
|
description=kwargs.get('description') or random_title(10))
|
||||||
|
|||||||
Reference in New Issue
Block a user