Commit Graph
100 Commits
Author SHA1 Message Date
Jeff Bradberry b0c511a7a2 Make non-polymorphic refs that slip through still work with our SET_NULL 2021-07-13 13:41:44 -04:00
Jeff Bradberry d0d9266dd1 Revert "Null iso IG jobs before deleting (#5122)"
This reverts commit 1831b2591a.
2021-07-13 13:41:36 -04:00
Jeff Bradberry 7d97ad021f Revert "Development of patch for inventory source migration error"
This reverts commit 8772ca2e3a.
2021-07-13 13:40:44 -04:00
Jeff Bradberry 40f5ff362c Bump ansible-runner to 2.0.0.0rc3 2021-06-28 10:51:06 -04:00
Jeff Bradberry d5deedc822 Make sure that validation of managed EEs makes sense
- missing fields in a patch request should be ignored
- compare the organization pks, if present
2021-06-28 10:51:05 -04:00
Jeff Bradberry 3be29d54ad Bump ansible-runner to 2.0.0.0rc2 and receptorctl to 1.0.0.0rc1 2021-06-28 10:51:04 -04:00
Jeff Bradberry 493e6cc527 Make the isolated removal migration non-atomic
We are apparently running into problems with pending triggers under
some circumstances.
2021-06-22 10:49:37 -04:00
Jeff Bradberry 6c1ba03235 Remove EE from the workflow job template collection module 2021-06-16 15:41:09 -04:00
Jeff Bradberry 85bb4e976f Execution environments are meaningless for workflows
so, remove them from the API endpoints for workflows.  Also, tear out
the WFJT.execution_environment step in the resolver.  If we want that
to be a thing, it ought to be a .default_environment instead.
2021-06-16 15:41:09 -04:00
Jeff Bradberry 93e90228a2 Remove isolated instances and groups
before we remove the fields that allow us to correctly identify them.
2021-06-15 17:36:26 -04:00
Jeff Bradberry 486bcd80f8 Make sure that the delete capability isn't hardcoded to be the same as edit 2021-06-09 15:45:02 -04:00
Jeff Bradberry 2d1a859719 Remove unused import 2021-06-09 13:48:23 -04:00
Jeff Bradberry 7a16782ebf Fix a problem with using PrimaryKeyRelatedField in our settings registry
DRF, when using this field, short-circuits the call to
.to_representation() when the value is None, since clearly you aren't
going to be able to get the .pk attribute off of it in that case.  We
were previously unconditionally calling .to_representation() which
throws an error when we try to clear the value of
DEFAULT_EXECUTION_ENVIRONMENT.
2021-06-09 13:48:23 -04:00
Jeff Bradberry 8ede74a7f6 Deal with the possibility of get_default_pod_spec not finding an EE 2021-06-09 13:48:23 -04:00
Jeff Bradberry 19da9955ce Make sure that managed EEs can't be deleted 2021-06-09 13:48:23 -04:00
Jeff Bradberry e6e1f97048 Add a signal handler to remove the default EE if it gets deleted 2021-06-09 13:48:16 -04:00
Jeff Bradberry 9f1e8a1ae2 Allow sysadmins to be able to change the pull field for managed EEs 2021-06-09 11:11:56 -04:00
Jeff Bradberry 9aa56b1247 Update the EE resolver logic
so that the control plane managed EE is kept separate.
2021-06-09 10:03:35 -04:00
Jeff Bradberry d4d21a1511 Remove the managed flag from all existing EEs
This flag henceforth is going to be used only for the "control plane"
execution environments, which sysadmins will not be allowed to alter.
2021-06-09 10:03:35 -04:00
Jeff Bradberry d0991bab9e Expose the EE resolver to the job template detail API endpoints 2021-06-03 16:35:50 -04:00
Jeff Bradberry d3cc439fa8 Include the EE set on a workflow template in the resolver hierarchy
This step comes immediately after checking the actual job/template for
an explicitly set EE.

Note that now, because of how jobs are spawned off of workflow nodes,
the call to .resolve_execution_environment() no longer happens in
.create_unified_job().  The job instance within .create_unified_job()
doesn't yet have access to the node that it will be attached to,
making it impossible to use this information in the resolver if called
there.
2021-05-27 15:22:44 -04:00
Jeff Bradberry 2aa3fe756e Remove the remote user existence validation
since we are going to do a confirmation modal dialog instead.
2021-05-19 10:27:51 -04:00
Jeff Bradberry c887f84a05 Add a check for the existence of pre-commit.sh
so that you don't get stuck when working on branches that don't have this yet.
2021-05-18 13:20:55 -04:00
Jeff Bradberry bcf93810ad Add an nginx location directive for the favicon
so that the rewrite rule that adds slashes to the ends of requested
urls doesn't get to it.
2021-05-14 14:00:57 -04:00
Jeff Bradberry 6f4c41a8d3 Add validation checks
that prevent the setting from being turned on if remote auth systems
and users are not already present.
2021-05-13 13:57:33 -04:00
Jeff Bradberry 81de931711 Add a new middleware to force-logout local-only users
when the DISABLE_LOCAL_AUTH setting is set.  This avoids the ugliness
of getting a SuspiciousOperation error for any request/response cycles
that are in flight when a user gets bounced.
2021-05-13 13:55:44 -04:00
Jeff Bradberry 9e7f004ca6 Add a signal handler to invalidate sessions and tokens for local users
when this setting gets turned on.
2021-05-13 13:55:44 -04:00
Jeff Bradberry 5c664eadf9 Write a thin wrapper around the standard Django auth backend 2021-05-13 13:55:44 -04:00
Jeff Bradberry 26b7e9de40 Add a new setting, DISABLE_LOCAL_AUTH
and expose it in the settings UI.
2021-05-13 13:55:44 -04:00
Jeff Bradberry d07887bd91 Remove the shebang line from pre-commit.sh
since bash isn't available by default on OS X.
2021-05-13 10:49:24 -04:00
Jeff Bradberry 1e5a0dc7c5 Break out the pre-commit hook into an explicit script
This means that

- we don't have to be always updating the underlying .git/hooks/pre-commit file
- updates to the logic will just work automatically
- the logic of the black logic has been fixed so that AWX_IGNORE_BLACK=1 should work right now
2021-05-12 11:54:17 -04:00
Jeff Bradberry 7b47d7e7f6 Data migration to remove the isolated instances from the database 2021-05-11 15:46:39 -04:00
Jeff Bradberry 204083fcdc Fix projects to use the utility function get_default_execution_environment 2021-05-03 14:00:19 -04:00
Jeff Bradberry 686d750ad9 Make the check_migrations command a direct alias of makemigration
It already more or less was, but it previously did some machinations
around copying and modifying the database settings.  These on-the-fly
changes to the database connection no longer work after the
rearrangement of settings files, so let's just get rid of it.
2021-05-03 11:01:52 -04:00
Jeff Bradberry 39f26fe576 Revert the code that prevents sysadmins from changing managed EEs
ref #10078
2021-05-03 10:25:18 -04:00
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 65cee65fad Update the docs to remove references to isolated nodes 2021-04-22 10:20:11 -04:00
Jeff Bradberry 17e3279f1c Remove isolated nodes from the API views and serializers 2021-04-22 10:20:11 -04:00
Jeff Bradberry a17c34f041 Remove the isolation-specific settings
- AWX_ISOLATED_PUBLIC_KEY
- AWX_ISOLATED_PRIVATE_KEY
- AWX_ISOLATED_KEY_GENERATION
- AWX_ISOLATED_HOST_KEY_CHECKING
- AWX_ISOLATED_USERNAME
- AWX_ISOLATED_CONNECTION_TIMEOUT
- AWX_ISOLATED_LAUNCH_TIMEOUT
- AWX_ISOLATED_PERIODIC_CHECK
- AWX_ISOLATED_CHECK_INTERVAL
2021-04-22 10:20:11 -04:00
Jeff Bradberry 1819a7963a Make the necessary changes to the models
- remove InstanceGroup.controller
- remove Instance.last_isolated_check
- remove .is_isolated and .is_controller methods/properties
- remove .choose_online_controller_node() method
- remove .supports_isolation() and replace with .can_run_containerized
- simplify .can_run_containerized
2021-04-22 10:17:02 -04:00
Jeff Bradberry 6a599695db Remove the IsolatedManager and its associated playbooks and plugins 2021-04-22 10:17:02 -04:00
Jeff Bradberry b0cdfe7625 Clean up the management commands 2021-04-22 10:11:27 -04:00
Jeff Bradberry efabc05270 Chop out the dev environment isolated node 2021-04-22 10:11:27 -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