remove /api/v1 and deprecated credential fields

This commit is contained in:
Ryan Petrello
2019-03-12 17:12:16 -04:00
parent 176f8632e5
commit 6da445f7c0
43 changed files with 271 additions and 2211 deletions

View File

@@ -332,7 +332,7 @@ def make_the_data():
name='%s Credential %d User %d' % (prefix, credential_id, user_idx),
defaults=dict(created_by=next(creator_gen),
modified_by=next(modifier_gen)),
credential_type=CredentialType.from_v1_kind('ssh')
credential_type=CredentialType.objects.filter(namespace='ssh').first()
)
credential.admin_role.members.add(user)
credentials.append(credential)
@@ -355,7 +355,7 @@ def make_the_data():
name='%s Credential %d team %d' % (prefix, credential_id, team_idx),
defaults=dict(created_by=next(creator_gen),
modified_by=next(modifier_gen)),
credential_type=CredentialType.from_v1_kind('ssh')
credential_type=CredentialType.objects.filter(namespace='ssh').first()
)
credential.admin_role.parents.add(team.member_role)
credentials.append(credential)

View File

@@ -3,7 +3,7 @@ docker run --name awx_test -it --memory="4g" --cpuset="0,1" -v /Users/meyers/ans
## How to use the logstash container
POST the following content to `/api/v1/settings/logging/` (this uses
POST the following content to `/api/v2/settings/logging/` (this uses
authentication set up inside of the logstash configuration file).
```

View File

@@ -95,7 +95,7 @@ and
}
```
These can be entered via Configure-Tower-in-Tower by making a POST to
`/api/v1/settings/logging/`.
`/api/v2/settings/logging/`.
### Connecting Logstash to 3rd Party Receivers

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env python
import datetime
import getpass
import json
import urllib2
REST_API_URL = "http://awx.example.com/api/v1/"
REST_API_USER = "admin"
REST_API_PASS = "password"
JOB_TEMPLATE_ID = 1
# Setup urllib2 for basic password authentication.
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(None, REST_API_URL, REST_API_USER, REST_API_PASS)
handler = urllib2.HTTPBasicAuthHandler(password_mgr)
opener = urllib2.build_opener(handler)
urllib2.install_opener(opener)
# Read the job template.
JOB_TEMPLATE_URL="%sjob_templates/%d/" % (REST_API_URL, JOB_TEMPLATE_ID)
response = urllib2.urlopen(JOB_TEMPLATE_URL)
data = json.loads(response.read())
# Update data if needed for the new job.
data.pop('id')
data.update({
'name': 'my new job started at %s' % str(datetime.datetime.now()),
'verbosity': 3,
})
# Create a new job based on the template and data.
JOB_TEMPLATE_JOBS_URL="%sjobs/" % JOB_TEMPLATE_URL
request = urllib2.Request(JOB_TEMPLATE_JOBS_URL, json.dumps(data),
{'Content-type': 'application/json'})
response = urllib2.urlopen(request)
data = json.loads(response.read())
# Get the job ID and check for passwords needed to start the job.
JOB_ID = data['id']
JOB_START_URL = '%sjobs/%d/start/' % (REST_API_URL, JOB_ID)
response = urllib2.urlopen(JOB_START_URL)
data = json.loads(response.read())
# Prompt for any passwords needed.
start_data = {}
for password in data.get('passwords_needed_to_start', []):
value = getpass.getpass('%s: ' % password)
start_data[password] = value
# Make POST request to start the job.
request = urllib2.Request(JOB_START_URL, json.dumps(start_data),
{'Content-type': 'application/json'})
response = urllib2.urlopen(request)