Code Monkey home page Code Monkey logo

Comments (7)

djyasin avatar djyasin commented on September 27, 2024 1

Hello @neevnuv, after further research we have determined we don't yet have this functionality for this type of credential. I have added the feature flag to this and have added this to our backlog. PRs are welcome!

from awx.

jbradberry avatar jbradberry commented on September 27, 2024 1

@neevnuv Since the API endpoint is of type SubListCreateAPIView (i.e. it can take a full object instead of just an id to attach), adding it to the DEPENDENT_EXPORT list is probably what you want. You should be aware, though, that the downside of this is that on every import a new credential input source will be created, instead of an existing one reused. If that seems unacceptable, credential input sources do have a top-level API endpoint, so they could be added to EXPORTABLE_RESOURCES instead. The downside of that, though, is that you would need to make sure that the type is included in your exports (you either export everything, or include a --credential_input_sources flag in your awx export command). You will also have to add a natural key to the page type if you go this route.

Other things to care about when adding a new resource like this is whether we have a Page type for it somewhere in awxkit/awxkit/api/pages/ (and it appears that we do for these), and if we have url patterns in awxkit/awxkit/api/resources.py that match the endpoints (and it looks like we do).

I'd say go ahead and add it to DEPENDENT_EXPORT and try it out, both exporting and importing. I suspect that it will just work. To answer your question, the import machinery also makes use of that list, so there should be nothing special that you need to do there.

from awx.

djyasin avatar djyasin commented on September 27, 2024

Hello @neevnuv,
I am exploring this issue now. Just to confirm, in your exported file resources.json there is no actual json in the file, is that correct? Are you just seeing two empty curly brackets?

from awx.

neevnuv avatar neevnuv commented on September 27, 2024

After creating a HashiCorp Vault Secret Lookup credential, I created another credential that uses the Hashicorp secret lookup credential in order to fetch its secure data, as you'll see in the image below:

image

After doing so, when exporting the credentials using the cli, the output json does not contain any data about the credential input sources. Even though the input sources do not contain any important data (data that should be encrypted).

For example, when I ran the following command to get the git credential:

awx export --credentials <git-cred-id> --conf.host http://my-awx.com --conf.username <my-user> --conf.token <my-token> resources.json

I receive the following json:

{
     "credentials": [
          {
               "name": "Git Credential",
               "description": "My Cool Git Credential",
               "organization": null,
               "inputs": {},
               "credential_type": {
                    "name": "Source Control",
                    "kind": "scm",
                    "type": "credential_type"
               },
               "user": {
                    "username": "admin",
                    "type": "user"
               },
               "natural_key": {
                    "organization": null,
                    "name": "Git Credential",
                    "credential_type": {
                         "name": "Source Control",
                         "kind": "scm",
                         "type": "credential_type"
                    },
                    "type": "credential"
               }
          }
     ]
}

I am hoping the credential input sources would be also visible here, for exporting/importing awx instances. It would allow me to backup the tower credential resources without losing the data inside them (without having to reconfigure the secret lookup for vault each time I import the credentials back).

from awx.

djyasin avatar djyasin commented on September 27, 2024

Thank you so much for providing this additional information! I can confirm I can duplicate this on my end.

from awx.

neevnuv avatar neevnuv commented on September 27, 2024

Will it solve the export issue if we add the credential_input_source to the export command to the list of DEPENDENT_EXPORT?
Here:

DEPENDENT_EXPORT = [
('JobTemplate', 'Label'),
('JobTemplate', 'SurveySpec'),
('JobTemplate', 'Schedule'),
('WorkflowJobTemplate', 'Label'),
('WorkflowJobTemplate', 'SurveySpec'),
('WorkflowJobTemplate', 'Schedule'),
('WorkflowJobTemplate', 'WorkflowJobTemplateNode'),
('InventorySource', 'Schedule'),
('Inventory', 'Group'),
('Inventory', 'Host'),
('Inventory', 'Label'),
('WorkflowJobTemplateNode', 'WorkflowApprovalTemplate'),
]

And should there be any change in the import process?

from awx.

neevnuv avatar neevnuv commented on September 27, 2024

Hello, I opened a PR and tested it on a local minikube awx instance, the PR doesn't contain a lot of changes.
I ran a few tests on it, they all worked well. I would love if you take a look and gave me feedback. #14798

from awx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.