Commit Graph

33 Commits

Author SHA1 Message Date
Ryan Petrello
1eeffe4ae2 remove awx-manage migrate_to_database_settings 2019-01-30 12:23:36 -05:00
Ryan Petrello
f223df303f convert py2 -> py3 2019-01-15 14:09:01 -05:00
Ryan Petrello
32c14d6eab catch _all_ types of django.db.utils.Error on CTinT key lookups 2019-01-11 08:49:47 -05:00
Ryan Petrello
6e4f3efc4b silence the noisy error that's printed w/ awx-manage check_migrations 2018-10-16 13:48:03 -04:00
Ryan Petrello
6ff1fe8548 allow users to specify BROKER_URL with passwords that contain : and @ 2018-10-16 11:56:57 -04:00
AlanCoding
4e6fd59180 Handle broken transactions in DB settings getattr
This expands the role of the log database error context manager
and will actually make itself an exception to the standard
ORM behavior of raising an error when any queries are executed
inside of a broken transaction.

In this particular case it is less risky to continue on
with a database query and push the data to memcache than
it would be to use default settings values in violation of
user's intent. (hopefully)
2018-05-30 09:00:03 -04:00
AlanCoding
bbfabd2779 include full stack trace for DB settings error 2018-05-09 11:37:40 -04:00
AlanCoding
e099c455d2 do not check for migration version if not migrating 2018-05-07 08:56:24 -04:00
chris meyers
1c578cdd74 validate group type params 2018-03-21 09:13:08 -04:00
cclauss
e18838a4b7 Modernize Python 2 code to get ready for Python 3 2018-02-08 17:26:22 +01:00
AlanCoding
0bb9c58e25 cache the global settings list, cProfile speedup 2017-12-14 11:29:30 -05:00
Ryan Petrello
f887aaa71f Merge pull request #637 from ryanpetrello/fix-django-settings-bug
undo an optimization in django.conf.settings that breaks awx settings
2017-11-14 11:56:24 -05:00
Ryan Petrello
38f893c124 undo an optimization in django.conf.settings that breaks awx settings 2017-11-14 11:03:50 -05:00
AlanCoding
90f63774f4 flake8: comply with new E722 rule 2017-10-23 14:36:48 -04:00
AlanCoding
5cc5d4deff allow cache storing of non-DB settings 2017-08-25 13:59:31 -04:00
Ryan Petrello
0b68ad9b10 properly sanitize conf.settings debug logs
cache.set() and cache.get() arguments are logged when the log level is
DEBUG; this _may_ include plaintext secrets; strip sensitive values
before logging them

see: https://github.com/ansible/ansible-tower/issues/7476
2017-08-21 10:23:39 -04:00
AlanCoding
9254bcaf16 Make cache compatible with encrypted settings
This saves the id value of the setting into the cache
if the setting is encrypted. That can then be combined
with the secret_key in order to decrypt the setting,
without having to make an additional query to the database.
2017-08-17 17:18:41 -04:00
Ryan Petrello
b34adcb10d add special case read-only support for isolated public/private keys
We recently made AWX_ISOLATED_PRIVATE_KEY and AWX_ISOLATED_PUBLIC_KEY
read-only so that they're not inadvertently modified and/or deleted
(which would cause isolated task execution to break).  Tower's notion of
a read-only setting, though, is really more like "hard-coded in a .py
file".  What we really need is support for settings that are not
user configurable/changeable, but that we still want to display to users
from the DB.

In leiu of a complicated change to `awx.conf.settings`, this change
provides special support to these two settings so they behave in the
manner we expect.

see: https://github.com/ansible/ansible-tower/issues/7375
2017-08-03 16:41:23 -04:00
Wayne Witzel III
bd52e4bb22 allow conf.settings to fallback to old encryption methods so settings work during migrations 2017-06-20 10:38:34 -04:00
Wayne Witzel III
b5d61c3c53 Relocate encryption helpers, update settings, tests, and imports 2017-06-12 09:54:12 -04:00
AlanCoding
87af8f7a38 add method to obtain the migration state of Tower 2017-02-20 13:17:21 -05:00
Ryan Petrello
64a973ae02 work around a unicode handling bug in python-memcached that affects py2
see: https://github.com/linsomniac/python-memcached/issues/79
see: #5276
2017-02-13 16:09:31 -05:00
Bill Nottingham
5943193b78 Move the warnings on settings-in-conf-files to 'debug'.
As we write the pendo settings on install, this becomes fairly noisy in practice if we use 'warning'.
2017-02-03 12:02:10 -05:00
Ryan Petrello
afc0f16e58 add a field to OPTIONS that tells if the setting came from a .py file
additionally, update help_text with a helpful message about this

See: #4876
2017-02-02 12:47:53 -05:00
Ryan Petrello
557bc8006d automatically encrypt/decrypt CTinT settings that are stored in memcached
addresses #4246
2017-02-01 12:53:10 -05:00
Ryan Petrello
d6857cf65a add some more inline comments and minor refactoring to awx.conf 2017-01-30 12:37:17 -05:00
Ryan Petrello
836ca21b7e add unit tests for awx.conf 2017-01-30 12:37:11 -05:00
Matthew Jones
abdd91bd1f Fixes for data corruption/exception in cache usage
Specifically as it relates to serializers and job event writing at
high speeds
2017-01-23 14:39:03 -05:00
Chris Church
092c2be0e7 Make any settings read-only that have been modified in custom Python config files. 2016-12-14 16:57:32 -05:00
Chris Church
6a02ca1de0 Add support for encrypting settings that are passwords. 2016-11-30 11:22:39 -05:00
Chris Church
8dc5e7725c Fix configure Tower in Tower to work with updated django-jsonfield. 2016-11-15 00:22:55 -05:00
Chris Church
2488e1e3f0 Show actual settings module in use. 2016-10-12 13:40:05 -04:00
Chris Church
6ebe45b1bd Configure Tower in Tower:
* Add separate Django app for configuration: awx.conf.
* Migrate from existing main.TowerSettings model to conf.Setting.
* Add settings wrapper to allow get/set/del via django.conf.settings.
* Update existing references to tower_settings to use django.conf.settings.
* Add a settings registry to allow for each Django app to register configurable settings.
* Support setting validation and conversion using Django REST Framework fields.
* Add /api/v1/settings/ to display a list of setting categories.
* Add /api/v1/settings/<slug>/ to display all settings in a category as a single object.
* Allow PUT/PATCH to update setting singleton, DELETE to reset to defaults.
* Add "all" category to display all settings across categories.
* Add "changed" category to display only settings configured in the database.
* Support per-user settings via "user" category (/api/v1/settings/user/).
* Support defaults for user settings via "user-defaults" category (/api/v1/settings/user-defaults/).
* Update serializer metadata to support category, category_slug and placeholder on OPTIONS responses.
* Update serializer metadata to handle child fields of a list/dict.
* Hide raw data form in browsable API for OPTIONS and DELETE.
* Combine existing licensing code into single "TaskEnhancer" class.
* Move license helper functions from awx.api.license into awx.conf.license.
* Update /api/v1/config/ to read/verify/update license using TaskEnhancer and settings wrapper.
* Add support for caching settings accessed via settings wrapper.
* Invalidate cached settings when Setting model changes or is deleted.
* Preload all database settings into cache on first access via settings wrapper.
* Add support for read-only settings than can update their value depending on other settings.
* Use setting_changed signal whenever a setting changes.
* Register configurable authentication, jobs, system and ui settings.
* Register configurable LDAP, RADIUS and social auth settings.
* Add custom fields and validators for URL, LDAP, RADIUS and social auth settings.
* Rewrite existing validator for Credential ssh_private_key to support validating private keys, certs or combinations of both.
* Get all unit/functional tests working with above changes.
* Add "migrate_to_database_settings" command to determine settings to be migrated into the database and comment them out when set in Python settings files.
* Add support for migrating license key from file to database.
* Remove database-configuable settings from local_settings.py example files.
* Update setup role to no longer install files for database-configurable settings.

f 94ff6ee More settings work.
f af4c4e0 Even more db settings stuff.
f 96ea9c0 More settings, attempt at singleton serializer for settings.
f 937c760 More work on singleton/category views in API, add code to comment out settings in Python files, work on command to migrate settings to database.
f 425b0d3 Minor fixes for sprint demo.
f ea402a4 Add support for read-only settings, cleanup license engine, get license support working with DB settings.
f ec289e4 Rename migration, minor fixmes, update setup role.
f 603640b Rewrite key/cert validator, finish adding social auth fields, hook up signals for setting_changed, use None to imply a setting is not set.
f 67d1b5a Get functional/unit tests passing.
f 2919b62 Flake8 fixes.
f e62f421 Add redbaron to requirements, get file to database migration working (except for license).
f c564508 Add support for migrating license file.
f 982f767 Add support for regex in social map fields.
2016-09-26 22:14:47 -04:00