Commit Graph
100 Commits
Author SHA1 Message Date
chris meyers f37391397e add inventory to schedule summary fields
* Use the same logic that related inventory uses. If there is an
inventory that overrides the inventory on the unified job  template then
summarize that field. Else, use the inventory on the unified job template
being scheduled.
2018-11-08 11:47:31 -05:00
chris meyers 906eb98d8e fixes dispatcher test that inadvertently access db
* Logger inadvertently triggered by dispatcher tests that do not need DB
access. Mock settings to sidestep DB access.
2018-10-16 11:30:04 -04:00
chris meyers 2e98446394 fix issue with ldap queries containing unicode 2018-10-12 10:33:01 -04:00
chris meyers cfb58eb145 fix issue with ldap queries containing unicode 2018-10-10 12:32:27 -04:00
chris meyers 0a0cdc2e21 at migration time, validate ldap group type params
* Previously, we have logic in the API to ensure that ldap group type
params, when changed, align with ldap group type Class init
expectations. However, we did not have this logic in the migrations.
This PR adds the validation check to migrations.
2018-09-27 12:18:39 -04:00
chris meyers f82f4a9993 deprecate fact endpoints and commands 2018-09-07 17:46:33 -04:00
chris meyers c7c9620f03 vary the pk 2018-08-09 17:53:31 -04:00
chris meyers 45f2fe7f90 add test for first net cred ssh password protected wins 2018-08-09 17:53:23 -04:00
chris meyers 3960a72c8a first net password-protected ssh key wins 2018-08-09 17:53:13 -04:00
chris meyers bc2b2214a8 add test for ssh over network ssh key password preference 2018-08-09 17:53:06 -04:00
chris meyers 3c2b18a965 add pexpect test for net cred 2018-08-09 17:52:55 -04:00
chris meyers f5aed74503 fill in network ssh password protected keys 2018-08-09 17:52:45 -04:00
chris meyers 5bfe9bf228 vary the pk 2018-08-09 15:44:59 -04:00
chris meyers 40d6c763b3 add test for first net cred ssh password protected wins 2018-08-09 13:32:42 -04:00
chris meyers 2f49dc774a first net password-protected ssh key wins 2018-08-09 13:25:15 -04:00
chris meyers 8d440acb0f add test for ssh over network ssh key password preference 2018-08-09 12:51:40 -04:00
chris meyers 9a199b99ac add pexpect test for net cred 2018-08-09 12:40:37 -04:00
chris meyers 48a0038f53 fill in network ssh password protected keys 2018-08-09 12:15:27 -04:00
chris meyers 5f85a08325 fix saml_admin_attr 2018-07-23 12:53:18 -04:00
chris meyers 3fcd1575c1 fix saml_admin_attr 2018-07-23 10:08:18 -04:00
chris meyers 7d24566120 more robustness 2018-07-20 15:02:44 -04:00
chris meyers 19e865e9a5 prevent remove iso instance from iso instance groups 2018-07-06 15:34:26 -04:00
chris meyers 2ffc4b256d fix copy paste error 2018-07-06 15:12:57 -04:00
chris meyers aeca21ab5b deny topology changes to iso instances via api 2018-07-06 14:50:17 -04:00
chris meyers 1359208a99 fix celery task reaper
* celery workers have internal queue names that are named after the
system hostname. This may differ from what tower knows the host by,
Instance.hostname
This adds a mapping so we can convert internal celery names to Instance
names for purposes of reaping jobs.
2018-06-15 16:56:53 -04:00
chris meyers 987063e7fd iso nodes do not have celery. that is ok 2018-06-11 15:38:41 -04:00
chris meyers fb11967114 remove isolated instance group queue listening 2018-06-08 13:46:58 -04:00
chris meyers 1cea20092c remove rampart group queue subscription
* We now target Instances in the task manager when transitioning jobs
from pending to waiting; whereas before we submitted jobs to Instance
Groups to be picked up by Instance's in those Instance Groups.
Subscribing Instances to their Instance Groups is no longer needed. This
change removes the Instance Group queue subscription.
2018-06-08 11:20:54 -04:00
chris meyers 0702692ca9 add controller_node to adhoc command job 2018-06-06 16:28:28 -04:00
chris meyers 74155dfc9d add system jobs to controller_node exceptions 2018-06-06 15:04:41 -04:00
chris meyers 8ee4b9680c remove controller_node field from jobs that don't apply 2018-06-06 11:26:15 -04:00
chris meyers b876c2af62 add total job count for instance + instance group 2018-06-05 12:05:22 -04:00
chris meyers 7b0b4f562d get isolated execution at the point its needed
* Instead of passing around the isolated host that the task is to
execute on; grab the isolated execution host from the instance further
down the call stack. Without passing the isolated hostname around.
2018-06-04 10:06:59 -04:00
chris meyers b94cf379f6 do not choose offline instances 2018-06-04 10:06:59 -04:00
chris meyers 9d732cdbdf update unit and functional tests 2018-06-04 10:06:59 -04:00
chris meyers 9863fe71dc do not require privileged iso container
* The init call w/ privileged was causing my laptop to wig out. This
changeset still functions w/ out requiring privileged access.
2018-06-04 10:06:59 -04:00
chris meyers 8d352a4edf conform isolated system to new early node choice
* Randomly chose an instance in the controller instance group for which
to control the isolated node run. Note the chosen instance via a job
controller_node field
2018-06-04 10:06:59 -04:00
chris meyers e720fe5dd0 decide the node a job will run early
* Deciding the Instance that a Job runs on at celery task run-time makes
it hard to evenly distribute tasks among Instnaces. Instead, the task
manager will look at the world of running jobs and choose an instance
node to run on; applying a deterministic job distribution algo.
2018-06-04 10:06:59 -04:00
chris meyers 4da68564ef do not cache dependency_list
* This is probably causing some bug. Calls to start_task within the same
run of the task manager could result in previous dependency lists being
used.
2018-05-29 10:27:51 -04:00
chris meyers 4031c888de fork process may finish before cancel callback
* The "should we cancel?" callback check is only called while the
subprocess (child) is alive. If the child executes quickly, the cancel
callback has no chance to run.
* call a subprocess that takes longer to run like sleep 2
2018-05-17 14:39:57 -04:00
chris meyers d8615df47f postgres back tests can't do this 2018-05-17 14:39:57 -04:00
chris meyers 88bb98c967 flake8 2018-05-17 13:38:37 -04:00
chris meyers 40ef30a914 reduce chance of collision on cache namespace 2018-05-17 13:37:04 -04:00
chris meyers 04767641af isolate cache 2018-05-17 12:58:11 -04:00
chris meyers 97ab6449b9 parallelize test running 2018-05-16 14:29:15 -04:00
chris meyers ceedc135b2 add variables to inventory mentioned in docs
* Also better error message when openshift cert failure
2018-05-15 14:44:43 -04:00
chris meyers 4761e17566 disabled instance stay subscribed to bcast queue
* A disabled node needs to stay subscribed to the broadcast queue
because the work to re-subscribe the node to queues when the node is
re-enabled is done over the broadcast queue.
2018-05-09 17:03:26 -04:00
chris meyers 5668d215fd better cluster membership policy log messages 2018-05-03 11:44:46 -04:00
chris meyers 9f745dd3b8 control celery routes using celery router
* Each time a route is needed (i.e. when a task is sumitted to celery).
The router will be queried. This is ideal. With the previous method we
had to consider how a change in the routes would propogate to all celery
workers and nodes.

* fully describe the default awx queue
* Our dynamic queue registration would correct awx_private_queue.
However, we don't want celery to even create an "invalid"/extra
queue-exchange-route. This change makes sure we don't create extranious
things in rabbitmq.

* reduce the cluster queue registration output. Only output when the
queue registration list changes.
2018-05-02 12:57:36 -04:00
chris meyers 38885580b4 only require the name field when creating instance group 2018-05-02 12:32:08 -04:00
chris meyers 202ddae813 make tower instance group name field read-only 2018-05-01 13:31:24 -04:00
chris meyers 648d9165ff broadcast queues get a per-node stable queue name
* Using Kombu's default Broadcast() constructor requires only 1
parameter. That parameter defines the exchange name and the queue name
is randomly generated per-node.
* This caused problems if/when celery enters an infinite restart loop
because too many rabbit queues get created and rabbit OOM's
(gracefully).
* To remedy this we tell Broadcast the queue name to use, which is
derived from some constant + the node name so that the per-node queue
name is stable.
2018-05-01 13:09:10 -04:00
chris meyers 14c6265b27 ensure instance policy percentages round up 2018-04-25 10:11:40 -04:00
chris meyers 619ec905b2 policy fields not required
* They were previously not required until a min/max was enforced. This
caused the fields to, unintentionally, be required.
* This fix makes the policy fields not required and provides sane defaults.
2018-04-24 14:05:38 -04:00
chris meyers a56771c8f0 send all tower work to a user-hidden queue
* Before, we had a special group, tower, that ran any async work that
tower needed done. This allowed users fine grain control over which
nodes did background work. However, this granularity was too complicated
for users. So now, all tower system work goes to a special non-user
exposed celery queue. Tower remains the fallback instance group to
execute jobs on. The tower group will be created upon install and
protected from deletion.
2018-04-20 13:04:36 -04:00
chris meyers 09d5645b90 redact project update urls when downloading stdout
* For ProjectUpdate jobs. Redact potentially sensitive urls from the
output.
2018-04-18 16:45:55 -04:00
chris meyers 04693ecb0f remove infinite loop regex
* Fancy url finding regex can result in infinite loop for malformed ipv6
urls so replace it with a more nieve regex that can overmatch.
* regex's that find malformed ipv6 urls will be passed to urlparse. This
can result in a parsing/ValueError. For these cases we redact the entire
found URI.
2018-04-13 15:48:06 -04:00
chris meyers 00cd6cb384 set better defaults for ldap
* LDAP params is a new field. It contains the kwargs that will be passed
to the python class specified by group type. The default for group type
is MemberDNGroupType. The required params are now those in the defaults.
2018-04-10 15:44:08 -04:00
chris meyers bd7d9db1ce correctly cascade set null
* It's problematic to delete an instance that is referenced by a foreign
key; where the referening model is one that has a Polymorphic parent.
* Specifically, when Django goes to nullify the relationship it relies
on the related instances[0] class type to issue a query to decide what
to nullify. So if the foreignkey references multiple different types
(i.e. ProjectUpdate, Job) then only 1 of those class types will get
nullified. The end result is an IntegrityError when delete() is called.
* This changeset ensures that the parent Polymorphic class is queried so
that all the foreignkey entries are nullified
* Also remove old Django "hack" that doesn't work with Django 1.11
2018-04-06 11:10:16 -04:00
chris meyers 88fbb6706f use non-deprecated way of setting many2many 2018-04-03 14:31:37 -04:00
chris meyers c3100afd0e fixed isolated instance query
* Was considering an isolated instance: any instance that has at least 1
group with no controller. This is technically correct since an iso node
can not be a part of a non-iso group.
* The query is now more robust and considers a node an iso node if ALL
groups that a node belong to ALL have a controller.
* Also added better debugging for the special tower instance group
* Added a check for the existance of the special tower group so that
logs are less "messy" during the install process.
2018-04-03 13:50:57 -04:00
chris meyers e5dcfda1fe append registered hostname to policy list
* The Instance Group list of instances was getting over-written with
every call to the register_instance management command.
* This changeset appends --hostnames to the Instance Group policy list.
2018-04-02 16:26:59 -04:00
chris meyers 557637afcb better unicode handling 2018-04-02 12:05:16 -04:00
chris meyers 7e7ff8137d more gracefully account for undefined stdout
* It's possible to have an exception raised in BaseTask.run() before the
stdout handler gets defined. This is problematic when the exception
handler tries to access that undefined var .. causing another exception.
Note that the second exception is caught also but it's not desirable to
lose the first exception.
* This fix checks to see if the stdout handler var is defined before
calling it's methods. Thus, we retain the original error message.
2018-04-02 11:41:30 -04:00
chris meyers 838b723c73 add all instances to special tower instance group
* All instances except isolated instances
* Also, prevent any tower attributes from being modified via the API
2018-03-29 16:47:52 -04:00
chris meyers bf6412ea06 fix api browser endpoint name
* Endpoint exposes all jobs associated with an Instance. This is what we
want. Align the endpoint description with this behavior by removing the
word running.
2018-03-28 16:24:19 -04:00
chris meyers 8438331563 make jobs_running more rich in OPTIONS
* Expose jobs_running as an IntegerField
2018-03-28 16:01:24 -04:00
chris meyers eef6f7ecb0 delay looking up settings SYSTEM_UUID 2018-03-28 09:54:51 -04:00
chris meyers dc46a732bc fix ldap group type params label
* copy pasted ldap group type label and did no previously update. This
updates.
2018-03-28 09:12:06 -04:00
chris meyers 7ce8907b7b reregister node when they come back online
* Nodes are marked offline, then deleted; given enough time. Nodes can
come back for various reasions (i.e. netsplit). When they come back,
have them recreate the node Instance if AWX_AUTO_DEPROVISION_INSTANCES
is True. Otherwise, do nothing. The do nothing case will show up in the
logs as celery job tracebacks as they fail to be self aware.
2018-03-27 14:30:47 -04:00
chris meyers 1503e0505e call celery method with celery context
* Tracebacks are more informative this way.
2018-03-26 12:02:42 -04:00
chris meyers b9b8502738 introspect ldap group types for param validation
* Instead of keeping a hard-coded mapping of valid args for each ldap
group type; introspect the subclass to determine valid/invalid fields
2018-03-26 11:40:49 -04:00
chris meyers cb7e17885f remove uneeded auth ldap settings
* I had thought that setting the settings was required. But carefully
selected defaults for the settings is the correct way to deal with
errors I was seeing early in developing this feature.
2018-03-23 15:41:08 -04:00
chris meyers 305ef6fa7e do not allow tower group delete or name change
* DO allow policy changes and other attribute changes
2018-03-22 08:05:06 -04:00
chris meyers e0803b9f08 use non-unicode queue names
* Use unicode InstanceGroup and queue names up until the point we
actually create the queue
* kombu add_consumers returns a dict with a value that contians the
passed in queue name. Trouble is, the returned dict value is a string
and not a unicode string and this results in an error.
2018-03-21 16:50:07 -04:00
chris meyers 91bfed3d50 handle instance group names unicode 2018-03-21 13:41:48 -04:00
chris meyers 1c578cdd74 validate group type params 2018-03-21 09:13:08 -04:00
chris meyers 17795f82e8 more parameters 2018-03-21 09:13:08 -04:00
chris meyers e3c362956d add ldap group type like posixGroupType
* Adds pattern to easy add django-auth-ldap group types classes and to
pass parameters via AUTH_LDAP_GROUP_TYPE_PARAMS
* Adds new group type PosixUIDGroupType that accepts the attribute,
ldap_group_user_attr, on which to search for the user(s) in the group.
2018-03-21 09:13:08 -04:00
chris meyers 1f7506e982 prevent tower group delete and update
* related to https://github.com/ansible/ansible-tower/issues/7931
* The Tower Instance group is special. It should always exist, so
prevent any delete to it.
* Only allow super users to associate/disassociate instances the 'tower'
instance group.
* Do not allow fields of tower instance group to be changed.
2018-03-15 15:23:06 -04:00
chris meyers 5d5d8152c5 prevent instance group delete if running jobs
* related to https://github.com/ansible/ansible-tower/issues/7936
2018-03-15 14:25:49 -04:00
chris meyers 2ea0b31e2b handle unicode things in task logger
Related to https://github.com/ansible/ansible-tower/issues/7957

* Problem presented itself as Instances falling out of Instance Groups.
This was due to the cluster membership policy decider erroring out on a
logger message with unicode.
* Fixed up potential other unicode logger unicode issues in tasks.py
2018-03-15 14:04:39 -04:00
chris meyers a4859a929c autoscale celery up to 50 workers 2018-03-12 15:36:15 -04:00
chris meyers e2ed1542e6 more celery rollback
* Setting reload code calls a celery 4.x method signature. This changes
it back to a 3.x safe call.
2018-03-09 09:27:09 -05:00
chris meyers ccfb6d64bf handle 404 returned by resolve()
* related to https://github.com/ansible/ansible-tower/issues/7926
* if 404 on url in migration loading middelware, do NOT short circuit
middleware. Simply call the normal middlware code path in this case.
2018-03-05 14:34:53 -05:00
chris meyers 36d59651af inherit rather than monkey patch
* Enable migration in progress page in ALL environments
2018-03-02 12:37:48 -05:00
chris meyers 746a2c1eea short-circuit middleware if migration loading url
* Had to monkey patch django middleware logic.
* Left checks to tell coders to use new middleware behavior in favor of
monkey patching.
2018-03-02 11:21:26 -05:00
chris meyers 17de084d04 perform the min needed DB ops to offline a node
* Don't do an extra save to the DB that could conflict with another
heartbeat when it isn't needed since we will be deleting the node
anyway.
2018-03-02 07:57:59 -05:00
chris meyers b69315f2eb fix up the config map watcher script
* invoke main() in config watcher script
* correctly call hash update by passing the filename
2018-03-01 17:06:07 -05:00
chris meyers a3a618d733 call node init procedures as early as possible
* invoke the first heartbeat as early as possible. Results in a much
better user experience where when a user scales up an awx node, the node
appears with capacity earlier.
2018-03-01 17:05:58 -05:00
chris meyers 5c647c2a0d call node init procedures as early as possible
* invoke the first heartbeat as early as possible. Results in a much
better user experience where when a user scales up an awx node, the node
appears with capacity earlier.
2018-03-01 11:24:45 -05:00
chris meyers e94bd128b8 reap all nodes that havn't checked in
* Before this change we would exclude the reaping of new nodes. With
this change, new nodes will be considered for reaping just like old
nodes.
2018-03-01 11:21:54 -05:00
chris meyers 9436e8ae25 dynamically set rabbitmq cookie 2018-03-01 09:23:45 -05:00
chris meyers 6606a29f57 celery 4.x -> 3.x change route config name 2018-02-27 14:13:05 -05:00
chris meyers 148baf7674 add explicit awx_celery container version 2018-02-27 11:37:10 -05:00
chris meyers 5918fa5573 remove () from postgres port value
* awx task container uses postgres port to wait for postgres to become
available before the container init continues. The () are problematic
and are removed.
* () was originally added to fix an openshift issues. That error does
NOT occur with this fix.
2018-02-27 11:36:55 -05:00
chris meyers e4470aa4cf remove uneeded celery configs
* Celery routes and queues are set and defined at runtime. Thus, a
static definition of routes and queues is not needed.
2018-02-27 11:36:55 -05:00
chris meyers fe05b4c0d5 use celery 3.x BROKER_URL
* Celery 4.x specifies the broker via CELERY_BROKER_URL. Since we are
now on 3.x, use 3.x way of specifying the broker via BROKER_URL
2018-02-27 11:36:55 -05:00
Chris Meyers aaf87c0c04 xss test for per-host recent jobs popup 2018-02-06 10:37:00 -05:00
Chris Meyers 0e97dc4b84 Beat and celery clustering fixes
* use embedded beat rather than standalone
* dynamically set celeryd hostname at runtime
* add embeded beat flag to celery startup
* Embedded beat mode routes will piggyback off of celery worker setup
signal
2018-02-01 16:47:33 -05:00