Jeff Bradberry
584fda5178
Add some unit tests around the analytics interval calculations
2021-04-26 16:21:25 -04:00
Jeff Bradberry
4857c5edcb
Break out the main interval trimming calculation into a new function
2021-04-26 13:31:05 -04:00
Jeff Bradberry
f4d848e596
Log adjustments made to the analytics interval due to the 4-week limit
2021-04-26 13:31:05 -04:00
Jeff Bradberry
b9389208dd
Add in the missing dry-run check for csv analytics collectors
2021-04-20 09:36:29 -04:00
Jeff Bradberry
2793b5b01e
Always overwrite the contents of .git/hooks/pre-commit
2021-04-15 14:21:53 -04:00
Jeff Bradberry
62c7554ec4
Adjust datetimes to be aware when using awx-manage gather_analytics
...
Also, make sure that an explicit `since` parameter will win over
default `until=now()` when calculating the 4-week data limit.
2021-04-06 15:59:54 -04:00
Jeff Bradberry
f8b91f9b0e
Fixes
...
- use parse_datetime from Django for the datetime_hook
- deal with a fencepost error in the events slicer
2021-04-05 13:58:32 -04:00
Jeff Bradberry
f85e8a44de
Properly parse datetimes from AUTOMATION_ANALYTICS_LAST_ENTRIES
2021-04-05 13:58:32 -04:00
Jeff Bradberry
6030c5cf4c
Rationalize the interval calculations for analytics gathering
...
- `since` should not be after `until`
- neither `since` nor `until` should be in the future
- `since`, `AUTOMATION_ANALYTICS_LAST_GATHER`, and `AUTOMATION_ANALYTICS_LAST_ENTRIES[key]` should be truncated to 4 weeks prior to `until`
- an explicit `since` parameter should always take precedence over the settings values
2021-04-05 13:58:32 -04:00
Jeff Bradberry
8ce3a14da5
A couple more fixes:
...
- stop trying to ship csv slices when one breaks
- only update LAST_ENTRIES if all of the files in a time/pk slice succeed
- don't allow an explicit --until parameter to set the GATHER/ENTRIES values backwards
2021-04-05 13:58:32 -04:00
Jeff Bradberry
1dacd7e8cf
Only clean up tarballs if we had all successfully ship
2021-04-05 13:58:32 -04:00
Jeff Bradberry
39886da4b6
Deal with datetimes in AUTOMATION_ANALYTICS_LAST_ENTRIES
2021-04-05 13:58:32 -04:00
Jeff Bradberry
99daa4319e
Require the config.json file to be in dry-run tarballs
2021-04-05 13:58:32 -04:00
Jeff Bradberry
3568558571
A couple of bug fixes
2021-04-05 13:58:32 -04:00
Jeff Bradberry
0b31e771b1
Fix the gather_analytics management command
...
Previously, invoking the command with neither of the --ship or
--dry-run flags would result in effectively doing a dry run. With the
stricter checks now in place in analytics.core.gather, let's make sure
that we pass the 'dry-run' parameter in to gather() in the no-flags
case.
2021-04-05 13:58:32 -04:00
Jeff Bradberry
772da61980
If a csv collector is successful but results in no files, increment anyway
2021-04-05 13:58:32 -04:00
Jeff Bradberry
9cde10c93a
Fix problems with the package() function
2021-04-05 13:58:32 -04:00
Jeff Bradberry
1bf37266b4
Differentiate the log level depending on whether we are run from the task
2021-04-05 13:58:32 -04:00
Jeff Bradberry
77f7e88e68
Address the problems with trying to use a JSONField
2021-04-05 13:58:32 -04:00
Jeff Bradberry
3e4e255d3f
Require config collector data for all posts to analytics
...
We need the cluster ID when consuming all incoming data.
2021-04-05 13:58:32 -04:00
Jeff Bradberry
a448cb17d9
Refactor analytics.gather
...
With the change to use pk-based interval slicing for the job events
table, we need analytics.gather to be the code that manages all of the
"expensive" collector slicing. While we are at it, let's ship each
chunked tarball file as we produce it.
2021-04-05 13:58:32 -04:00
Jeff Bradberry
b6ccd02f3d
Update the versioning on the docker-compose template
...
Some versions of docker-compose will break with the new addition of
name parameters without this.
2021-03-29 10:39:22 -04:00
Jeff Bradberry
c508695ed0
Instruct git to ignore the .vscode/ directory
2021-03-22 10:24:11 -04:00
Jeff Bradberry
5bec4a51c6
Undo the polymorphic.SET_NULL for Organization
...
It isn't polymorphic.
2021-03-11 15:50:57 -05:00
Jeff Bradberry
e31fc37215
Make sure that EE foreign keys are polymorphic.SET_NULL
...
Deleting EEs that had been attached to something was failing.
2021-03-11 11:25:59 -05:00
Jeff Bradberry
0ca8fd7752
Update the debugging docs
2021-03-09 14:42:10 -05:00
Jeff Bradberry
0a6d13c1b9
Reduce the log level for some of the more spammy sources
2021-03-09 14:16:37 -05:00
Jeff Bradberry
097f465f39
Fix the RBAC for attaching an EE to various objects
...
- Organization.default_environment
- Project.default_environment
- JobTemplate.execution_environment
- WorkflowJobTemplate.execution_environment
System jobs are not editable by anyone other than a system admin, so
we don't need to check. It appears that unified job templates can't
be created or edited outside of the endpoints for the specific types.
2021-03-09 11:00:03 -05:00
Jeff Bradberry
b417fc3803
Turn off permissions check bypassing for admins when hitting the execution environment list and detail views.
2021-03-03 18:52:55 -05:00
Jeff Bradberry
5b2adc89cf
Make the managed_by_tower field read-only for EEs (similar to how we deal with it not being settable for Credentials) and add permissions checking for Org EE Admins.
...
can_add: gets an explicit role to check against, `'execution_environment_admin_role'`
can_change: leverages `self.check_related()` for the case where the Org is not changing, but also adds an explicit check for the EE Admin Role when the Org is changing to an explicit different Org.
2021-03-03 18:52:55 -05:00
Jeff Bradberry
9964ba7c9a
Improve the behavior of EE resolution for ad hoc commands
...
- call resolve_execution_environment during AdHocCommand.save()
- wrap the fallback call of the resolver in tasks.py in disable_activity_stream()
2021-03-03 18:52:54 -05:00
Jeff Bradberry
c74d60f3f3
Make sure that the new credential type is in the choices list
2021-03-03 18:52:54 -05:00
Jeff Bradberry
44ad6bfdce
Insert a default EE into the development environment
2021-03-03 18:52:54 -05:00
Jeff Bradberry
fde7a1e3e5
Ensure that the updated job instance is used
...
when attaching an EE.
2021-03-03 18:52:54 -05:00
Jeff Bradberry
4a0fc3e1af
Ensure that a fallback EE is available to be found
...
for the failing tests.
2021-03-03 18:52:54 -05:00
Jeff Bradberry
5f1da2b923
Adjust ExecutionEnvironmentAccess to account for the new EE admin role
2021-03-03 18:52:54 -05:00
Jeff Bradberry
e7bf81883b
Populate the EE name field in awxkit
2021-03-03 18:52:54 -05:00
Jeff Bradberry
4993a9e6ec
Move the resolve_execution_environment method to the mixin class
...
so that it can be used with AdHocCommands as well.
2021-03-03 18:52:54 -05:00
Jeff Bradberry
8562c378c0
Make use of the EE resolver code when launching jobs
2021-03-03 18:52:54 -05:00
Jeff Bradberry
6d935f740c
Fill in the new execution environment collection module
...
as well as changes to other ones that need to be able to attach EEs.
2021-03-03 18:52:54 -05:00
Jeff Bradberry
c1133b3f6d
Add in more model changes around execution environments
...
- a new unique name field to EE
- a new configure-Tower-in-Tower setting DEFAULT_EXECUTION_ENVIRONMENT
- an Org-level execution_environment_admin_role
- a default_environment field on Project
- a new Container Registry credential type
- order EEs by reverse of the created timestamp
- a method to resolve which EE to use on jobs
2021-03-03 18:52:54 -05:00
Jeff Bradberry
3d233faed8
Expose the user capabilities dict for EEs ( #8208 )
2021-03-03 18:52:54 -05:00
Jeff Bradberry
3cbf384ad1
Run a receptor node in the dev environment
2021-03-03 18:52:54 -05:00
Jeff Bradberry
45a0084f78
Add a sublist api view for the UJTs that use a given execution environment
2021-03-03 18:52:54 -05:00
Jeff Bradberry
f9741b619c
Make changes to support capture by the activity stream
...
Including exposing a new API view for a particular EE's activity
stream objects.
2021-03-03 18:52:54 -05:00
Jeff Bradberry
5ec7378135
Add a new Swagger topic
2021-03-03 18:52:54 -05:00
Jeff Bradberry
c05e4e07ee
Expose execution environments in awxkit and awx-cli
2021-03-03 18:52:54 -05:00
Jeff Bradberry
cc429f9741
Expose an API view for all of the execution environments under an org
2021-03-03 18:52:54 -05:00
Jeff Bradberry
cb766c6a95
Add execution_environment and pull to the fields for UJs and UJTs
2021-03-03 18:52:54 -05:00
Jeff Bradberry
3c637cd54c
Change OrganizationSerializer to show and set default_environment
2021-03-03 18:52:53 -05:00
Jeff Bradberry
61cbd34586
Add in the basic list and detail api views
2021-03-03 18:52:53 -05:00
Jeff Bradberry
9697999ddd
Create the RBAC access class for execution environments
2021-03-03 18:52:53 -05:00
Jeff Bradberry
41613ff544
Add a new ExecutionEnvironment model
2021-03-03 18:52:53 -05:00
Jeff Bradberry
78ccf3c674
Fix the broken paths to the favicon and logo in the API browser
2021-02-19 14:56:26 -05:00
Jeff Bradberry
8fb0b401ce
Bump ansible-runner to get the pexpect fix
2021-02-12 12:08:21 -05:00
Jeff Bradberry
a3723db357
Do not drop inventories marked as has_inventory_sources
2021-01-08 14:32:33 -05:00
Jeff Bradberry
0eff06318f
Update autobahn to address CVE-2020-35678
2021-01-05 13:44:05 -05:00
Jeff Bradberry
cb570a2ba1
Fix the 'absent' state in tower_instance_group
2020-10-30 16:39:56 -04:00
Jeff Bradberry
607bc07887
Rework the export of full dependent objects
...
and include hosts and groups in the export.
2020-10-30 16:39:56 -04:00
Jeff Bradberry
ff7fe2acdf
Fix the 'absent' state in tower_instance_group
2020-10-28 14:27:03 -04:00
Jeff Bradberry
b8b1e3d760
Rework the export of full dependent objects
...
and include hosts and groups in the export.
2020-10-28 13:43:14 -04:00
Jeff Bradberry
d6e39376c8
Improve handling of 0 and negative thresholds in the profile_sql command
...
- output a profiling disabled message when appropriate
- specify that we are doing SQL profiling in the enabled case
- treat negative thresholds the same as zero, disabling profiling
2020-10-22 11:27:21 -04:00
Jeff Bradberry
a07dabae9e
Attempt to infer related pages on export when the link is missing
2020-10-09 14:06:28 -04:00
Jeff Bradberry
6b82ae46bc
Force worker processes to have a different signal handler from the parent
...
Situations have come up where the 5+ minute kill signal for
run_task_manager is emitted to the worker process running it, but
since the worker improperly inherited the AWXConsumerBase().stop()
handler a deadlock ultimately was triggered on the database
connection.
2020-07-23 12:09:59 -04:00
Jeff Bradberry
d8b9d48313
Add a note about import/export
2020-06-23 10:09:32 -04:00
Jeff Bradberry
393369adec
First cut at examples of the import and export commands
2020-06-18 15:32:49 -04:00
Jeff Bradberry
0fda9d2c56
Continue after failures to grant roles
2020-06-11 13:19:24 -04:00
Jeff Bradberry
bf6e8f8e83
Prioritize membership roles
...
since certain role grants will not be accepted by the api unless the user or team is part of the correct organization.
2020-06-10 15:27:15 -04:00
Jeff Bradberry
19b7c91486
Return the changed status of imports
2020-06-09 15:00:06 -04:00
Jeff Bradberry
aeeed4d371
Add more logging
2020-06-09 15:00:06 -04:00
Jeff Bradberry
1f7c1af64e
Fix WFJT nodes endpoint to return node pages when posting
...
not the node list page.
2020-06-09 15:00:06 -04:00
Jeff Bradberry
65fc2db42f
Recursively queue up related assets to be created and/or assigned
2020-06-09 14:59:49 -04:00
Jeff Bradberry
c8288af87f
Make sure we have a cached version of existing objects
...
even if it isn't an object being directly imported. We might need it
for relations of things that are being imported.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
76fb605dcd
Deal with exports involving foreign keys where you don't have permission
2020-06-09 13:54:05 -04:00
Jeff Bradberry
a531b85b31
Redo waiting until Project updates are complete
2020-06-09 13:54:05 -04:00
Jeff Bradberry
86afa5cf42
Make more use of the PageCache for imports
2020-06-09 13:54:05 -04:00
Jeff Bradberry
57aff6394c
Log an error and continue when a related object is not found
2020-06-09 13:54:05 -04:00
Jeff Bradberry
66bc947adb
Reuse _import_list for import of related full objects
...
e.g. WFJT Nodes. Also rename _import_list from _create_assets.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
301f15bfdd
Rename some things for consistency
2020-06-09 13:54:05 -04:00
Jeff Bradberry
9fc1a4bb44
Change the method that exports list views to take a PageList or TentativePage
...
This will allow the related m2m views to also use this method, with a
bit of effort. Also, remove the use of pk_or_name in favor of a new
method that reduces the number of api calls.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
f7825aefeb
Avoid doing an OPTIONS call unless we know it is a related type we export
2020-06-09 13:54:05 -04:00
Jeff Bradberry
14b5f63bd8
Use the new PageCache to store and reuse Page.get results
2020-06-09 13:54:05 -04:00
Jeff Bradberry
1300d38e47
Introduce a new PageCache object
...
and split out get_post_fields into its own utility function.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
bb66e4633d
Split _get_options into two pieces
2020-06-09 13:54:05 -04:00
Jeff Bradberry
201de4e18a
Attempt to deal with foreign keys that get mislabeled as type integer
...
such as through the use of DeprecatedCredentialField.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
471dc2babf
Deal with relations that we cannot resolve
...
such as due to a lack of permissions. If there is a foreign key to
something where we don't have sufficient read permissions, we now drop
the parent object from the export.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
6387258da1
Only wait for Project updates
...
not other kinds of objects that have a status.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
6958815f6e
Remove the $encrypted$ placeholders from export values
2020-06-09 13:54:05 -04:00
Jeff Bradberry
43b76f4575
Deal with unreadable mandatory foreign keys
...
by dropping the parent object. Also, clarify some of the warning log
messages.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
53d81d42cc
Hook up creation and attachment of related objects
2020-06-09 13:54:05 -04:00
Jeff Bradberry
385725e52a
Fix the _create_assets method to use _get_options
2020-06-09 13:54:05 -04:00
Jeff Bradberry
1b264011a2
Enable interconnections between WFJT Nodes
2020-06-09 13:54:05 -04:00
Jeff Bradberry
719f0b407c
Enable credential relations
...
but only when it is in an attach/detach list view.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
a5fa34bd3b
Fall back to parsing the OPTIONS description
...
to determine the needed fields for constructing an object.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
eb10a1873d
Drop objects that cannot be read or do not have a natural key
...
don't fail hard.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
ab15349c8c
Remove the NoNaturalKey error
...
It's too awkward, and it makes more sense to return None instead.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
e053a58223
Handle some more bad cases when doing OPTIONS calls
...
- deprecated endpoints
- read-only endpoints
- insufficient privileges
The latter case currently just drops it on the floor, but ought to do
something better.
2020-06-09 13:54:05 -04:00
Jeff Bradberry
4262dd38ba
Change the NoNaturalKey exception to no longer derive from Common
...
which seems to be entirely use for response exceptions. Maybe rename
Common?
2020-06-09 13:54:05 -04:00
Jeff Bradberry
0deacc4391
If attempting to link to a resource that is not yet complete, wait
2020-06-09 13:54:05 -04:00
Jeff Bradberry
329293dbf0
Tentatively enable inventory sources
2020-06-09 13:54:05 -04:00