mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 01:28:09 -03:30
remove /api/v1 and deprecated credential fields
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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).
|
||||
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user