Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.80 KB | None | 0 0
  1. def main():
  2.     argument_spec = nexus_get_argument_spec()
  3.     argument_spec.update(
  4.         url_username=dict(type='str', aliases=['user']),
  5.         url_password=dict(type='str', aliases=['password'], no_log=True),
  6.         body=dict(type='raw'),
  7.         body_format=dict(type='str', default='json'),
  8.         src=dict(type='path'),
  9.         method=dict(type='str', default='GET', choices=['GET', 'DELETE', 'POST', 'PUT']),
  10.         return_content=dict(type='bool', default=False),
  11.         status_code=dict(type='list', default=[200, 204]),
  12.         timeout=dict(type='int', default=30),
  13.         headers=dict(type='dict', default={}),
  14.         endpoint_version=dict(type='str', default='v1'),
  15.         blob_info=dict(type='dict', options=dict(
  16.             softQuotaEnabled=dict(type='bool', default='False'),
  17.             softQuotaType=dict(type='str', choices=['Space-Remaining', 'Space-Used']),
  18.             softQuotaLimit=dict(type='int'),
  19.             name=dict(type='str'),
  20.             path=dict(type='str')
  21.         ))
  22.     )
  23.  
  24.     module = AnsibleModule(
  25.         argument_spec=argument_spec,
  26.         add_file_common_args=True,
  27.         mutually_exclusive=[['body', 'src']],
  28.     )
  29.  
  30.     base_url = module.params['url']
  31.     endpoint = module.params['endpoint_version'].lower()
  32.     body = module.params['body']
  33.     body_format = module.params['body_format'].lower()
  34.     method = module.params['method'].upper()
  35.     return_content = module.params['return_content']
  36.     status_code = [int(x) for x in list(module.params['status_code'])]
  37.     blob = module.params['blob_info']
  38. #    blobstore_name = module.params['blob_info']['name']
  39. #    blobID = module.params['blob_info']['path']
  40.     socket_timeout = 30
  41.  
  42.     dict_headers = module.params['headers']
  43.  
  44.     url = build_URL(base_url, endpoint, blob['name'], blob['path'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement