35 Commits

Author SHA1 Message Date
Ryan Petrello
12982d6ef6 Merge pull request #6541 from wwitzel3/issue-826
Re-Encrypt all of our existing encrypted fields.
2017-06-13 09:42:56 -04:00
Ryan Petrello
240d629128 fix a bug in ssh key unlock validation
see: #6553
2017-06-12 10:28:38 -04:00
Wayne Witzel III
b5d61c3c53 Relocate encryption helpers, update settings, tests, and imports 2017-06-12 09:54:12 -04:00
Ryan Petrello
28ad576c90 properly validate ssh_key_unlock for Net and SCM credentials
see: #6460
2017-06-09 10:43:04 -04:00
Ryan Petrello
ea0f4ce59d properly validate SSH key data for SCM, Net, GCE, and Azure Classic
see: #6384
2017-06-09 10:39:07 -04:00
Ryan Petrello
a04f666319 Merge pull request #6468 from ryanpetrello/fix-6464
add a boolean `authorize` field for the Network Credential Type
2017-06-09 09:47:39 -04:00
Ryan Petrello
1f41e002a6 Merge pull request #6399 from ryanpetrello/fix-6390
fix a bug in POST /api/v1/credential detection of Vault payloads
2017-06-08 15:40:26 -04:00
Ryan Petrello
ad9fda9a06 add a boolean authorize field for the Network Credential Type
see: #6464
2017-06-06 11:13:10 -04:00
Ryan Petrello
fd4b86349c fix a 500 error in /api/v1/credentials/ backwards compat
see: #6414
2017-06-01 11:26:18 -04:00
Ryan Petrello
71dda544ab fix a bug in /api/v1/credential detection of Vault payloads
see: #6390
2017-06-01 10:18:43 -04:00
Ryan Petrello
e0a629db58 improve error formatting for jsonschema failures on Credential.inputs
this provides error messages keyed by input fields, so that instead of
e.g.,

{
    'inputs': ['Invalid certificate or key: u'XYZ']
}

...you get:

{
    'inputs': {
        'ssh_key_data': ['Invalid certificate or key: u'XYZ']
    }
}

Includes /api/v1/ compatability for error message format.  Requests to
/api/v1/ will get:

{'ssh_key_data': ['Invalid certificate or key: u'XYZ']}
2017-06-01 09:48:42 -04:00
Aaron Tan
cfb633e8a6 Dependency Updates
* Dynamic Inventory Source
Template against ansible 2.3 dynamic inventory sources.
The major change is removal of `rax.py`. Most upstream scripts except
`foreman.py` has quite trivial coding style changes, or minor functional
extensions  that does not affect Tower inventory update runs.
`foreman.py`, on the other hand, went through quite a major refactoring,
but functionalities stay the same.

Major python dependency updates include apache-libcloud (1.3.0 -->
2.0.0), boto (2.45.0 --> 2.46.1) and shade (1.19.0 --> 1.20.0). Minor
python dependency updates include indirect updates via `pip-compile`,
which are determined by base dependencies.

Some minor `task.py` extensions:
 - `.ini` file for ec2 has one more field `stack_filter=False`, which
   reveals changes in `ec2.py`.
 - `.ini` file for cloudforms will catch these four options from
   `source_vars_dict` of inventory update: `'version', 'purge_actions',
   'clean_group_keys', 'nest_tags'`. These four options have always been
   available in `cloudforms.py` but `cloudforms.ini.example` has not
   mentioned them until the latest version. For consistency with upstream
   docs, we should make these fields available for tower user to customize.
 - YAML file of openstack will catch ansible options `use_hostnames`,
   `expand_hostvars` and `fail_on_errors` from `source_vars_dict` of
   inventory update as a response to issue #6075.

* Remove Rackspace support
Supports of Rackspace as both a dynamic inventory source and a cloud
credential are fully removed. Data migrations have been added to support
arbitrary credential types feature and delete rackspace inventory
sources.

Note also requirement `jsonschema` has been moved from
`requirements.txt` to `requirements.in` as a primary dependency to
reflect it's usage in `/main/fields.py`.

Connected issue: #6080.

* `pexpect` major update
`pexpect` stands at the very core of our task system and underwent a
major update from 3.1 to 4.2.1. Although verified during devel, please
still be mindful of any suspicious issues on celery side even after this
PR gets merged.

* Miscellaneous
 - requests now explicitly declared in `requirements.in` at version 2.11.1
   in response to upstream issue
 - celery: 3.1.17 -> 3.1.25
 - django-extensions: 1.7.4 -> 1.7.8
 - django-polymorphic: 0.7.2 -> 1.2
 - django-split-settings: 0.2.2 -> 0.2.5
 - django-taggit: 0.21.3 -> 0.22.1
 - irc: 15.0.4 -> 15.1.1
 - pygerduty: 0.35.1 -> 0.35.2
 - pyOpenSSL: 16.2.0 -> 17.0.0
 - python-saml: 2.2.0 -> 2.2.1
 - redbaron: 0.6.2 -> 0.6.3
 - slackclient: 1.0.2 -> 1.0.5
 - tacacs_plus: 0.1 -> 0.2
 - xmltodict: 0.10.2 -> 0.11.0
 - pip: 8.1.2 -> 9.0.1
 - setuptools: 23.0.0 -> 35.0.2
 - (requirements_ansible.in only)kombu: 3.0.35 -> 3.0.37
2017-05-08 12:03:02 -04:00
Ryan Petrello
a1fa9243bc split machine CredentialType into two distinct (ssh and vault) kinds 2017-05-02 10:26:37 -04:00
Ryan Petrello
83dc4f6757 for /api/v1/ requests, filter out v2 (custom) credentials
see: #5877
2017-04-24 15:21:30 -04:00
Ryan Petrello
ba259e0ad4 Introduce a new CredentialTemplate model
Credentials now have a required CredentialType, which defines inputs
(i.e., username, password) and injectors (i.e., assign the username to
SOME_ENV_VARIABLE at job runtime)

This commit only implements the model changes necessary to support the
new inputs model, and includes code for the credential serializer that
allows backwards-compatible support for /api/v1/credentials/; tasks.py
still needs to be updated to actually respect CredentialType injectors.

This change *will* break the UI for credentials (because it needs to be
updated to use the new v2 endpoint).

see: #5877
see: #5876
see: #5805
2017-04-21 15:42:26 -04:00
Ryan Petrello
95ea370e5e add API versioning for /api/v2/ 2017-03-30 15:11:12 -04:00
Ryan Petrello
f4d4c43d94 prohibit order_by= for sensitive fields
see: #5526
2017-03-10 08:49:59 -05:00
AlanCoding
81cb57be4f remove tests pertaining to credential org related field 2016-12-05 16:17:58 -05:00
Aaron Tan
9e4655419e Fix flake8 E302 errors. 2016-11-15 20:59:39 -05:00
Alan Rominger
43e399df81 Merge pull request #3370 from ansible/AlanCoding-patch-3
test_credential bug fixes
2016-09-13 09:56:43 -04:00
Alan Rominger
5e626cfe2e test_credential bug fixes
Credential detail view was looked up with the organization's primary key. Works fine when the database arbitrarily gives them both pk=1 in a isolated test, but not a great thing to depend on.
2016-08-29 15:54:45 -04:00
AlanCoding
23024c8fad Make sure org admins can see credential after migration, comment updates on related tests
add clause in test to verify automatic setting of org of new team credential
2016-08-24 11:36:07 -04:00
Akita Noek
9c5c09169e Made it so the credential organization field can't be changed
This makes it so the credential organizaiton field can't be changed
through the API (unless the user is a super user). This brings us into
alignment with the original intent.
2016-08-16 15:32:29 -04:00
Akita Noek
30451f230b Fixed org auditor visibility of team credentials
And by fix, I mean prevent us from getting into the situation that was
causing the asymetric visiblity by brining us into alignment with the
original intention and spec for how credentials were supposed behave.

 #3081
2016-08-16 14:02:09 -04:00
Akita Noek
3d218d5fca Revert "Fix to ensure org auditors can see team credentials"
This reverts commit 5dcb0e57d80a3bb0553ca8194890a938257a6e93.

New clarification on what the actual desired behavior of this whole
system means this commit is trash, fixing in a much better way.
2016-08-11 11:00:02 -04:00
Akita Noek
d181aefddf Fix to ensure org auditors can see team credentials
#3081
2016-08-10 16:58:39 -04:00
Chris Church
c2285f1a4c Split up the credential xfail tests. 2016-06-17 11:42:20 -04:00
Wayne Witzel III
358998c4b4 fix api test 2016-06-10 14:17:48 -04:00
Alan Rominger
5fc5f1858a Merge pull request #1801 from AlanCoding/1773_cred_detail_serializer
Purge credential detail view of special fields
2016-05-18 09:54:43 -04:00
AlanCoding
f9c177edd5 More accurate test to check validation of bad data 2016-05-10 10:05:46 -04:00
Wayne Witzel III
963ce41851 fix credential details test 2016-05-06 15:11:28 -04:00
AlanCoding
b1dfa28459 hit the is_valid method before stripping the special fields in credential view 2016-05-05 14:30:39 -04:00
Akita Noek
29b55fa04d Moved access control from credential add view to access.py
as it should have always been. This messes up being able to post to
api/v1/users/:n/credentials and api/v1/teams/:n/credentials without
specifyign the user/team id in the post body, but looking at the old
code it looks like this might have always been the case, so whatevs..

This fixes a old v new access.py test "failure", and is better anyways..
2016-04-29 17:27:14 -04:00
Akita Noek
58ee10aa02 Added organization to Credential summary and related fields
#1400
2016-04-05 20:59:05 -04:00
Akita Noek
da8cd505cf Updated and ported select inventory credential tests to new test system
Also added all the test cases I wrote for the credential api but forgot
to add before the last checking..
2016-04-04 11:05:34 -04:00