Convert tower_role to no longer use tower-cli

This commit is contained in:
AlanCoding
2020-03-20 21:16:09 -04:00
parent 5263d5aced
commit 27948aa4e1
3 changed files with 120 additions and 67 deletions

View File

@@ -190,6 +190,15 @@ class TowerModule(AnsibleModule):
else:
setattr(self, honorred_setting, config_data[honorred_setting])
@staticmethod
def param_to_endpoint(name):
exceptions = {
'inventory': 'inventories',
'target_team': 'teams',
'workflow': 'workflow_job_templates'
}
return exceptions.get(name, '{0}s'.format(name))
def head_endpoint(self, endpoint, *args, **kwargs):
return self.make_request('HEAD', endpoint, **kwargs)