Commit Graph
100 Commits
Author SHA1 Message Date
Jeff Bradberry ee1d118752 Add the webhook receiver url to the related urls in the serializers 2019-09-30 13:32:20 -04:00
Jeff Bradberry 245931f603 Debounce when multiple copies of the same webhook event come in 2019-09-30 13:26:04 -04:00
Jeff Bradberry 095aa77857 Create a new model mixin for Job and WorkflowJob webhook fields 2019-09-30 13:26:04 -04:00
Jeff Bradberry bb1397a3d4 Validate the webhook credential
- we should allow a null credential, so that the admin can choose to configure not posting back status changes of the triggered job
- the credential must be of the new 'token' kind
- if we do configure a credential, its type must match the selected SCM service
2019-09-30 13:26:04 -04:00
Jeff Bradberry 5848f0360a Update test_default_cred_types to include the new personal access token types 2019-09-30 13:26:04 -04:00
Jeff Bradberry 83fc2187cc Fix the summary fields for webhook_credential 2019-09-30 13:26:04 -04:00
Jeff Bradberry 4dba9916dc Add a new set of personal access token credential types 2019-09-30 13:26:03 -04:00
Jeff Bradberry 8836ed44ce Construct an ID for Gitlab webhooks
by taking the SHA1 of the body of the webhook request.
2019-09-30 13:26:03 -04:00
Jeff Bradberry 992c414737 Launch a Job or WorkflowJob based on the incoming webhook 2019-09-30 13:26:03 -04:00
Jeff Bradberry 66a8186995 Get the webhook receiver views to work at least minimally 2019-09-30 13:26:03 -04:00
Jeff Bradberry fa15696ffe Remove some dead comments 2019-09-30 13:26:03 -04:00
Jeff Bradberry 82a0dc0024 Cycle or unset the webhook key if the webhook service changes
Also, tests.
2019-09-30 13:26:03 -04:00
Jeff Bradberry d4b20b7340 Update tests to use the expect keyword argument for get() and post() 2019-09-30 13:26:03 -04:00
Jeff Bradberry c0ad5a7768 Expose the webhook_service and webhook_credential fields in the serializer
webhook_credential specifically as a summary field.
2019-09-30 13:26:03 -04:00
Jeff Bradberry d9ac291115 Add some RBAC oriented tests for the webhook secret key view 2019-09-30 13:26:03 -04:00
Jeff Bradberry 6b86cf6e86 Revert to using the explicit dispatch to the appropriate model
since passing the model class at url include time doesn't work.
2019-09-30 13:26:03 -04:00
Jeff Bradberry 771ef275d4 Include a check for the webhook_key related resource url
in the tests for JTs and WFJTs.
2019-09-30 13:26:03 -04:00
Jeff Bradberry 2310413dc0 Fix problem with the tests by dynamically setting the view model
instead of using a model @property or lookup method.
2019-09-30 13:26:03 -04:00
Jeff Bradberry edb9d6b16c Add the related link to the webhook secrets view to the serializers 2019-09-30 13:26:03 -04:00
Jeff Bradberry 7973a18103 Switch to using a permission class for the webhook secret key view
This view is now behaving as expected for superuser, org admin, JT
admin, JT exec, and org member roles.
2019-09-30 13:23:27 -04:00
Jeff Bradberry 747a2283d6 Attempt to get the RBAC right on the webhook secret key view 2019-09-30 13:23:27 -04:00
Jeff Bradberry 9d269d59d6 Add an api view for obtaining and rotating the webhook key 2019-09-30 13:23:27 -04:00
Jeff Bradberry b0c530402f Move the webhook url include from the top level urlconf to the JT/WFJT urlconfs 2019-09-30 13:23:26 -04:00
Jeff Bradberry 50a54c9214 Forbid access to the webhook receiver views if webhook_key is not set 2019-09-30 13:23:26 -04:00
Jeff Bradberry 8f97dbf781 Hook in the webhook receiver views into the urlconf 2019-09-30 13:23:26 -04:00
Jeff Bradberry a7a99ed141 Beginnings of the API views for the webhook receivers 2019-09-30 13:23:26 -04:00
Jeff Bradberry d6116490c6 Add the webhook-specific fields to JobTemplate and WorkflowJobTemplate 2019-09-30 13:23:26 -04:00
Jeff Bradberry 1a7148dc80 Prevent search on the NotificationTemplate.notification_configuration field 2019-09-26 14:37:04 -04:00
Jeff Bradberry ee27313b42 Change the visibility of the Grant Permission button on the team edit page
In the case where MANAGE_ORGANIZATION_AUTH = False, an Org admin is
still supposed to have the capability of adding resource roles to a
team.  This was in fact still doable directly in the API, or via the
organization edit page.
2019-09-26 11:28:25 -04:00
Jeff Bradberry ed1c667418 Fix asserts in test_project.py to use the id directly off of the job template
test_no_changing_overwrite_behavior_if_used, specifically.
2019-08-20 16:42:34 -04:00
Jeff Bradberry 10200fced0 Add patch to the list of system packages installed into the container
since it is a requirement of the new updater.sh Python requirements script.
2019-08-01 10:41:49 -04:00
Jeff Bradberry 2926d0198d Bump the version of Django to 2.2.4
This is a security release.
2019-08-01 10:41:36 -04:00
Jeff Bradberry d32394f1b6 Update the make clean command to clear out the parallelized sqlite3 files 2019-07-17 17:06:10 -04:00
Jeff Bradberry dd8ca5acc4 Ensure that the Postgres client is installed 2019-07-12 16:22:52 -04:00
Jeff Bradberry 172864a3a1 Force the username and password to be strings under the Radius backend
The base Radius backend encodes them as utf-8 bytes, which causes the
User object that we create to get the repr of the username, including
the b prefix and single quotes, e.g. "b'foo'".
2019-07-12 15:11:22 -04:00
Jeff Bradberry a691340986 Update authenticate method on auth backends to add required request param
This became mandatory in Django 2.1.
2019-07-12 15:11:22 -04:00
Jeff Bradberry 261f1427e9 Break up a too-long line in migrations 2019-07-12 15:11:22 -04:00
Jeff Bradberry 9383512772 Remove no longer needed check for override of WSGIHandler 2019-07-12 15:11:22 -04:00
Jeff Bradberry 2d81923e22 Fix up changes in fields in the migrations
Particularly the now-required on_delete parameter for ForeignKey and
OneToOneField.
2019-07-12 15:11:22 -04:00
Jeff Bradberry 1093a662f1 Fix a problem with a change in results from User.has_usable_password 2019-07-12 15:11:22 -04:00
Jeff Bradberry 210517eeb1 Fix a couple of tests trivially affected by the upgrades
- is_anonymous may no longer be called as a method, so no need to mock it
- the message on uniqueness constraint failures has apparently changed
2019-07-12 15:11:22 -04:00
Jeff Bradberry 2ffe3d9a85 Give the 4xx error handler views the correct positional arguments 2019-07-12 15:11:22 -04:00
Jeff Bradberry 6737bd4c19 Replace {} as field default values with the callable dict 2019-07-12 15:11:22 -04:00
Jeff Bradberry 29ad847544 Deal with a change in truncation of strings in Django
which now uses a proper ellipsis character instead of 3 dots.
2019-07-12 15:11:22 -04:00
Jeff Bradberry b3ef2c928a Remove the custom add and remove methods from OrderedManyToManyDescriptor 2019-07-12 15:11:22 -04:00
Jeff Bradberry 43c552c7c6 Some flake8 changes 2019-07-12 15:11:21 -04:00
Jeff Bradberry e0357d53f5 Bump Django to 2.2.2 2019-07-12 15:11:21 -04:00
Jeff Bradberry beb1dd5ae7 Replace use of the deprecated staticfiles template library with static 2019-07-12 15:11:21 -04:00
Jeff Bradberry d464df557b Fix another direct assignment of a sequence to a related manager 2019-07-12 15:11:21 -04:00
Jeff Bradberry 5e9f790554 Bump to Django 2.1.9 2019-07-12 15:11:21 -04:00
Jeff Bradberry 47b325896d Remove the django_db mark from TransactionTestCase classes
pytest-django's documentation indicates that it isn't necessary, and
it turns out in Django 2.0+ that this double application of the
transaction machinations was causing the Django ContentType table to
lose its items.
2019-07-12 15:11:21 -04:00
Jeff Bradberry c85d58e28d The interactive flag for management commands doesn't seem to be a thing anymore 2019-07-12 15:11:21 -04:00
Jeff Bradberry bcbb768dd3 Remove the use of the deprecated Field.rel attribute
Also, rename a number of variables named `rel` for ease of searching.
2019-07-12 15:11:21 -04:00
Jeff Bradberry e0693d3746 is_anonymous and is_authenticated no longer support being called as methods 2019-07-12 15:11:21 -04:00
Jeff Bradberry a6edc46cc3 Field.from_db_value no longer supports the context param in 2.0 2019-07-12 15:11:21 -04:00
Jeff Bradberry f24b08316d Django's url resolver and pattern classes have been renamed in 2.0+
They are now URLResolver and URLPattern, respectively.  The API has
changed as well, but fortunately it looks like what we are doing here
doesn't depend on anything that was changed.
2019-07-12 15:11:21 -04:00
Jeff Bradberry 25c14382db Update the monkey patch of Django's column name digest to work with 2.0+
BaseDatabaseSchemaEditor no longer has a `_digest` classmethod,
instead there is a call out to a new `names_digest` utility function.
2019-07-12 15:11:21 -04:00
Jeff Bradberry 796d7bf67f Replace the use of the 3rd party jsonbfield library
which was just a backport of Django's built-in JSONField.  Also, bump
the version of django-jsonfield.
2019-07-12 15:11:21 -04:00
Jeff Bradberry ddef41d394 Bump Django to 2.0.13
This is _very_ broken.
2019-07-12 15:11:21 -04:00
Jeff Bradberry 758ad164fe Include defined fields from all parent classes of a HybridDictField
since our settings registry adds a mixin class when doing validation on these.

related #4099
2019-07-08 16:05:03 -04:00
Jeff Bradberry 1a72ff4c47 Use the in operator to test against the Organization membership subquery
If more than one Organization were selected by this subquery, then
Postgres would complain with "more than one row returned by a subquery
used as an expression".  We needed to allow for that case.

Annoyingly SQLite3 doesn't seem to care, so writing a py.test test to
exercise this isn't feasible under our current development setup.
2019-06-19 14:49:02 -04:00
Jeff Bradberry aa548442ce Ensure the request is on the Metadata object
in order to correctly populate the default for the TOWER_URL_BASE
field, which is specific to the host and preferred scheme.
2019-06-12 14:12:59 -04:00
Jeff Bradberry ab587e7e6c Update get_view_description to conform to changes in DRF's version
related encode/django-rest-framework#5605
2019-06-12 14:12:59 -04:00
Jeff Bradberry 3f5c018c8a Replace the load of the staticfiles template library with static
The staticfiles library will be going away before too long.
2019-06-12 14:12:59 -04:00
Jeff Bradberry 12e3d0aebf Remove rest_framework/base.html 2019-06-12 14:12:59 -04:00
Jeff Bradberry ba4ad191fc Add the csrf token to window.drf
In the same manner as the current version of base.html from DRF.  This
is part 2 of the removal of base.html.
2019-06-12 14:12:59 -04:00
Jeff Bradberry 34d76422d6 Move the endpoint deprecation warning out of base.html
This is part 1 of the removal of awx/templates/rest_framework/base.html.
2019-06-12 14:12:59 -04:00
Jeff Bradberry 2a81643308 Refactor the SSO serializer fields to follow the DRF idioms more closely
and fix the tests to handle the newer nested validation checks properly.
2019-06-12 14:12:59 -04:00
Jeff Bradberry 76d4de24df Handle a change in the error message for BooleanField
related encode/django-rest-framework#5881
2019-06-12 14:12:59 -04:00
Jeff Bradberry ed7a7e5f7b Support parse_requirements out of pip < 10 and >= 10 2019-06-12 14:12:59 -04:00
Jeff Bradberry f94959d120 Remove the custom get_view_name function
It appeared to not be doing anything that we were making use of that
couldn't already be done, slightly differently, using DRF's built-in
one.
2019-06-12 14:12:59 -04:00
Jeff Bradberry b5728fc548 Bump Django Rest Framework from 3.7.7 to 3.9.4 2019-06-12 14:12:59 -04:00
Jeff Bradberry 44907b33dc Fix the middleware ordering 2019-05-17 14:40:33 -04:00
Jeff Bradberry 3579584ffc i18n 2019-05-13 11:20:15 -04:00
Jeff Bradberry 05cae23180 Add help text to the ActivityStreamSerializer m2m relationship fields 2019-05-13 11:10:33 -04:00
Jeff Bradberry d6e89092d3 Instead of exposing Role.content_type, create a new serializer field
called `object_type`, which is constructed based on manipulating the
string value of ActivityStream.object_relationship_type.  Since that
field does have the full class name, this manipulation should match
the manipulation that is done to construct the values of object1 and
object2 when ActivityStream is created.
2019-05-10 17:31:33 -04:00
Jeff Bradberry 250484339b Expose the role's content_type field and reorder the objects in the UI
when the resource was stored on ActivityStream as object1 instead of object2.

related #3841
2019-05-10 14:15:05 -04:00
Jeff Bradberry ae25717700 Make the uwsgi autoreloader reload the dispatcher every time
not just the first time uwsgi is brought up.

related #3846
2019-05-08 11:15:54 -04:00
Jeff Bradberry 0b555e938a Fix typo in the Insights inventory url 2019-04-23 09:39:08 -04:00
Jeff Bradberry 6ff539e6ee Update the front-end Insights urls 2019-04-22 14:17:47 -04:00
Jeff Bradberry 49ba6c6b3d Appease flake8 2019-04-22 14:17:47 -04:00
Jeff Bradberry e2861c6c39 Fix the tests to conform to the new Insights results 2019-04-22 14:17:47 -04:00
Jeff Bradberry 6dae4a1d6d Add the host in as a parameter to the _get_insights call 2019-04-22 14:17:47 -04:00
Jeff Bradberry e66f9241a9 Remove the platform_id from the call to _get_insights
since it is now acquired within _get_insights.
2019-04-22 14:17:47 -04:00
Jeff Bradberry 72da961550 Conform to the new output of the Insights system reports endpoint 2019-04-22 14:17:47 -04:00
Jeff Bradberry 4c86c5065c Fix a typo in the per-system remediations api call 2019-04-22 14:17:47 -04:00
Jeff Bradberry 80a855c57a Do some basic slugification of the remediation playbook name 2019-04-22 14:17:47 -04:00
Jeff Bradberry 11b85250e8 Update more urls 2019-04-22 14:17:47 -04:00
Jeff Bradberry 10cfac2f0e Update the error message when we can't discover the platform ID 2019-04-22 14:17:47 -04:00
Jeff Bradberry 355a83441a Guard against the case where Insights fails to find the system ID 2019-04-22 14:17:47 -04:00
Jeff Bradberry e25adca233 Replace the old unit tests with new functional tests 2019-04-22 14:17:47 -04:00
Jeff Bradberry 7c743904b0 Removed some no longer needed imports 2019-04-22 14:17:47 -04:00
Jeff Bradberry a97865de0c Refactor HostInsights
for better reuse of the error handling of the Insights API calls.
2019-04-22 14:17:47 -04:00
Jeff Bradberry 596a5173ce Modify filter_insights_api_response to take in the separate remediations
since it is accumulated via a different API call.
2019-04-22 14:17:47 -04:00
Jeff Bradberry 63209197dd Iterate over the pages of remediations available 2019-04-22 14:17:47 -04:00
Jeff Bradberry af2484cd97 Update the Insights API urls to use the new url structure 2019-04-22 14:17:47 -04:00
Jeff Bradberry f01a936202 Update the test for filter_insights_api_response()
and fix the data nesting issue that it uncovered.
2019-04-22 14:17:47 -04:00
Jeff Bradberry 05f670a6d9 Update the filter_insights_api_response() utility function
in order to conform the output of the new Insights Advisor report
endpoint to our expections.
2019-04-22 14:17:47 -04:00
Jeff Bradberry f4b0910e98 Call out to the Insights API to get the Platform ID for a host
Since the new reports endpoint requires that, rather than the Insights
system ID that we've been using (and storing on the Host model).
2019-04-22 14:17:47 -04:00
Jeff Bradberry 95b17892ee Factor out the response handling boilerplate from HostInsights.get_insights
We'll want to reuse it for the API call to /hosts as well.
2019-04-22 14:17:47 -04:00