Commit Graph
100 Commits
Author SHA1 Message Date
chris meyers a26df3135b static identifier in docs
* OPTIONS response descritpion for workflow job template node identifier
value was an ever changing uuid4(). This is telling the user the wrong
thing. We can not know what uuid4() is going to be in the docs. Instead,
for the OPTIONS response description, tell the user the form that the
uuid4() takes, ie. xxx-xxxx...
* Note that the API browser still populates a uuid4 for the user when it
generates the sample POST data. This is nice.
2020-04-03 13:12:49 -04:00
chris meyers d7f0642f48 add ws broadcast status to sos report 2020-04-02 21:46:12 -04:00
chris meyers 8bbae0cc3a color output of ws broadcast connection status 2020-04-02 21:46:12 -04:00
chris meyers c00f1505d7 add broadcast websocket status command 2020-04-02 21:46:12 -04:00
chris meyers 6d0c42a91a align with configmap changes 2020-04-02 20:05:26 -04:00
chris meyers 79c5a62279 simplify nonce creation and extraction
* time() library supports leap seconds also
2020-04-02 19:57:50 -04:00
chris meyers 6d60e7dadc align with openshift 2020-04-02 13:56:33 -04:00
chris meyers 929f4bfb81 start redis container with conf file 2020-04-02 11:13:35 -04:00
chris meyers 3326979806 fix register_queue race conditionn
* Avoid race condition with `apply_cluster_membership_policies`
2020-03-27 16:15:10 -04:00
chris meyers eab74cac07 autogenerate websocket secret 2020-03-26 10:32:37 -04:00
chris meyers 5ba90b629e fixup dev cluster bringup
* change from bootstrap script to launch_awx.sh script
2020-03-23 07:33:35 -04:00
chris meyers e9021bd173 serialize register_queue
* also remove uneeded query
2020-03-23 07:21:17 -04:00
chris meyers 47f5c17b56 log when notifications fail to send
* If a job does not finish in the 5 second timeout. Let the user know
that we failed to even try to send the notification.
2020-03-20 09:11:01 -04:00
chris meyers 06f065766f remove BROKER_URL special password handling
* BROKER_URL now describes how to connect to redis. We use a unix socket
to connect to redis. Therefore, no longer need to support fancy uri's
that contain fancy characters in the password.
2020-03-19 15:12:45 -04:00
chris meyers 0e70543d54 licenses for new python deps 2020-03-19 14:44:29 -04:00
chris meyers fd56b7c590 pin pexpect to 4.7.0 2020-03-19 11:25:43 -04:00
chris meyers 7f02e64a0d fix redis requirements mess
* Add the end of the redis PR we rebased devel a bunch. requirements
snuck into requirements.txt this way. This PR removes those requirements
(i.e. kombu) and bumps other requirements.
2020-03-19 10:19:07 -04:00
chris meyers 5e481341bc flake8 2020-03-19 10:01:20 -04:00
chris meyers 0a1070834d only update the ip address field on the instance
* The heartbeat of an instance is determined to be the last modified
time of the Instance object. Therefore, we want to be careful to only
update very specific fields of the Instance object.
2020-03-19 10:01:20 -04:00
chris meyers c7de3b0528 fix spelling 2020-03-19 10:01:20 -04:00
chris meyers 7f2e1d46bc replace janky unique channel name w/ uuid
* postgres notify/listen channel names have size limitations as well as
character limitations. Respect those limitations while at the same time
generate a unique channel name.
2020-03-19 08:59:15 -04:00
chris meyers 12158bdcba remove dead code 2020-03-19 08:57:05 -04:00
chris meyers 87de0cf0b3 flake8, pytest, license fixes 2020-03-18 16:10:20 -04:00
chris meyers 18f5dd6e04 add websocket backplane documentation 2020-03-18 16:10:20 -04:00
chris meyers 89163f2915 remove redis broker url test
* We use sockets everywhere. Thus, password special characters no longer
are an issue.
2020-03-18 16:10:20 -04:00
chris meyers 59c9de2761 awxkit python2.7 compatible print
* awxkit still supports python2.7 so do not use fancy f"" yet; instead,
use .format()
2020-03-18 16:10:20 -04:00
chris meyers b58c71bb74 remove broadcast websockets view 2020-03-18 16:10:20 -04:00
chris meyers 770b457430 redis socket support 2020-03-18 16:10:19 -04:00
chris meyers d58df0f34a fix sliding window calculation 2020-03-18 16:10:19 -04:00
chris meyers 3f5e2a3cd3 try to make openshift build happy 2020-03-18 16:10:19 -04:00
chris meyers 2b59af3808 safely operate in async or sync context 2020-03-18 16:10:19 -04:00
chris meyers 9e5fe7f5c6 translate Instance hostname to safe analytics name
* More robust translation of Instance hostname to analytics safe name by
replacing all non-alpha numeric characters with _
2020-03-18 16:10:19 -04:00
chris meyers 093d204d19 fix flake8 2020-03-18 16:10:19 -04:00
chris meyers e25bd931a1 change dispatcher test to make required queue
* No fallback-default queue anymore. Queue must be explicitly provided.
2020-03-18 16:10:19 -04:00
chris meyers 8350bb3371 robust broadcast websocket error hanndling 2020-03-18 16:10:18 -04:00
chris meyers d6594ab602 add broadcast websocket metrics
* Gather brroadcast websocket metrics and push them into redis every
configurable seconds.
* Pop metrics from redis in web view layer to display via the api on
demand
2020-03-18 16:10:18 -04:00
chris meyers b6b9802f9e increase per-channel capacity
* 100 is the default capacity for a channel. If the client doesn't read
the socket fast enough, websocket messages can and will be lost. This
increases the default to 10,000
2020-03-18 16:10:18 -04:00
chris meyers 0da94ada2b add missing service name to dev env
* Dev env was bringing the wsbroadcast service up but not under the
tower-process dependency. This is cleaner.
2020-03-18 16:10:18 -04:00
chris meyers 3b9e67ed1b remove channel group model
* Websocket user session <-> group subscription membership now resides
in Redis rather than the database.
2020-03-18 16:10:18 -04:00
chris meyers 14320bc8e6 handle websocket unsubscribe
* Do not return from blocking unsubscribe until _after_ putting the
gotten unsubscribe message on the queue so that it can be read by the
thread of execution that was unblocked.
2020-03-18 16:10:18 -04:00
chris meyers 3c5c9c6fde move broadcast websocket out into its own process 2020-03-18 16:10:18 -04:00
chris meyers f5193e5ea5 resolve rebase errors 2020-03-18 16:10:17 -04:00
chris meyers 03b73027e8 websockets aware of Instance changes
* New tower nodes that are (de)registered in the Instance table are seen
by the websocket layer and connected to or disconnected from by the
websocket broadcast backplane using a polling mechanism.
* This is especially useful for openshift and kubernetes. This will be
useful for standalone Tower in the future when the restarting of Tower
services is not required.
2020-03-18 16:10:17 -04:00
chris meyers c06b6306ab remove health info
* Sending health about websockets over websockets is not a great idea.
* I tried sending health data via prometheus and encountered problems
that will need PR's to prometheus_client library to solve. Circle back
to this later.
2020-03-18 16:10:17 -04:00
chris meyers e94bb44082 replace rabbitmq with redis
* local awx docker-compose and image build only.
2020-03-18 16:10:17 -04:00
chris meyers be58906aed remove kombu 2020-03-18 16:10:17 -04:00
chris meyers 403e9bbfb5 add websocket health information 2020-03-18 16:10:16 -04:00
chris meyers ea29f4b91f account for isolated job status
* We can not query the dispatcher running on isolated nodes to see if
the playbook is still running because that is the nature of isolated
nodes, they don't run the dispatcher nor do they run the message broker.
Therefore, we should query the control node that is arbitrating the
isolated work. If the control node process in the dispatcher is dead,
consider the iso job dead.
2020-03-18 16:10:16 -04:00
chris meyers 3f2d757f4e update awxkit to use new unsubscribe event
* Instead of waiting an arbitrary number of seconds. We can now wait the
exact amount of time needed to KNOW that we are unsubscribed. This
changeset takes advantage of the new subscribe reply semantic.
2020-03-18 16:10:16 -04:00
chris meyers feac93fd24 add websocket group unsubscribe reply
* This change adds more than just an unsubscribe reply.
* Websockets canrequest to join/leave groups. They do so using a single
idempotent request. This change replies to group requests over the
websockets with the diff of the group subscription. i.e. what groups the
user currenntly is in, what groups were left, and what groups were
joined.
2020-03-18 16:10:16 -04:00
chris meyers 088373963b satisfy generic Role code
* User in channels session is a lazy user class. This does not conform
to what the generic Role ancestry code expects. The Role ancestry code
expects a User objects. This change converts the lazy object into a
proper User object before calling the permission code path.
2020-03-18 16:10:16 -04:00
chris meyers 5818dcc980 prefer simple async -> sync
* asgiref async_to_sync was causing a Redis connection _for each_ call
to emit_channel_notification i.e. every event that the callback receiver
processes. This is a "known" issue
https://github.com/django/channels_redis/pull/130#issuecomment-424274470
and the advise is to slow downn the rate at which you call
async_to_sync. That is not an option for us. Instead, we put the async
group_send call onto the event loop for the current thread and wait for
it to be processed immediately.

The known issue has to do with event loop + socket relationship. Each
connection to redis is achieved via a socket. That conection can only be
waiting on by the event loop that corresponds to the calling thread.
async_to_sync creates a _new thread_ for each invocation. Thus, a new
connection to redis is required. Thus, the excess redis connections that
can be observed via netstat | grep redis | wc -l.
2020-03-18 16:10:16 -04:00
chris meyers dc6c353ecd remove support for multi-reader dispatch queue
* Under the new postgres backed notify/listen message queue, this never
actually worked. Without using the database to store state, we can not
provide a at-most-once delivery mechanism w/ multi-readers.
* With this change, work is done ONLY on the node that requested for the
work to be done. Under rabbitmq, the node that was first to get the
message off the queue would do the work; presumably the least busy node.
2020-03-18 16:10:16 -04:00
chris meyers 50b56aa8cb autobahn 20.1.2 released an hour ago
* 20.1.1 no longer available on pypi
2020-03-18 16:10:15 -04:00
chris meyers 3fec69799c fix websocket job subscription access control 2020-03-18 16:10:15 -04:00
chris meyers 2a2c34f567 combine all the broker replacement pieces
* local redis for event processing
* postgres for message broker
* redis for websockets
2020-03-18 16:10:15 -04:00
chris meyers 558e92806b POC postgres broker 2020-03-18 16:10:15 -04:00
chris meyers 355fb125cb redis events 2020-03-18 16:10:15 -04:00
chris meyers c8eeacacca POC channels 2 2020-03-18 16:10:12 -04:00
chris meyers 0db0f81e53 allow external pg connections
* Postgres containers now, by default, do not allow passwordless users
to connect remotely. This change explicitly allows that case.
2020-02-17 10:16:20 -05:00
chris meyers 0b3e2cc7e3 pin virtualenv < 20 for awx_web builds 2020-02-11 08:43:26 -05:00
chris meyers a36bf4af64 fix instance migration is_isolated() issue
* Older versions of Instance model code may not contain the
is_isolated() method. This change accounts for that fact.
2020-02-05 09:16:31 -05:00
chris meyers 0291c476d4 use existing version of Instance
* Without this change, future modifications to the Instance object may
result in migration fails (i.e. adding a field to the Instance model)
2020-02-03 14:25:06 -05:00
chris meyers 129374a1c2 keep *-devel package in the dev container
* requirements/updater.sh does pip magic. In doing this magic, devel
system packages are required to download/install/build. This change
ensures those dev packages are available.
2019-12-03 14:31:09 -05:00
chris meyers 9fa4dac847 do not expose the notication secret fields 2019-08-14 13:58:47 -04:00
chris meyers d785145c59 force proj sync when collections/requirements.yml
* Similar to roles/requirements.yml sync optimization logic.
2019-08-12 22:16:02 -04:00
chris meyers cc6413c44c use ansible nightly
* ansible:devel now has ansible-galaxy collection support
2019-08-12 22:14:31 -04:00
chris meyers 4be65a0879 collections/requirements.yml support
* just like we support ansible-galaxy role install, support
ansible-galaxy collection install
2019-08-12 22:14:30 -04:00
chris meyers 9236fd2a53 fake it till you make it!
* The user awx is passed to the launch of our dev docker container. The
docker system automagically creates that user for us and sets the home
dir to /tmp in /etc/passwd. Many methods of detecting the user home dir
don't use that. Instead, they use the HOME env var. This is a half-way
solution that solves the problem of python expanding the ~ dir.
* If other things break because they determine the users home dir via
/etc/passwd entry then a more in-depth fix will be needed.
2019-07-29 09:58:47 -04:00
chris meyers 9b95cc27c4 map in a global collections path 2019-07-17 15:36:09 -04:00
chris meyers acb6d9c4d1 wrap smart inv cache update w/ advisory lock
* Two job templates that use the same smart inventory running at the
same time can easily race to recompute the smart inventory <-> host
mapping. In this case, bulk_create() can throw an error when racing.
* The per-smart-inventory advisory lock ensures that the state of the
system is consistent & that bulk_create() runs in isolation.
2019-06-21 08:52:34 -04:00
chris meyers 8aa28092ff disabled instance does not mean offline instance
* Disabling an instance is used to stop and instance from being the
target of new jobs to run.
* The instance should still perform it's heartbeat so that it isn't
considered offline.
* If the instance was allowed to go offline on an openshift cluster it
would be deleted from the database.
2019-05-13 11:44:47 -04:00
chris meyers 84c09a19d1 instantiate dispatcher once per job run
* Instantiating the callback dispatch queue on each job event callback
is expensive. Instead, instantiate it only once. Note, we do not need to
instantiate the callback queue in the iso case so we do not.
2019-04-17 14:03:00 -04:00
chris meyers 0c6a522813 remove system tracking
* Leave the artisanal handcrafted migration from vendored fact scan to
external fact gathering.
2019-04-12 14:30:29 -04:00
chris meyers 531d97d3b3 pickup insights system_id from ansible facts
* Continue to pick up facts from scan_insights.py
* This PR adds the ability to pickup facts from
/etc/ansible/facts.d/insights.facts
* Log what transport the insights system_id was found via
2019-04-05 10:35:56 -04:00
chris meyers 71fcb1a82c process host facts for iso runs
* Move isolated clean to our final run hook
* ISO and non-iso code path now share the post-fact-processing code
2019-03-29 16:16:22 -04:00
chris meyers 926d6a6525 include tower header to insights on plan fetch
* We include a special header value in the user agent when tower proxies
requests to get per-host rules.
* This extends that header logic to when we fetch plans (playbooks)
2019-03-28 10:56:56 -04:00
chris meyers cb4d55b47a fixes inventory update deadlock
* all inventory updates continue to occur in parallel up to the point
that they update the database with their results.
* the "funnel" is achieved by using a global per-inventory postgres
named lock
2019-03-27 16:52:07 -04:00
chris meyers 2329079326 runner expects process isolation flags in settings
* Towards the goal of converging the iso code path w/ the non-iso code
path. More process isolation control flags into settings.
2019-03-27 11:08:41 -04:00
chris meyers 87e1ba4dea do not generate a random ident
* instead, set the ident passed to ansible runner to be the job id. That
way, on we know what directory to look in for results when the directory
structure is created.
2019-03-22 12:19:42 -04:00
chris meyers b7b97dd58d doc update fix 2019-03-21 09:26:59 -04:00
chris meyers 0a670e8db1 change from runner master to runner 1.3 2019-03-21 07:46:11 -04:00
chris meyers 60ef160e85 flake8 fix 2019-03-20 16:12:45 -04:00
chris meyers 8c26f20188 add license files for python modules
* python-daemon
* ansible-runner
2019-03-20 14:51:41 -04:00
chris meyers 2c52a7d9a8 fix more unit tests for runner
* isolated will be fixed in the future so pytest skip those
* fact cache moved one directory level up, account for that
2019-03-20 14:32:52 -04:00
chris meyers b006510035 do not save sensitive env vars
* job_env gets exposed via the api. Sensitive env variables should be
redacted before saved into job_env.
2019-03-20 14:00:22 -04:00
chris meyers 1a6ae6e107 allow for runner setting parent_uuid
* Previously, parent_uuid was expected only on events generated for a
Job run. Now, there maybe a parent_uuid for any job type. AWX does not
support parenting events for any job type other than Job.
2019-03-20 11:05:01 -04:00
chris meyers 060585434a update tests 2019-03-20 09:44:38 -04:00
chris meyers 5135b8a969 fixup unit tests for tasks 2019-03-18 14:21:47 -04:00
chris meyers 8a04c22b2b point at another runner branch
* revert parent_uuid because it causes problems with unexpected
parameter on event creation for some event type.
2019-03-18 14:21:47 -04:00
chris meyers f7842cf283 refactor and fix unit tests
* fixup task TestGenericRun
* make runner callback functions accessable to testing
* reduce isintance() usage in run() by using build_ pattern
* move process_isolation param building to build_ function so it can be
tested
2019-03-18 14:21:47 -04:00
chris meyers 827ad0fa75 remove safe_args and add status_handler
* safe_args no longer makes sense. We have moved extra_vars to a file
and thus do not pass sensitive content on the cmdline
2019-03-18 14:21:47 -04:00
chris meyers 8fb65b40de use ansible runner to run playbooks
* Project Updates
* Jobs
* Inventory Updates
* System Jobs
* AdHoc Commands

* Notifications
* Fact Cache
* proot
2019-03-18 14:21:47 -04:00
chris meyers a7cda95803 init ansible-runner requirements 2019-03-18 14:21:47 -04:00
chris meyers 723f581fd0 fix handling of serial strategy
* v2_playbook_on_play_start is called multiple times for the same UUID.
Specifically, once for each host in the play. This changes makes the
uuid unique before going to the dispatcher.
2019-02-22 13:14:35 -05:00
chris meyers c121565209 add tests for host_filter
* Ensure that building the smart inventory query string doesn't invoke
the database.
2019-02-12 16:11:54 -05:00
chris meyers 63e3e733e0 AWX 3.0.1 2019-02-08 14:17:33 -05:00
chris meyers ed78978b5f do not observe queries when constructing them
* While parsing host_filter in the smart inventory code it was
triggering sql queries. This changset avoids executing the query that is
being constructed.
2019-02-08 12:30:51 -05:00
chris meyers d4c3c089df fix scheduled jobs race condition
* The periodic scheduler that runs and spawns jobs from Schedule()'s can
end up spawning more jobs than intended, for a single Schedule.
Specifically, when tower clustering is involed. This change adds a
"global" database lock around this critical code. If another process is
already doing the scheduling, short circuit.
2019-02-08 08:43:11 -05:00
chris meyers db2bb19d65 add docs for task manager node decider 2019-01-02 12:17:28 -05:00