mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Removed explicitly calling of python json module
This commit is contained in:
committed by
Ryan Petrello
parent
18752a637f
commit
cccd021d8b
@@ -3,7 +3,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
import requests
|
import requests
|
||||||
import base64
|
import base64
|
||||||
import json
|
|
||||||
pas_inputs = {
|
pas_inputs = {
|
||||||
'fields': [{
|
'fields': [{
|
||||||
'id': 'url',
|
'id': 'url',
|
||||||
@@ -65,14 +64,13 @@ def get_ID(**kwargs):
|
|||||||
endpoint = urljoin(kwargs['url'],'/Redrock/query')
|
endpoint = urljoin(kwargs['url'],'/Redrock/query')
|
||||||
name=" Name='{0}' and User='{1}'".format(kwargs['system_name'],kwargs['acc_name'])
|
name=" Name='{0}' and User='{1}'".format(kwargs['system_name'],kwargs['acc_name'])
|
||||||
query = 'Select ID from VaultAccount where {0}'.format(name)
|
query = 'Select ID from VaultAccount where {0}'.format(name)
|
||||||
post_data = json.dumps({'Script': query})
|
|
||||||
post_headers = {
|
post_headers = {
|
||||||
"Authorization": "Bearer " + kwargs['access_token'],
|
"Authorization": "Bearer " + kwargs['access_token'],
|
||||||
"X-CENTRIFY-NATIVE-CLIENT":"true"
|
"X-CENTRIFY-NATIVE-CLIENT":"true"
|
||||||
}
|
}
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
endpoint,
|
endpoint,
|
||||||
data = post_data,
|
json = {'Script': query},
|
||||||
headers = post_headers,
|
headers = post_headers,
|
||||||
timeout = (5, 30)
|
timeout = (5, 30)
|
||||||
)
|
)
|
||||||
@@ -87,14 +85,13 @@ def get_ID(**kwargs):
|
|||||||
# CheckOut Password from Centrify Vault, Input : ID
|
# CheckOut Password from Centrify Vault, Input : ID
|
||||||
def get_passwd(**kwargs):
|
def get_passwd(**kwargs):
|
||||||
endpoint = urljoin(kwargs['url'],'/ServerManage/CheckoutPassword')
|
endpoint = urljoin(kwargs['url'],'/ServerManage/CheckoutPassword')
|
||||||
post_data = json.dumps({'ID': kwargs['acc_id']})
|
|
||||||
post_headers = {
|
post_headers = {
|
||||||
"Authorization": "Bearer " + kwargs['access_token'],
|
"Authorization": "Bearer " + kwargs['access_token'],
|
||||||
"X-CENTRIFY-NATIVE-CLIENT":"true"
|
"X-CENTRIFY-NATIVE-CLIENT":"true"
|
||||||
}
|
}
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
endpoint,
|
endpoint,
|
||||||
data = post_data,
|
json = {'ID': kwargs['acc_id']},
|
||||||
headers = post_headers,
|
headers = post_headers,
|
||||||
timeout = (5, 30)
|
timeout = (5, 30)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user