Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Credential Input Source Export for Exporting Credentials using awxkit #14798

Open
wants to merge 19 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion awxkit/awxkit/api/pages/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,21 @@
'execution_environments',
'applications',
'schedules',
'credential_input_sources',
]


EXPORTABLE_RELATIONS = ['Roles', 'NotificationTemplates', 'WorkflowJobTemplateNodes', 'Credentials', 'Hosts', 'Groups', 'ExecutionEnvironments', 'Schedules']
EXPORTABLE_RELATIONS = [
'Roles',
'NotificationTemplates',
'WorkflowJobTemplateNodes',
'Credentials',
'Hosts',
'Groups',
'ExecutionEnvironments',
'Schedules',
'CredentialInputSource',
]


# These are special-case related objects, where we want only in this
Expand All @@ -48,6 +59,7 @@
('Inventory', 'Host'),
('Inventory', 'Label'),
('WorkflowJobTemplateNode', 'WorkflowApprovalTemplate'),
('Credential', 'CredentialInputSource'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't want this here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't this allow to export the credential input sources when imoprting a credential with an input source?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. As I explained before, DEPENDENT_EXPORT doesn't quite work with how this relationship is being exposed in the API. You'll have to leave this out, and in order to correctly export a user will need to do both --credentials and --credential_input_sources.

]


Expand Down
7 changes: 5 additions & 2 deletions awxkit/awxkit/api/pages/credential_input_sources.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from awxkit.api.resources import resources
from awxkit.api.pages import Credential
from awxkit.api.mixins import HasCreate
from . import base
from . import page


class CredentialInputSource(base.Base):
pass
class CredentialInputSource(HasCreate, base.Base):
dependencies = [Credential]
NATURAL_KEY = ('target_credential', 'input_field_name')


page.register_page(resources.credential_input_source, CredentialInputSource)
Expand Down
Loading