Commit Graph
100 Commits
Author SHA1 Message Date
Seth Foster 550d9d5e42 detect if job events are tree-like and collapsable in the UI 2022-06-09 14:25:39 -04:00
Seth Foster 9364c8e562 typo 2022-05-31 17:18:45 -04:00
Seth Foster 5831949ebf maxconn 2022-05-31 17:16:27 -04:00
Seth Foster 7fe98a670f haproxy 2022-05-31 17:12:19 -04:00
Seth Foster 6f68f3cba6 Add make prometheus and make grafana commands to dev environment 2022-05-31 17:07:15 -04:00
Seth Foster eba4a3f1c2 in case we fail a job in task manager, we need to add the project update to the inventoryupdate.source_project field 2022-05-12 15:21:17 -04:00
Seth Foster 0ae9fe3624 if dependency fails, fail job in task manager 2022-05-12 14:00:13 -04:00
Seth Foster 1b662fcca5 SCM inv source trigger project update
- scm based inventory sources should launch project updates prior to
running inventory updates for that source.
- fixes scenario where a job is based on projectA, but the inventory
source is based on projectB. Running the job will likely trigger a
sync for projectA, but not projectB.

comments
2022-05-12 14:00:12 -04:00
Seth Foster 65dfc424bc Improve help text for import and export 2022-05-10 13:18:40 -04:00
Seth Foster 1462af61b0 awxkit log which resource failed to import 2022-04-11 17:03:13 -04:00
Seth Foster cfd6df7a3b Add JobJobEventsChildrenSummary endpoint
- returns a special view to output the total number of children (and
grandchildren) events for all parents events for a job
value is the number of total children of that event
- intended to be consumed by the UI, as an efficient way to get the
number of children for a particular event
- see api/templates/api/job_job_events_children_summary.md for more info
2022-04-04 14:25:18 -04:00
Seth Foster 24152555c5 Handle error for create_partition
Occasionally the create_partition will error with,
relation "main_projectupdateevent_20220323_19" already exists

This change wraps the db command into a try except block with its
own transaction
2022-03-28 16:37:50 -04:00
Seth Foster acebff7be1 Fix sync-only operation in async context 2022-03-21 14:37:10 -04:00
Seth Foster de1df8bf28 load job meta vars after JT extra vars 2022-03-02 14:42:47 -05:00
Seth Foster 6db7cea148 variable name changes 2022-02-10 10:57:00 -05:00
Seth Foster 3993aa9524 Add metric for number of events emitted over websocket broadcast 2022-02-09 21:57:01 -05:00
Seth Foster 1cd30ceb31 remove any named pipes before unzipping artifacts 2022-02-02 15:54:31 -05:00
Seth Foster b3c20ee0ae Install ps in dev image 2022-01-26 18:12:52 -05:00
Seth Foster 956638e564 Revert "Remove unnecessary DEBUG logger level settings (#11441)"
This reverts commit 8126f734e3.
2022-01-10 11:46:19 -05:00
Seth Foster e04efad3c0 tools_receptor_1 should use whatever awx_devel tag that tools_awx_1 is using 2021-11-10 08:50:11 +08:00
Seth Foster d346dbb8ba Fix conditional to check that minikube should start 2021-07-19 11:05:05 -04:00
Seth Foster a9013c43fa fix pylint 2.9 errors in awx collection 2021-06-30 14:28:35 -04:00
Seth Foster 5da02690c1 Fix copy_from warning message
- warn() does not take keyword 'msg'
- add testing around the copy_from parameter for project creation
2021-06-26 01:28:02 -04:00
Seth Foster 7bc7c9c4bd haproxy specify user 2021-06-24 13:54:24 -04:00
Seth Foster bb3fc3caa8 controller_token, alias tower_token 2021-06-22 10:49:39 -04:00
Seth Foster 75a27c38c2 Add a periodic task to reap unreleased receptor work units
- Add work_unit_id field to UnifiedJob
2021-06-22 10:49:31 -04:00
Seth Foster 61846e88ca Add validator for ee image field name
awxkit default ee image name is now a fixed valid (but bogus) name, rather than random unicode
2021-06-15 20:06:49 -04:00
Seth Foster 9eda6359f0 False to false to fix linter 2021-06-08 14:33:30 -04:00
Seth Foster 1deaf55ba4 syntax error in runtime.yml 2021-06-08 14:33:30 -04:00
Seth Foster 44c50bbbf7 add redirect for lookup and inventory plugins 2021-06-08 14:33:29 -04:00
Seth Foster c9e7747f2d black ignore awx_collection 2021-06-08 14:33:29 -04:00
Seth Foster 199b4b6b47 fixed up jinja2 templating and documentation 2021-06-08 14:33:29 -04:00
Seth Foster f06485feca fqcn redirects, and raise from sanity test fix 2021-06-08 14:33:29 -04:00
Seth Foster 4bd910493a sanity tests 2021-06-08 14:33:28 -04:00
Seth Foster cd100fd770 fix super and kwargs 2021-06-08 14:33:28 -04:00
Seth Foster 157adb828e various sanity fixes 2021-06-08 14:33:28 -04:00
Seth Foster b26e33ca34 remove eula_accepted 2021-06-08 14:33:28 -04:00
Seth Foster ee8c1638c5 remove deprecated modules 2021-06-08 14:33:26 -04:00
Seth Foster 4add72b9d2 actually make use of option aliases 2021-06-08 14:33:25 -04:00
Seth Foster 54dd24b96b auth_plugin env alternative 2021-06-08 14:33:25 -04:00
Seth Foster 7d06fc74dd tower_username to controller_username, etc 2021-06-08 14:33:25 -04:00
Seth Foster 1a2e56c785 restore tower_legacy.py, update examples to include CONTROLLER_HOST 2021-06-08 14:33:25 -04:00
Seth Foster a7b29f6112 controller_inventory.yml in addition to tower_inventory.yml 2021-06-08 14:33:24 -04:00
Seth Foster 39b26c8f0e Added env variable CONTROLLER_HOST, et al. Add awx.awx namespace to the runtime.yml redirects, and added templating task to change to ansible.controller 2021-06-08 14:33:24 -04:00
Seth Foster 1ade9b3a7d various references to tower 2021-06-08 14:33:24 -04:00
Seth Foster 82c5803e59 mostly includes renaming non-syntax references to tower 2021-06-08 14:33:24 -04:00
Seth Foster 9f4172ce7b upstream 2021-06-08 14:33:23 -04:00
Seth Foster ef56571772 controller_meta, templating 2021-06-08 14:33:23 -04:00
Seth Foster 6911a59f39 fix unit tests 2021-06-08 14:33:23 -04:00
Seth Foster 7a63785255 more rename, mostly in test 2021-06-08 14:33:23 -04:00
Seth Foster a695274cb6 regex replace tower_*: to '' 2021-06-08 14:33:22 -04:00
Seth Foster 44fed1d7c1 pycharm refactor rename files and class, linux rename tower_ controller_ 2021-06-08 14:33:22 -04:00
Seth Foster 8ab81216f3 unused import 2021-04-20 11:16:32 -04:00
Seth Foster 1e3cfdc986 just remove dangling images 2021-04-20 11:16:32 -04:00
Seth Foster c64ec6bbf8 check if is_k8s 2021-04-20 11:16:32 -04:00
Seth Foster 4566e7a2a6 check subprocess returncode 2021-04-20 11:16:32 -04:00
Seth Foster 3912f2b57c remove migration file 2021-04-20 11:16:32 -04:00
Seth Foster fa61ec6b3c Remove system job, replace with scheduled task 2021-04-20 11:16:31 -04:00
Seth Foster 33567f8729 delete_prefix local 2021-04-20 11:16:31 -04:00
Seth Foster 1c888ca58b cleanup stdout 2021-04-20 11:16:31 -04:00
Seth Foster f98b92073d Add cleanup_images system job template
- Removes podman images on the system that are not assigned to an
execution environment
2021-04-20 11:16:31 -04:00
Seth Foster 7583525366 Return distinct labels for non-admin Users 2021-04-20 10:59:38 -04:00
Seth Foster 1e4b44e54f Prevent ee from being assigned to a new organization
- ee organization can be changed to null (less restrictive)
- if organization is null, cannot be assigned to org (more restrictive)
- if org is assigned, it cannot be set to a different org
2021-04-12 14:15:21 -04:00
Seth Foster 89e28d6d4a fix awx_collections tests by comparing Decimal to float, instead of comparing strings 2021-04-08 13:38:35 -04:00
Seth Foster f05ffa521a the returned self.elapsed should be decimal, instead of float, to match django model field type 2021-04-08 11:36:40 -04:00
Seth Foster 09c176847d string 2021-04-07 17:30:46 -04:00
Seth Foster 8c73a51730 Fix elapsed time on job showing incorrect value
- job elapsed time showed 0.0, during and after the job run
2021-04-07 15:54:43 -04:00
Seth Foster 0c569c67fd Add subsystem metrics
- Adds a Metrics() class that can track data such as number of
events the callback receiver inserted into database
- Exposes this metric data at the api/v2/metrics/ endpoint.
This data is prometheus-friendly
- Metric data is stored in memory, then periodically saved to Redis.
- Metric data is periodically broadcast to other nodes in the cluster,
so that each node has a copy of the most recent metric data collected.
2021-03-25 15:23:52 -04:00
Seth Foster 3f342feadd Fix api/v2/metrics data displaying incorrect value
- Use a locally defined prometheus registry instead of global registry
2021-03-25 14:22:17 -04:00
Seth Foster f8641bfa5e fix port conflict in dev cluster. Output only one haproxy def 2021-03-22 10:45:50 -04:00
Seth Foster 6f7bdc04c0 fix requirements file 2021-02-08 23:06:07 -05:00
Seth Foster 41d0a2f7b9 Add job lifecycle logging
Various	points (e.g. created, running, processing events), are
structured into	json format and	output to /var/log/tower/job_lifecycle.log

As part	of this	work, the DependencyGraph is reworked to return
which job object is doing the blocking, rather than a boolean.
2021-02-04 12:25:51 -05:00
Seth Foster 81dd54504e move custom deletion tool for cleanup jobs to utils 2020-12-16 11:14:33 -05:00
Seth Foster a66eca82c2 can delete approval node 2020-11-24 12:27:42 -05:00
Seth Foster 3606b4e334 these rules no longer apply as of PRs 5519 and 5489 2020-09-11 12:59:18 -04:00
Seth Foster e09274e533 PR #8074 - limit how many jobs the task manager can start on a given run 2020-09-08 12:16:06 -04:00
Seth Foster 07160d9719 Add kubernetes_web_svc_type variable to installer/inventory
awx-web-svc is now settable, e.g. ClusterIP or NodePort. Default
is NodePort
2020-07-29 14:18:10 -04:00
Seth Foster 053b7caf3a Update helm urls 2020-07-27 13:01:29 -04:00
Seth Foster 0e5f68ef53 Make all_parents_must_converge settable when creating node
When targeting, ../workflow_job_templates/id#/workflow_nodes/ endpoint,
user could not set all_parents_must_converge to true.

3.7.1 backport for awx issue #7063
2020-06-09 11:07:22 -04:00
Seth Foster e768d5e7fc Make all_parents_must_converge settable when creating node
When targeting, ../workflow_job_templates/id#/workflow_nodes/ endpoint,
user could not set all_parents_must_converge to true.

awx issue #7063
2020-06-08 17:51:15 -04:00
Seth Foster 09e5093b96 flake 8 version test 2020-05-13 13:32:11 -04:00
Seth Foster 4da0e0dd80 Vendor collections for isolated jobs to work in ansible 2.10
kubectl and synchronize are now part of community.kubernetes
and ansible.posix collections, respectively. This change installs
these collections to a local directory to be used in inventory and
isolated management playbooks.

awx issue #6930
2020-05-13 10:41:01 -04:00
Seth Foster 6652464e25 Unset old instance IP when conflicting new instance IP
With AWX_AUTO_DEPROVISION_INSTANCES on, instances
are registered with an ip address. However, new
instances might try to register before old instances
are deprivisioned. In this case old IPs can conflict with
the new ones. This will check for an ip conflict and unset
the IP of conflicting instance (set to None)

ansible/awx issue 6750
2020-04-28 10:52:15 -04:00
Seth Foster 843c22c6b1 Allow orphaned user to be added to org
Fixed bug where an org admin was not able to add
an orphaned user to the org, in the case where the
orphan had an ancestor role that matched one of the
roles for of the org admin.

scenario to fix -- sue is member of cred1, where cred1 is
part of org1. org1 admin cannot add sue to org1, because
the cred1 role for sue has an ancestor to org1 role. The org1
admin cannot change or attach sue to org1.

tower issue #4198 and #4197
2020-04-02 14:24:55 -04:00
Seth Foster 88fb30e0da Delete jobs without loading objects first
The commit is intended to speed up the cleanup_jobs command in awx. Old
methods takes 7+ hours to delete 1 million old jobs. New method takes
around 6 minutes.

Leverages a sub-classed Collector, called AWXCollector, that does not
load in objects before deleting them. Instead querysets, which are
lazily evaluated, are used in places where Collector normally keeps a
list of objects.

Finally, a couple of tests to ensure parity between old Collector and
AWXCollector. That is, any object that is updated/removed from the
database using Collector should be have identical operations using
AWXCollector.

tower issue 1103
2020-03-19 14:14:02 -04:00
Seth Foster 31dbf38a35 Prevent failing a successful project update if inventory update fails
Scenario - job is launched and spawns inventory update and project update.
If the inventory update fails, then it will fail the job and the project update.
It will fail the project update even if that update already ran and was successful.

This code change will not fail the project update if it has already ran successfully.

In cases where other jobs depend on that project update (but not the failed inventory
update), then we don't want those jobs to fail.
2020-02-24 11:35:57 -05:00
Seth Foster 9b4b2167b3 TaskManager process dependencies only once
This adds a boolean "dependencies_processed" field to UnifiedJob
model. The default value is False. Once the task manager generates
dependencies for this task, it will not generate them again on
subsequent runs.

The changes also remove .process_dependencies(), as this method repeats
the same code as .process_pending_tasks(), and is not needed. Once
dependencies are generated, they are handled at .process_pending_tasks().

Adds a unit test that should catch regressions for this fix.
2020-02-06 11:47:33 -05:00
Seth Foster 7873d08311 Update pip and setuptools in requirements txt
Versions selected to be pre-19 pip
due to unresolved issues with the build systems

Upgrade everything, party on

document new process

rotate license files

fix Swagger schema generation target

Remove --ignore-installed flag
2020-01-07 17:14:32 -06:00
Seth Foster b26b8e7097 Prevent running jobs from blocking inventory updates
A running job that has an inventory source will block
that inventory update from running. This fix removes
the block.

The test creates a job in running state, and an inventory
update in pending state. The test asserts that the
task manager and dependency graph .is_job_blocked method
returns False for the inventory update (i.e. update can
run).

issue #4809
2019-12-16 15:15:23 -05:00
Seth Foster 63e9aed601 Prevent running jobs from blocking project updates
A running job that has a project update will block
that update from running. This fix removes
the block.
Adds a functional test that sets up a job in "running" state, and
starts a project update that is in "pending" state. Assert that
the task manager and dependency graph .is_job_blocked methods both
return False.

issue #5153
2019-12-16 13:43:42 -05:00
Seth Foster e1e7e9047d Fix filtering azure inventory based on user-specified tags
Users can specify a list of keys, or a list of key:value pairs under
source variables. e.g. tags: Creator, peanutbutter or tags:
Creator:jmarshall, peanutbutter:jelly. If provided, only hosts that have
all keys or key:value pairs in the list will be returned.

inventory.py sets up the azure_rm.yml that provides
exclude_host_filters. This code adds a line for each key in the list, as
well as an additional line in the case of a key:value pair.

e.g.

exclude_host_filters:
- "'Creator' not in tags.keys()"
- tags['Creator'] != 'jmarshall'

Each line is a conditional, and if any conditionals is true, then the
host is filtered out.

fix for issue # 5044
2019-11-15 14:18:20 -05:00
Seth Foster 7e83ddc968 Fix URLField to allow numbers in top level domain
Add a custom regex to URLField that allows numbers to be present in the
top level domain, e.g. https://towerhost.org42

Set by variable allow_numbers_in_top_level_domain in URLField __init__,
and is set to True by default. If set to False, it will use the regex
specified in the built-in django URLValidator class.

This solution was originally implemented in LDAPServerURIField, but is
now implemented in URLField to support this behavior more generally. The
changes in LDAPServerURIField are longer needed and have been removed in
this commit.

Adds unit testing to make sure URLField changes handle regex input
and settings correctly.
2019-10-28 13:47:01 -04:00
Seth Foster 58e84a40e5 Fix 500 error when creating a job schedule
- 500 error occurs when a non-admin user attempts to add an invalid
  credential during schedule creation
- This change checks that the user can add the object to
  serializer.validated_data, instead of serializer.initial_data
- The invalid credential field is purged in .validated_data, so the
  request passes through cleanly
- Fix for awx issue #4147
2019-10-23 14:22:07 -04:00
Seth Foster 9c04e08b4d Fix secret lookup links when credentials are copied
- When a credential that contains secret lookups (e.g. HashiCorp Vault
  Secret Lookup) is copied, the lookup fields are not properly copied
- This change adds the necessary fields to FIELDS_TO_PRESERVE_AT_COPY
  for both Credential and CredentialInputSource classes to ensure a
  proper copy
2019-10-22 17:49:10 -04:00
Seth Foster 8e26e4edd5 Allow oauth2 settings to be set in the ui and api
Oauth2 settings were initialized early in the awx import stage, and
those settings were not modifiable. This change allows oauth2 to check
for settings in django.conf settings, which are dynamically updated
through api calls at runtime. As a result, oauth2 settings will match
the values in django.conf settings at any point in time.
2019-10-14 11:38:20 -04:00
Seth Foster bbd625f3aa update help_text to include information about REFRESH_TOKEN_EXPIRE_SECONDS 2019-10-02 17:16:01 -04:00
Seth Foster 8b22c86b10 Register default settings for OAUTH2_PROVIDER app
Grab AUTHORIZATION_CODE_EXPIRE_SECONDS from oauth2_settings
rather than hard code.

Add REFRESH_TOKEN_EXPIRE_SECONDS to valid_key_names
in OAuth2ProviderField class
2019-10-02 15:29:45 -04:00
Seth Foster db1ad2de95 Set REFRESH_TOKEN_EXPIRE_SECONDS
- Set OAUTH2 REFRESH_TOKEN_EXPIRE_SECONDS to 1 month
  (2628000 seconds)
- If not set, awx-manage cleartokens, or cleanup_tokens,
  will not work properly
- Once cleartokens is run, this setting is the amount of
  time after an access token expires that we keep its
  refresh token in the database
2019-10-02 13:51:46 -04:00
Seth Foster b6ffde75ef check expired sessions only if User exists
- Indent rest of code into the conditional
  that checks for expired sessions of that User
- If user doesn't exist, no need to check
2019-09-27 12:31:10 -04:00
Seth Foster 94fa745859 removed duplicate import of User 2019-09-27 11:47:44 -04:00