34299 Commits

Author SHA1 Message Date
Hao Liu
b70e884484
AAP-47495 Hide CSRF_TRUSTED_ORIGINS (#16035) (#6984)
Hide CSRF_TRUSTED_ORIGINS
2025-09-04 15:02:40 -04:00
Peter Braun
05b6f4fcb9
Aap 47760 - initial auth migration management command (#6981)
* wip: management command for authenticator export to GateWay

* wip: implement ldap auth config migration

* refactor: split concerns into gathering config and converting / recreating config

* refactor: dry run by default

* use the authenticator slug for idempotency

* move to correct utils path

* use env vars instead of flags, fix linter errors

* remove unused import
2025-09-04 15:02:38 -04:00
Peter Braun
243e27c7a9 Aap 49452 - support CONTROLLER_OPTIONAL_API_URLPATTERN_PREFIX in awxkit (#16085)
* fix: awxkit should honor CONTROLLER_OPTIONAL_API_URLPATTERN_PREFIX if defined

* add unit tests

* update tests
2025-09-03 15:22:38 -04:00
Dan Leehr
7fe525a533 Fix issue with some modules not honoring Controller API prefix (#16080)
* Fix issue where export module does not honor CONTROLLER_OPTIONAL_API_URLPATTERN_PREFIX

* Add unit test and handle leading/trailing slashes

* Reformat

* Refactor for clarity

* Remove unused import
2025-09-03 14:58:07 -04:00
Stevenson Michel
c36ce902db
AAP-42929 : Retrieval of Projects of a Team and Teams of a Project (#7086)
* Fixed merge conflicts

* fix linters

* Added test for projectTeamsList
2025-09-03 14:05:17 -04:00
Lila Yasin
44e9dee9c7
[Bug Fix 4.6] AAP-49077 Task stdout escapes quotes twice only with Controller API api/v2/jobs/{id}/stdout/?format=txt (#7071)
* Move logic to unified job model instead of view

* Refine logic to only apply to double escaped characters to prevent touching unicord chars

* Refine logic to only apply to stdout so that it does not impact webhook notifications

* Revise naming to reflect correction to escapes, not just escape quotes

* Update code comments to reflect fixing double escapes vs double escaped quotes specifically

* Add regex for 5 most common python escape chars to make fix more robust
2025-09-02 14:49:13 -04:00
jessicamack
e3a9d9fbe8
[AAP-51443]CVE-2025-48432 (#7073)
* bump Django version to patch with additional hardening
2025-08-29 15:57:16 -04:00
Peter Braun
8b13c75f2e
Allow creating galaxy credential types without an organization (#16077) (#7074)
* remove requirement for galaxy credentials to belong to an organization

* remove organization check for galaxy credential type
2025-08-28 15:15:36 +02:00
Jake Jackson
36ec5efc88
update work flow to actually fail (#7069)
* the workflow has been failing silently without catching a merge
  conflict. this removes the fail pretty logic previously implemented.
* just fail if a merge conflict is encountered
2025-08-21 18:49:54 +00:00
Lila Yasin
4e332ac2c7
AAP-45933 [2.5 Backport] AAP-4865 bug fact storage (#6945)
* Revise start_fact_cache and finish_fact_cache to use JSON file (#15970)

* Revise start_fact_cache and finish_fact_cache to use JSON file with host list inside it

* Revise artifacts path to be relative to the job private_data_dir

* Update calls to start_fact_cache and finish_fact_cache to agree with new reference to artifacts_dir

* Prevents unnecessary updates to ansible_facts_modified, fixing timestamp-related test failures.

* Import bulk_update_sorted_by_id

* Removed assert that calls ansible_facts_new which was removed in the backported pr

* Add import of Host back
2025-08-20 10:22:15 -04:00
Jake Jackson
8fe4223eac
[AAP-47384] CVE 2025 47273 (#7054)
* Update requirements for setuptools

* first pass and need to commit

* update makefile and run updater script

* updated makefile per readme
* ran updater script

* Patch irc backend to avoid namespace collision w/ jaraco

When importing the IRC backend, jaraco resolves to
the version vendored inside setuptools:

1) importing irc backend…
irc_backend ERROR: ModuleNotFoundError("No module named 'jaraco.stream'")

2) sys.modules['jaraco'] after failure:
present: True
type: <class 'module'>
__file__: /var/lib/awx/venv/awx/lib64/python3.11/site-packages/setuptools/_vendor/jaraco/__init__.py
__path__: ['/var/lib/awx/venv/awx/lib64/python3.11/site-packages/setuptools/_vendor/jaraco']
__spec__: ModuleSpec(name='jaraco',
loader=<_frozen_importlib_external.SourceFileLoader object at 0x7f006a0eccd0>,
origin='/var/lib/awx/venv/awx/lib64/python3.11/site-packages/setuptools/_vendor/jaraco/__init__.py',
submodule_search_locations=['/var/lib/awx/venv/awx/lib64/python3.11/site-packages/setuptools/_vendor/jaraco'])

Since setuptools does not vendor jaraco.stream, it blew up. This patch ensures
jaraco.stream gets imported *before* attempting to import the irc modules.

* Revert "[4.6][dependency] CVE 2025 47273 (#7020)" (#7027)

This reverts commit e8b2920aec95de2c51308ce2fb14773ef676d01a.

* reformatted irc backend with black

* ran black to fix linting issues

* Reapply "[4.6][dependency] CVE 2025 47273 (#7020)" (#7027)

This reverts commit 0c6df9b13398a93569fae7558e1a0e72cbe8fb6c.

* add flake8 ignore since jaraco.stream is needed

* jaraco.stream is not directly called in the file but is needed by irc
  so ignore the linter failure

---------

Co-authored-by: Shane McDonald <me@shanemcd.com>
2025-08-19 15:59:24 +00:00
Peter Braun
e8c4b302ad
remove requirement for galaxy credentials to belong to an organization (#16075) (#7066) 2025-08-15 16:27:22 -04:00
Chris Meyers
e82de50edb Fix controller_oauthtoken regression and more
* aap_token now functions like controller_oauthtoken
* lookup('awx.awx.controller_api', ...) fixed
2025-08-15 10:00:37 -04:00
Robin Bobbitt
11f31ef796
AAP-43883: clear cached LICENSE setting on change (#16065) (#7064)
* clear LICENSE from cache on change



* Adds tests for license cache clearing

Generated by Cursor (claude-4-sonnet)



* test fixes

Generated with Cursor (claude-4-sonnet)



---------

Signed-off-by: Robin Y Bobbitt <rbobbitt@redhat.com>
Co-authored-by: Jake Jackson <jljacks93@gmail.com>
2025-08-14 14:02:34 -04:00
Robin Bobbitt
9033e829fe
fixes UnboundLocalError in POST /attach (#16062) (#7059)
* fixes UnboundLocalError in POST /attach
* bust cache for credentials before attaching subscription
---------

Signed-off-by: Robin Y Bobbitt <rbobbitt@redhat.com>
2025-08-14 09:56:25 -04:00
Elyézer Rezende
4757785016 Pin ansible-core for collection tests (#7030)
Signed-off-by: Elyézer Rezende <elyezermr@gmail.com>
2025-08-12 14:43:52 -04:00
Jake Jackson
3ccc5e5f2c add stable to release workflows
* we changed branch naming schema so adding in the new name
2025-07-24 15:54:19 -04:00
Jake Jackson
550ae51aec
Revert "[4.6][dependency] CVE 2025 47273 (#7020)" (#7027)
This reverts commit e8b2920aec95de2c51308ce2fb14773ef676d01a.
2025-07-23 13:22:25 -04:00
Jake Jackson
e8b2920aec
[4.6][dependency] CVE 2025 47273 (#7020)
* Update requirements for setuptools

* first pass and need to commit

* update makefile and run updater script
2025-07-22 15:21:06 -04:00
Jake Jackson
03cd450669
[AAP-47877] Backport collection updates (#6992)
* Update collection args (#16025)

* update collection arguments

* Add integration testing for new param

* fix: sanity check failures

---------

Co-authored-by: Sean Sullivan <ssulliva@redhat.com>
Co-authored-by: Alan Rominger <arominge@redhat.com>

* update formatting for sanity testing

* fixing indentation for sanity suite

* adjust tests to use new token name

* update tests to use aap_token instead of controller_oauthtoken

* add back aliases for backward compat

* we have integration tests that still leverage the old token name
* while we can rename these, this tells me that customers might still
  have them in the wild and breaking them in a z stream is no bueno

* revert alias changes

---------

Co-authored-by: Peter Braun <pbraun@redhat.com>
Co-authored-by: Sean Sullivan <ssulliva@redhat.com>
Co-authored-by: Alan Rominger <arominge@redhat.com>
2025-07-10 10:14:40 -04:00
Jake Jackson
1d4b555a2c
Update feature_branch_sync.yml (#7006)
fix typo in workflow title
2025-07-10 02:37:35 +00:00
Luis Villa
69df7d0e27
[AAP-48771]wfjt migration to catch renaming (#6991)
* wfjt migration to catch renaming

* Added rename_wfjt function to template constraint migration
* Add test to add duplicate names and verify that the duplicates are renamed

* move object creation

* add missing rename_wfjt operation

* fix linter issues

* fix tox issues

* test manually and move operation

* added back credential type validation code
2025-07-09 15:51:55 -04:00
Jake Jackson
ec0732ce94
AAP-48139 add branch sync between release_4.6 and stable-2.6 (#6982)
* add branch sync between release_4.6 and stable-2.6

* add a new workflow to force push commits in release_4.6 to
  stable-2.6

* Update workflow to use matrix keyword


---------

Co-authored-by: Jake Jackson
2025-06-30 19:56:08 -04:00
jessicamack
1afd23043d
Remove api version from hardcoded inventory url (#16039) (#6980)
* update url endpoints

* reformat line for length
2025-06-25 22:53:03 +02:00
Matthew Sandoval
11a9a2b066
Pin receptorctl 1.5.7 (#6979) 2025-06-24 19:48:55 +00:00
Lila Yasin
5752c7a8e2
[2.5 Backport] AAP-46038 database deadlock (#6947)
Sort both bulk updates and add batch size to facts bulk update to resolve deadlock issue

Update tests to expect batch_size to agree with changes

Add utility method to bulk update and sort hosts and applied that to the appropriate locations

Update functional tests to use bulk_update_sorted_by_id since update_hosts has been deleted

Add comment NOSONAR to get rid of Sonarqube warning since this is just a test and it's not actually a security issue

Fix failing test test_finish_job_fact_cache_clear & test_finish_job_fact_cache_with_existing_data

---------

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
Co-authored-by: Alan Rominger <arominge@redhat.com>
Co-authored-by: Seth Foster <fosterbseth@gmail.com>
2025-06-16 15:32:55 -04:00
Alan Rominger
3d027bafd0
AAP-44233 Create credential types in new migration step (#6969)
* Update database to credential types in new migration file

* bump migration

* Add assertion

* Pre-delete credentials so we test recreation
2025-06-11 16:26:42 -04:00
Jake Jackson
ee19ee0c10
Update workflow to allow the workflow to write (#6975)
* Update the workflow to allow the action to write our branches from it.
* Also added username and email as git by default will want to know who
  is performing the action (edge case). Using github actions bot is
standard practice
2025-06-11 20:07:38 +00:00
Alan Rominger
f1e5cadce7
🧪 Delegate artifact merge and garbage collection to GH (#16019) (#6973)
* 🧪 Unpersist Git creds @ cov combine job

This is one of the things Zizmor [[1]] warns about.

[1]: https://docs.zizmor.sh

* 🧪 Download all coverage artifacts in one go

* 🧪 Delegate artifact garbage collection to GH

This is implemented by setting the retention days input to 1 on the
initial upload.

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <webknjaz@redhat.com>
2025-06-10 16:54:59 -04:00
Satoe Imaishi
a238c5dd09
Bump django to 4.2.21 (#6964) 2025-06-10 10:11:43 -04:00
Jake Jackson
d26c7fedb8
Add workflow to rebase release branches (#6968)
* Adds a workflow that rebases release_4.6 onto release_4.6-next
2025-06-10 10:11:43 -04:00
Jiří Jeřábek (Jiri Jerabek)
f4347d05a9
cherry-pick 222f387 to release_4.6 (#6971) 2025-06-10 10:11:42 -04:00
Hao Liu
4eefce622d
Fixes pytest CI error (#6970)
```
  /var/lib/awx/venv/awx/lib64/python3.11/site-packages/_pytest/python.py:163:
  PytestReturnNotNoneWarning: Expected None, but
  awx/main/tests/unit/test_tasks.py::TestJobCredentials::test_custom_environment_injectors_with_boolean_extra_vars
  returned ['successful', 0], which will be an error in a future version
  of pytest.  Did you mean to use `assert` instead of `return`?
```

* Dug into the git blame for this one
  060585434abb5456935b7378211813b2ceaacaaa is the commit for any
  historians. It was wrongfully carried over from a mock pexpect
  implementation. Our new tests are nice. They don't go as far as trying
  to run the task so they do not need to mock pexpect. That is why it is
  safe to remove this code without finding it a new home.

Co-authored-by: Chris Meyers <chris.meyers.fsu@gmail.com>
2025-06-10 10:11:42 -04:00
TVo
57b8773613
[2.5/4.6 Backport] AAP-40782 Reduce queued stuck jobs (#6962)
* [2.5/4.6 Backport] AAP-40782 Reduce queued stuck jobs

* [2.5/4.6 Backport] AAP-40782 Reduce queued stuck jobs

* Incrp'd review feedback from @AlanCoding

* Reformatted 4 files per CI-check for api-linters
2025-06-10 10:11:42 -04:00
Alan Rominger
d0776dabdf
AAP-32143 Make the JT name uniqueness enforced at the database level (#15956) (#6958)
* Make the JT name uniqueness enforced at the database level

* Forgot demo project fixture

* New approach, done by adding a new field

* Update for linters and failures

* Fix logical error in migration test

* Revert some test changes based on review comment

* Do not rename first template, add test

* Avoid name-too-long rename errors

* Insert migration into place

* Move existing files with git

* Bump migrations of existing

* Update migration test

* Awkward bump

* Fix migration file link

* update test reference again
2025-06-10 10:11:42 -04:00
Peter Braun
2d730abb82
fix: allow unknown keyword arguments (#6972)
Co-authored-by: Peter Braun <pbranu@redhat.com>
2025-06-10 10:11:42 -04:00
Seth Foster
8896f75f9b
Restore basic auth for subscriptions API (#6961)
When POSTing to console.redhat.com, fallback
to using basic auth method if OAUTH via
service accounts fails

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
2025-06-10 10:11:42 -04:00
Mauricio Magnani Jr
bb6bf33b9e
fix: ensure temp files are cleaned up after failed HCC (#6952) 2025-05-21 13:18:24 -04:00
Dirk Jülich
5cf3a09163
AAP-17690 Inventory variables sourced from git project are not getting deleted after being removed from source (#15928) (#6946)
* Delete existing all-group vars on inventory sync (with overwrite-vars=True) instead of merging them.

* Implementation of inv var handling with file as db.

* Improve serialization to file of inv vars for src update

* Include inventory-level variable editing into inventory source update handling

* Add group vars to inventory source update handling

* Add support for overwrite_vars to new inventory source handling

* Persist inventory var history in the database instead of a file.

* Remove logging which was needed during development.

* Remove further debugging code and improve comments

* Move special handling for user edits of variables into serializers

* Relate the inventory variable history model to its inventory

* Allow for inventory variables to have the value 'None'

* Fix KeyError in new inventory variable handling

* Add unique-together constraint for new model InventoryGroupVariablesWithHistory

* Use only one special invsrc_id for initial update and manual updates

* Fix internal server error when creating a new inventory

* Print the empty string for a variable with value 'None'

* Fix comment which incorrectly states old behaviour

* Fix inventory_group_variables_update tests which did not take the new handling of None into account

* Allow any type for Ansible-core variable values

* Refactor misleading method names

* Fix internal server error when savig vars from group form

* Remove superfluous json conversion in front of JSONField

* Call variable update from create/update instead from validate

* Use group_id instead of group_name in model InventoryGroupVariablesWithHistory

* Disable new variable update handling for all regular (non-'all') groups

* Add live test to verify AAP-17690 (inv var deleted from source)

* Add functional tests to verify inventory variables update logic

* Fix migration which was corrupted by a rebase

* Add a more complex live test and resolve linter complaints

* Force overwrite_vars=False for updates from source on all-group

* Change behavior with respect to overwrite_vars
2025-05-19 21:38:33 +02:00
Seth Foster
54db6c792b
Revert "unpin sqlparse dependency (#6911)" (#6950)
This reverts commit 3e122778e4b51416c4c3535fe130007928208317.
2025-05-16 22:53:54 +00:00
Peter Braun
3e122778e4
unpin sqlparse dependency (#6911)
* unpin sqlparse dependency

* remove sqlparse license
2025-05-15 15:51:34 -04:00
Elijah DeLee
f98b2e2455 introduce age for workers and mandatory retirement
Retire workers after a certain age, allowing them to finish their
current task if they are not idle.

This mitigates any issues like memory leaks in long running workers,
especially if systems stay busy for months at a time.

Introduce new optional setting WORKER_MAX_LIFETIME_SECONDS, defaulting to 4 hours
2025-05-15 14:15:50 -04:00
Seth Foster
12dcc10416
[4.6] Update subscription API to use service accounts (#6927)
* Update subscription API to use service accounts

Update code to pull subscriptions from
console.redhat.com instead of
subscription.rhsm.redhat.com

Uses service account client ID and client secret
instead of username/password, which is being
deprecated in July 2025.

Additional changes:

- In awx.awx.subscriptions module, use new service
account params rather than old basic auth params

- Update awx.awx.license module to use subscription_id
instead of pool_id. This is due to using a different API,
which identifies unique subscriptions by subscriptionID
instead of pool ID.

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
Co-authored-by: Chris Meyers <chris.meyers.fsu@gmail.com>
Co-authored-by: Peter Braun <pbraun@redhat.com>

* fix token name

Signed-off-by: Seth Foster <fosterbseth@gmail.com>

* Fix Subscriptions credentials fallback

Ensure service account authentication is being used
when falling back to using SUBSCRIPTIONS_CLIENT_ID.

Additional change:
Subscription data can return two types of capacities:
Sockets and Nodes

For determining overall capacity
if capacity name is Nodes:
  capacity quantity x subscription quantity
if capacity name is Sockets:
  capacity quantity / 2 (minimum of 1) x subscription quantity

Signed-off-by: Seth Foster <fosterbseth@gmail.com>

---------

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
Co-authored-by: Chris Meyers <chris.meyers.fsu@gmail.com>
Co-authored-by: Peter Braun <pbraun@redhat.com>
2025-05-13 15:41:35 -04:00
Mauricio Magnani Jr
6bd39aea4b
OPA server hostname with https or http results in connection errors (#6921)
Signed-off-by: Mauricio Magnani <magnani@redhat.com>
2025-05-13 14:41:29 -04:00
Hao Liu
b7a3c6b025
Delete UI test from CI (#6831)
In release_4.6 we no longer ship UI in AAP 2.5 so there's no reason to waste time on CI test for UIs
2025-05-13 14:40:07 -04:00
jessicamack
ba7ee23298
[backport][4.6] Update Azure Key Vault plugin to use Managed Identity (#6939)
* Bug on file name. Commiting to remove it.

* Update azure_kv plugin to use ManagedIdentity. Add testing.
2025-05-13 10:05:24 -04:00
Jake Jackson
825a48bb32
[4.6] Insights Credential Help Text Update (#6937)
* Update help text for insights cred

* update help text for the insights cred per new mock ups
2025-05-08 10:45:14 -04:00
thedoubl3j
eb6aebff00 Update logic to not over write ec2 replace
* fix replace logic so that we don't over write and stay only at vmware
  when ec2 is selected
* add an env.json for functional testing
2025-05-08 15:06:58 +02:00
thedoubl3j
60114ab929 add logic to replace cred name when using esxi
* similar to aws, allow the use of the standard vmware cred
2025-05-08 15:06:58 +02:00
Peter Braun
0e28d2590a
fix: keep processing events, even if previous event data cannot be pa… (#15965) (#6922)
* fix: keep processing events, even if previous event data cannot be parsed

* change log level to warning
2025-05-05 13:26:42 +02:00