Skip to content

Commit

Permalink
Update awxkit to manage Org galaxy credentials
Browse files Browse the repository at this point in the history
Add the new credential type to the Credential page object and helper
methods to manage the galaxy credentials for the Organization page
object.
  • Loading branch information
elyezer authored and ryanpetrello committed Sep 1, 2020
1 parent 8c478b3 commit 163480a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class Migration(migrations.Migration):

dependencies = [
('main', '0117_v400_remove_cloudforms_inventory'),
('main', '0118_add_remote_archive_scm_type'),
]

operations = [
Expand Down
1 change: 1 addition & 0 deletions awxkit/awxkit/api/pages/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
18 changes: 18 additions & 0 deletions awxkit/awxkit/api/pages/organizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ def add_user(self, user):
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))
Expand Down

0 comments on commit 163480a

Please sign in to comment.