Commit Graph

163 Commits

Author SHA1 Message Date
Jake Jackson
c6930bdf32 Address Lookup Plugins AttributeError (#15770)
* fix backend attribute error

* managedcredential may now contain 2 different classes
* managedcredentialType and one that represents a lookup plugin

* conditionalize creation params

* added a conditional statement to filter our external types

* all external credentials are managed by awx/aap
2025-01-29 10:27:51 -05:00
Jake Jackson
f05173cb65 Add new credential entry point discovery (#15685)
* - add new entry points
- add logic to check what version of the project is running

* remove former discovery method

* update custom_injectors and remove unused import

* fix how  we load external creds

* remove stale code to match devel

* fix cloudforms test and move credential loading

* add load credentials method to get tests passing

* Conditionalize integration tests if the cred is present

* remove inventory source test

* inventory source is covered in the workflow job template target
2025-01-15 16:10:28 -05:00
Alan Rominger
f57a9863d6 Use advisory_lock from DAB (#15676)
* Use advisory_lock from DAB

* Remove the django-pglocks dep

* Re-run updater script

* Move the import in new location
2025-01-15 14:06:59 -05:00
Chris Meyers
bd96000494 Remove inject_credential from awx
* Consume inject_credential from its new home, awx_plugins.interfaces
2024-12-19 09:48:47 -05:00
Chris Meyers
a129bc860b Flake8 fix 2024-12-10 13:02:09 -05:00
Chris Meyers
c82a8f4b9c Add custom_injectors to test code path
* Unit tests do not create CredentialType records for Credential
  plugins. Instead, they explicitly instantiate CredentialType(s) for
  Credential plugins. They rely on CredentialType.defaults[key] to do
  so. This change makes sure custom_injectors get bolted onto the
  created CredentialType.
2024-12-10 13:02:09 -05:00
Chris Meyers
aeca9db470 Rename post_injectors to custom_injectors 2024-12-10 13:02:09 -05:00
Chris Meyers
4b85e7e25a Adopt post_injectors change from awx-plugins 2024-12-10 13:02:09 -05:00
Chris Meyers
e411f3534f Decouple inject_credentials from dynamic inputs
* Preparation for moving inject_credentials out of this repo
2024-12-02 11:32:46 -05:00
Sviatoslav Sydorenko (Святослав Сидоренко)
ece21b15d0 Use awx-plugins-shared code from awx_plugins.interfaces (#15566)
* Add `awx_plugins.interfaces` runtime dependency

* Use `awx_plugins.interfaces` for runtime detection

The original function name was `server_product_name()` but it didn't
really represent what it did. So it was renamed into
`detect_server_product_name()` in an attempt of disambiguation.

* Use `awx_plugins.interfaces` to map container path

The original function `to_container_path` has been renamed into
`get_incontainer_path()` to represent what it does better and make
the imports more obvious.

* Add license file for awx_plugins.interfaces

---------

Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com>
2024-10-02 18:40:16 +00:00
Seth Foster
3baea0f206 Validate org-user membership from gateway (#15508)
Adding credential and execution environment roles
validates that the user belongs to the same org
as the credential or EE.

In some situations, the user-org membership has not
yet been synced from gateway to controller.

In this case, controller will make a request to
gateway to check if the user is part of the org.

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
2024-09-13 17:56:43 -04:00
Sviatoslav Sydorenko (Святослав Сидоренко)
e68370f2aa Replace pkg_resources with importlib.metadata (#15441) 2024-09-13 17:39:14 +00:00
Chris Meyers
490db08224 Register CredentialType(s) every time Django loads
* Register all discovered CredentialType(s) after Django finishes
  loading
* Protect parallel registrations using shared postgres advisory lock
* The down-side of this is that this will run when it does not need to,
  adding overhead to the init process.
* Only register discovered credential types in the database IF
  migrations have ran and are up-to-date.
2024-09-12 14:11:19 -04:00
Chris Meyers
1d89e1a019 Move credential code up a dir
* There is only __init__.py in awx/main/models/credential/ now. So let's
  simplify things and move init up a dir.
2024-09-04 14:46:22 -04:00
Ryan Petrello
dbb4d2b011 refactor credential injection for builtin types
this cleanups up a _lot_ of code duplication that we have for builtin
credential types. it will allow customers to setup custom inventory
sources that utilize builtin credential types (e.g., a custom inventory
script that could use an AzureRM credential)

see: https://github.com/ansible/ansible-tower/issues/7852
2018-01-17 16:50:28 -05:00
Matthew Jones
9dbcc5934e Merge remote-tracking branch 'tower/release_3.2.2' into devel 2017-12-13 12:25:47 -05:00
AlanCoding
1c8217936d Bug fixes from integration ran on launchtime branch
Make error message for muti-vault validation more
consistent with historical message
2017-12-08 13:46:38 -05:00
AlanCoding
5ada021a6e Tweak validation to allow multiple vault credentials
support providing vault passwords based on id
include needed passwords in launch serializer defaults
2017-12-08 13:43:43 -05:00
AlanCoding
34a8e0a9b6 Feature: saved launchtime configurations
Consolidate prompts accept/reject logic in unified models
Break out accept/reject logic for variables
Surface new promptable fields on WFJT nodes, schedules

Make schedules and workflows accurately reject variables
  that are not allowed by the prompting
  rules or the survey rules on the template

Validate against unallowed extra_data in system job schedules
Prevent schedule or WFJT node POST/PATCH with unprompted data
Move system job days validation to new mechanism
Add new psuedo-field for WFJT node credential
Add validation for node related credentials
Add related config model to unified job
Use JobLaunchConfig model for launch RBAC check

Support credential overwrite behavior with multi-creds
  change modern manual launch to use merge behavior
Refactor JobLaunchSerializer, self.instance=None
Modularize job launch view to create "modern" data
Auto-create config object with every job
Add create schedule endpoint for jobs
2017-12-08 13:38:54 -05:00
Ryan Petrello
a1f8f65add support specifying multiple vault IDs for a playbook run
see: https://github.com/ansible/awx/issues/352
2017-11-30 16:55:17 -05:00
Ryan Petrello
6fa0d9d4ed rename oVirt4 to Red Hat Virtualization
see: https://github.com/ansible/ansible-tower/issues/7790
2017-11-28 11:02:42 -05:00
Matthew Jones
5e37d6ea7e Remove unused TOWER_HOST and AWX_HOST env vars
These were conflicting with the new Tower credential
2017-11-02 10:44:06 -04:00
Matthew Jones
f019452207 Merge pull request #551 from ansible/tower_inventory_source
Tower inventory source
2017-10-27 08:41:24 -04:00
Matthew Jones
85be3c7692 Align inventory variables with Ansible modules 2017-10-27 08:12:14 -04:00
Matthew Jones
fdc7f58bb4 Support passing instance filters to tower inventory src
* Switch ignore ssl errors to default on
* Application inventory source defaults for Tower src
2017-10-26 13:51:05 -04:00
Matthew Jones
6c597ad165 Adding initial credential and invsrc for Tower
* New credential type for Tower
* Inventory source definitions and migrations for Tower
* Initial Tower inventory source script
2017-10-26 13:51:05 -04:00
Aaron Tan
f28b48a473 support AZURE_CLOUD_ENVIRONMENT
Relates #7737 of ansible-tower.

Signed-off-by: Aaron Tan <jangsutsr@gmail.com>
2017-10-26 10:11:21 -04:00
Aaron Tan
553e81f888 Add protection against credential getattr
Relates #474.

Add protection in `__getattr__` method to prevent possible infinite
recursion loop.

Signed-off-by: Aaron Tan <jangsutsr@gmail.com>
2017-10-24 12:08:41 -04:00
Ryan Petrello
c1e20fe7a0 properly support authentication for ovirt4 ansible modules
see: https://github.com/ansible/ansible-tower/issues/6522
see: https://github.com/ansible/ansible-tower/issues/6522#issuecomment-337909863
2017-10-19 09:47:25 -04:00
Ryan Petrello
f4a252a331 add new credential types in a more stable way in migrations
instead of writing individual migrations for new built-in credential
types, this change makes the "setup_tower_managed_defaults" function
idempotent so that it only adds the credential types you're missing
2017-10-10 14:38:45 -04:00
Ryan Petrello
74f2509482 support ovirt4 as a built-in inventory source
see: https://github.com/ansible/ansible-tower/issues/6522
2017-10-10 14:38:44 -04:00
Chris Meyers
a08a158672 remove azure 2017-09-18 10:35:32 -04:00
Aaron Tan
276bed2d0b Disallow changing credential_type of an existing credential 2017-08-31 11:25:01 -04:00
Ryan Petrello
54d6c4ebfd Merge pull request #304 from ryanpetrello/required-cred-fields
mark a variety of credential fields as required
2017-08-18 17:02:24 -04:00
Ryan Petrello
05eac58c65 Merge pull request #301 from ryanpetrello/release_3.2.0
make `vault_password` required for Vault credentials
2017-08-18 17:02:15 -04:00
Ryan Petrello
b0a1988c29 add required fields for cloudforms credentials
see: https://github.com/ansible/ansible-tower/issues/7462
2017-08-18 16:18:06 -04:00
Ryan Petrello
bcd8e13c24 add required fields for gce credentials
see: https://github.com/ansible/ansible-tower/issues/7463
2017-08-18 16:18:06 -04:00
Ryan Petrello
fc73bdcc18 add required fields for azure classic credentials
https://github.com/ansible/ansible-tower/issues/7464
2017-08-18 16:18:05 -04:00
Ryan Petrello
5ba76f28ce add required fields for azure credentials
see: https://github.com/ansible/ansible-tower/issues/7465
2017-08-18 16:18:05 -04:00
Ryan Petrello
90b5d98e5c add required fields for network credentials
see: https://github.com/ansible/ansible-tower/issues/7466
2017-08-18 16:18:04 -04:00
Ryan Petrello
50782b9465 add required fields for RHSatellite6 credentials
see: https://github.com/ansible/ansible-tower/issues/7467
2017-08-18 16:18:04 -04:00
Ryan Fitzpatrick
da70c11da5 Minor credential help text correction 2017-08-18 16:09:13 -04:00
Ryan Petrello
438d41c986 make vault_password required for Vault credentials
see: https://github.com/ansible/ansible-tower/issues/7468
2017-08-18 14:10:19 -04:00
Ryan Petrello
5e15f9e04e add validation errors for certain dependent credential fields
see: https://github.com/ansible/ansible-tower/issues/7323
see: https://github.com/ansible/ansible-tower/issues/7293
see: https://github.com/ansible/ansible-tower/issues/7289
see: https://github.com/ansible/ansible-tower/issues/7292
2017-07-28 16:07:37 -04:00
Matthew Jones
01403f5fa4 Add awx_ and AWX_ environment vars and extra_vars alongside Tower 2017-07-26 13:35:30 -04:00
Bill Nottingham
864d803273 Don't hardcode privilege escalation prompts if they're all of the same format.
Just create them all from supported privilege escalation types.
2017-07-25 17:23:10 -04:00
Ryan Petrello
340ced02e2 Merge pull request #7240 from ryanpetrello/fix-7216
improve sanitation of empty credential values to match API v1 behavior
2017-07-21 12:45:16 -04:00
Ryan Petrello
a640d6afec improve sanitation of empty credential values to match API v1 behavior
This is mostly backwards compatability to avoid surprises: in 3.1.x
if you submit a field value with `null` or an empty string to
a CharField, it's treated as an empty string (and SSH key validation
is skipped).  For boolean field values (`net.authorize`), `null` and
empty string are coerced to `False`.

see: #7216
see: #7218
2017-07-21 11:25:56 -04:00
Bill Nottingham
369c0f19ec Keep the 'machine' credential name for user/password & key credentials. 2017-07-21 10:24:34 -04:00
Ryan Petrello
0b6c43dac0 allow access to insights credentials in /api/v1/
see: #6978
2017-07-17 10:14:29 -04:00