Jeff Bradberry
030704a9e1
Change all uses of ImplicitRoleField to do on_delete=SET_NULL
...
This will mitigate the problem where if any Role gets deleted for some
weird reason it could previously cascade delete important objects.
2024-06-12 13:08:03 -04:00
Jeff Bradberry
aadcc217eb
This should deal correctly with the ancestor list mismatches
2024-06-10 16:36:22 -04:00
Jeff Bradberry
345c1c11e9
Guard against the role field not being populated
...
when doing the final reset of Role.implicit_parents.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
2c3a7fafc5
Add a new test scenario
...
to trigger the implicit parent not being in the parents and ancestors lists.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
dbcd32a1d9
Mark and rebuild the implicit_parents field for all affected roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d45e258a78
Wait until the end of the fix script to clean up orphaned roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d16b69a102
Add output of the update and deletion counts to fix.py
2024-06-10 16:36:22 -04:00
Jeff Bradberry
8b4efbc973
Do not throw away the container of cross-linked parents
...
Since we use it twice, the second time to get the id field of each.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
4cb061e7db
Add a readme file with instructions
2024-06-10 16:36:22 -04:00
Jeff Bradberry
31db6a1447
Fix another instance where a bad resource->Role fk could throw a traceback
2024-06-10 16:36:22 -04:00
Jeff Bradberry
ad9d5904d8
Adjusted foreignkeys.sql for correctness
...
Some relationships known to be handled by the special mapping sql file
were being caught as false positives.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
b837d549ff
Split the foreign key sql script into an 'into' and 'from' portion
...
Also, make use of up-front defined arrays of the tables involved, for
ease of editing in the future.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
9e22865d2e
Filter out the relations within the known topology tables
2024-06-10 16:36:22 -04:00
Jeff Bradberry
ee3e3e1516
First cut at detecting which foreign keys enter and exit the topology tables
2024-06-10 16:36:22 -04:00
Jeff Bradberry
4a8f6e45f8
Move the "test" files into their own directory
2024-06-10 16:36:22 -04:00
Jeff Bradberry
6a317cca1b
Remove the role_chain.py module
...
it wound up being unworkable, and I think ultimately we only need to
check the immediate parentage of each role.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d67af79451
Attempt to correct any crosslinked parents
...
I think that rebuild_role_ancestor_list() will then correctly update
all of the affected Role.ancestors.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
fe77fda7b2
Exclude more files in the .gitignore
2024-06-10 16:36:22 -04:00
Jeff Bradberry
f613b76baa
Modify the role parent check logic to stay in the roles as much as possible
...
since the foreign keys to the roles from the resources can make us go
wrong almost immediately.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
054cbe69d7
Exclude the team grant false positives
...
The results in my test now look correct.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
87e9dcb6d7
Attempt to more thoroughly check the parents of each Role
...
This version, however, has false positives because Roles become
children of Team.member_role when a Role is granted to a Team.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
c8829b057e
First cut at checking the role hierarchy
...
Checking if parents and implicit_parents are consistent with ancestors.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
a0b376a6ca
Set up a scenario where IG.use_role_id points to something no longer there
...
This is actually happening for one customer, though it seems like it
shouldn't be if the foreign key constraint is set back up properly.
In order to recreate it, I had to add the constraint back with 'NOT
VALID' added on to prevent the check.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
d675207f99
Handle the case where a resource points to a Role which isn't in the db
2024-06-10 16:36:22 -04:00
Jeff Bradberry
20504042c9
Graph out only the parent/child chains from a given Role
...
Doing the entire graph is too much on any system with real amounts of Roles.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
0e87e97820
Check for a broken ContentType -> model and log and skip
...
Apparently this has happened to a customer, per Nate Becker.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
1f154742df
Make the role_chain.py script emit a Graphviz file
...
of the Role relationships.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
85fc81aab1
Start a new script that can be used to examine a Role's ancestry
2024-06-10 16:36:22 -04:00
Jeff Bradberry
5cfeeb3e87
Treat resources with null role fks differently
...
The underlying role should be re-linked, instead of treated as orphaned.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
a8c07b06d8
Set up an enhanced version of Seth's bad role scenario
2024-06-10 16:36:22 -04:00
Jeff Bradberry
53c5feaf6b
Set up Seth's bad role scenario
2024-06-10 16:36:22 -04:00
Jeff Bradberry
6f57aaa8f5
When checking reverse links, treat duplicate Roles different from bad ones
...
Also, null out the generic foreign key on orphaned roles before deleting.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
bea74a401d
Attempt to be more efficient about grouping the content types
...
Also, attempt to rebuild the role ancestors in the fixup script.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
54e85813c8
First full check script
...
This version emits the first fix-up script as its output.
2024-06-10 16:36:22 -04:00
Jeff Bradberry
b69ed08fe5
Specifically examine the InstanceGroup roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
de25408a23
Print out details of all of the crosslinked roles
2024-06-10 16:36:22 -04:00
Jeff Bradberry
b17f0a188b
Initial check
2024-06-10 16:36:22 -04:00
Jeff Bradberry
4915262af1
Do each batch of the HostMetric updates in a transaction
...
It looks like we can't do upserts currently without dropping to raw
SQL, but if we wrap each batch in a transaction, that should insure
that each is updated with the correct count.
2024-06-05 14:15:21 -04:00
Jeff Bradberry
fb237e3834
Stop pre-caching every resource in the system upon import
...
If we don't have something in the cache when we call
get_by_natural_key, do an actual filtered query for it and cache the
results. We'll get more overall API calls this way, but they'll be
smaller and will happen while we are importing, not upfront.
2024-04-24 17:04:40 -04:00
Jeff Bradberry
c0f71801f6
Use $(shell ...) to filter the redis docker volumes
...
Makefiles use $() for variable templating, so trying to use it
directly as a shell subcommand doesn't work.
2024-04-17 16:45:23 -04:00
Jeff Bradberry and Hao Liu
3edaaebba2
Adjust the awx-manage script to make use of importlib ( #15015 )
...
* Adjust the awx-manage script to make use of importlib
removing the deprecation warning.
* Synlink awx-manage in docker-compose
No longer need to rebuild docker-compose devel image to load change for `tools/docker-compose/awx-manage` in development environment
---------
Co-authored-by: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com >
2024-04-02 17:20:05 -04:00
Jeff Bradberry
1559c21033
Change awx.awx.application to output the OAuth2 client secret
...
if one was generated.
2024-03-28 10:17:46 -04:00
Jeff Bradberry
79d7179c72
Fix the persistent breakage when cleaning up branches
...
The github workflow that we have set up for branch deletion doesn't work:
- the `on: delete` event does not support the `branches:` filter
- the `mode` flag for the aws_s3 module does not have `delete` as one
of the options. The proper option appears to be `delobj`.
2024-02-15 15:16:18 -05:00
Jeff Bradberry
38424487f1
Unbreak the pip-compile command when multiple files are passed in ( #14875 )
2024-02-13 15:59:04 -05:00
Jeff Bradberry
36f3b46726
Avoid using SmartFilter during migrations ( #14786 )
...
Our migrations that touch roles tend to bring in our real models via
migration_utils.set_current_apps_for_migrations, and that can have
some undesirable side-effects.
2024-02-12 15:48:58 +00:00
Jeff Bradberry
b3aeb962ce
Fix the test_export_system_auditor collection test
2024-02-07 15:55:19 -05:00
Jeff Bradberry
2300b8fddf
Fix linting problem
2024-02-07 15:55:19 -05:00
Jeff Bradberry
7fc13a0569
Write tests around the two special instance serializer fields
...
and all of the cases that they might be in.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
92c693f14e
Break out peer validation into its own method
2024-02-02 10:37:41 -05:00
Jeff Bradberry
f2417f0ed2
Make the peer validation more compact
...
and reuse information.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
8f22188116
Use a select_related to build the peers queryset in the install bundle
...
Since the relationship is ReceptorAddress -> Instance,
prefetch_related isn't necessary.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
05502c0af8
Placeholder FIXMEs for things of concern
2024-02-02 10:37:41 -05:00
Jeff Bradberry
957ce59bf7
Use Counter to find duplicate peer relationships
...
Gives a bit more readability.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
cc4cc37d46
'managed' is a read-only field on InstanceSerializer
...
so we don't need complex logic to compare an incoming to existing value.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
1e254c804c
The listener port cannot be disabled when setting peers_from_control_nodes
...
If the port is explicitly set to null (causing any ReceptorAddress to
be deleted), then that's a validation error.
If the port is left off but a ReceptorAddress doesn't already exist,
we should not infer a port number and that is also a validation error.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
f98493aa61
Support wss as ws-listener in the Receptor config
2024-02-02 10:37:41 -05:00
Jeff Bradberry
8ddb604bf1
Template the listener protocol into the receptor install bundle ( #14792 )
...
Previously we were hard-coding tcp, now we need to also support ws/wss.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
82323390a7
Reconstitute migration file
...
Do the things as a proper 3-step process -- add new stuff, copy the data, drop the old.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
8c7c00451a
Join across the InstanceLink.target to the underlying Instance
...
to avoid having to do a lookup for every instance in the list for the
mesh visualizer endpoint.
2024-02-02 10:37:41 -05:00
Jeff Bradberry
42701f32fe
Build the source distribution bundle to also upload to PyPI
...
This has been broken since 20.0.1.
2024-01-11 15:49:07 -05:00
Jeff Bradberry
4822dd79fc
Revert "Improve performance for awx cli export ( #13182 )"
2023-08-15 15:55:10 -04:00
Jeff Bradberry
14992cee17
Add in an async task to migrate the data over
2023-08-10 13:48:58 -04:00
Jeff Bradberry
6db663eacb
Modify main/0185 to set aside the json fields that might be a problem
...
Rename them, then create a new clean field of the new jsonb type.
We'll use a task to do the data conversion.
2023-08-10 13:48:58 -04:00
Jeff Bradberry
8f6849fc22
Include listener_port in the defaults for Instance.objects.register ( #13328 )
2022-12-19 14:16:05 -03:00
Jeff Bradberry
e87e041a2a
Break up and conditionally add the RBAC checks for ActivityStream ( #13279 )
...
This should vastly improve the queries executed when accessing any of
the activity stream endpoints as a normal user, in many cases.
2022-12-16 15:11:14 -03:00
Jeff Bradberry
7b8dcc98e7
Merge pull request #13308 from jbradberry/rebuild-org-ee-admin-roles
...
Ensure that the Organization.execution_environment_admin_role always gets built
2022-12-16 11:29:20 -05:00
Jeff Bradberry
e524d3df3e
Replace the role fixup post_migrate handler with a data migration
2022-12-12 10:20:56 -05:00
Jeff Bradberry
15b7ad3570
Add a post_migrate signal handler to rebuild the Org roles
...
particularly, the execution_environment_admin_role.
2022-12-07 15:57:20 -05:00
Jeff Bradberry
adbcb5c5e4
Merge pull request #13289 from jbradberry/improve-psql-paging
...
Make sure that the psql pager does not clear the screen afterwards
2022-12-06 13:17:24 -05:00
Jeff Bradberry
8054c6aedc
Make sure that the psql pager does not clear the screen afterwards
...
Also, avoid paging if there is a single page.
2022-12-06 10:46:47 -05:00
Jeff Bradberry
bb047baeba
Merge pull request #13277 from jbradberry/psql-pager
...
Configure dbshell to use the 'less' pager
2022-12-02 13:27:46 -05:00
Jeff Bradberry
57430afc55
Configure dbshell to use the 'less' pager
2022-12-02 12:31:49 -05:00
Jeff Bradberry
95e4b2064f
Merge pull request #13264 from jbradberry/fix-awxkit-field-removals
...
Remove update_on_project_update from awxkit
2022-12-01 14:11:03 -05:00
Jeff Bradberry
48eba60be4
Remove update_on_project_update from awxkit
...
This was removed from the InventorySource model a bit ago.
2022-12-01 13:44:10 -05:00
Jeff Bradberry
65c3db8cb8
Merge pull request #13250 from jbradberry/fix-inventorysource-migration
...
Fix a problem with migration main/0164
2022-11-30 15:07:54 -05:00
Jeff Bradberry
7fa9dcbc2a
Merge pull request #13168 from ArtsiomMusin/feature_13055_add_multiple_assert_export
...
Add multiple asset export for awx cli
2022-11-30 15:01:42 -05:00
Jeff Bradberry
7cfb957de3
Add the elements: str type to the lists
2022-11-30 14:15:57 -05:00
Jeff Bradberry
d0d467e863
Fix a problem with migration main/0164
...
Since the original version of the migration a) invoked the .save()
method, and b) involved a model with a custom field that had a
post_save handler attached, this migration had a side-effect that
caused the codebase's version of the model to be used when the table
involved wasn't yet up to date. This triggers an UndefinedColumn error.
This change works around the problem by making use of queryset
.update() methods instead, which should avoid the post_save signal
trigger.
2022-11-30 11:06:08 -05:00
Jeff Bradberry
721e19e1c8
Merge pull request #13181 from jbradberry/remove-qsstats
...
Replace the querysets provided by django-qsstats-magic
2022-11-11 10:58:51 -05:00
Jeff Bradberry
e029cf7196
Remove the django-qsstats-magic dependency
2022-11-10 15:37:44 -05:00
Jeff Bradberry
477a63d1b4
Replace the querysets provided by django-qsstats-magic
...
with ones that are constructed to do the same thing, without any
extraneous functionality.
2022-11-10 11:00:39 -05:00
Jeff Bradberry
86b0a3d4f1
Merge pull request #13174 from jbradberry/fix-3.11-awxkit
...
Avoid adding the 'config' subparser twice
2022-11-09 13:37:03 -05:00
Jeff Bradberry
3d3e4ad150
Avoid adding the 'config' subparser twice
...
Once since it is defined as a CustomCommand subclass, and once because
it is an endpoint at the /api/v2/ level. With Python 3.11 argparse
has become more strict and will raise an exception when you try to
inject duplicate subparsers.
2022-11-08 15:13:35 -05:00
Jeff Bradberry
c5cf39abb7
Merge pull request #13132 from jbradberry/import-project-schedules
...
Expand the dependencies of the Schedule page type
2022-10-31 16:29:04 -04:00
Jeff Bradberry
b57ae592ed
Expand the dependencies of the Schedule page type
...
Really these could get any of the unified job template types, not just
system job templates, so importing e.g. a project with a schedule was
doing them in the wrong order.
Also, bump the timeout of the project update and make sure that we
stash it in the page cache even if it doesn't finish in 5 minutes.
2022-10-28 12:56:35 -04:00
Jeff Bradberry
153a197fad
Merge pull request #13125 from jbradberry/improve-staticfile-management
...
UI static files are now directly copied to the proper static dir
2022-10-27 09:25:09 -04:00
Jeff Bradberry
8f4c329c2a
UI static files are now directly copied to the proper static dir
...
when running `make ui-devel`. Previously they were going to
/awx_devel/awx/public/static, but that directory is no longer being
served up by nginx, which forced us to have to run `make
collectstatic` (or equivalent) to get the files to the right place.
2022-10-26 17:51:29 -04:00
Jeff Bradberry
eeb9d61488
Merge pull request #13069 from jbradberry/hostname-validation-regression
...
Add back in the uniqueness validation on Instance.hostname
2022-10-17 11:40:54 -04:00
Jeff Bradberry
234ce529fc
Add back in the uniqueness validation on Instance.hostname
2022-10-17 10:55:38 -04:00
Jeff Bradberry
5b5aac675b
Merge pull request #12959 from ansible/new-health-check-started
...
Add a new Instance.health_check_started field
2022-09-28 10:58:43 -04:00
Jeff Bradberry
6b0618b244
Merge pull request #12968 from ansible/instance-serializer-defaults
...
Make sure to include field defaults for Instance node_type and node_state
2022-09-28 10:53:31 -04:00
Jeff Bradberry
5aa55d7347
Make sure to include field defaults for Instance node_type and node_state
2022-09-27 17:15:45 -04:00
Jeff Bradberry
65179d9cd0
Add a new Instance.health_check_started field
...
This will enable us to provide more useful information for the user,
now that all user-triggered health checks are async.
Also, de-bounce the health check endpoint to not allow additional
health check tasks to be triggered when one is already in progress.
2022-09-27 17:09:41 -04:00
Jeff Bradberry
b879cbc2ec
Prevent any edits to hop nodes
...
to retain the behavior that they had pre-mesh-scaling.
2022-09-23 09:46:15 -04:00
Jeff Bradberry
0e578534fa
Update the instance install bundle requirements.yml
...
to point to the 0.1.0 release of ansible.receptor.
2022-09-23 09:46:14 -04:00
Jeff Bradberry
08c18d71bf
Move InstanceLink creation and updating to the async tasks
...
So that they get applied in situations that do not go through the API.
2022-09-23 09:46:14 -04:00
Jeff Bradberry
68a44529b6
Register pages for the Instance peers and install bundle endpoints
...
This includes exposing a new interface for Page objects, Page.bytes,
to return the full bytestring contents of the response.
2022-09-23 09:46:14 -04:00
Jeff Bradberry
f3a9d4db07
Assign a default queue to wait_for_jobs()
2022-09-23 09:46:14 -04:00
Jeff Bradberry
ebd200380a
Resolve a deadlock in write_receptor_config()
2022-09-23 09:46:13 -04:00
Jeff Bradberry
1b650d6927
When deprovisioning a node, kick off a task that waits on running jobs
...
After all jobs on the node are complete, delete the node then
broadcast the write_receptor_config task.
Also, make sure that write_receptor_config updates the state of links
that are in 'adding' state.
2022-09-23 09:46:13 -04:00