Fix bug in DigitalOcean module_util (#36352)

This commit is contained in:
ABond 2018-02-17 21:17:26 -05:00 committed by Abhijeet Kasurde
commit 591695932e
2 changed files with 3 additions and 6 deletions

View file

@ -62,16 +62,15 @@ class DigitalOceanHelper:
def __init__(self, module):
self.module = module
self.baseurl = 'https://api.digitalocean.com/v2'
self.oauth_token = None
self.timeout = module.params.get('timeout', 30)
self.oauth_token = module.params.get('oauth_token')
self.headers = {'Authorization': 'Bearer {0}'.format(self.oauth_token),
'Content-type': 'application/json'}
# Check if api_token is valid or not
response = self.get('account')
if response.status_code == 401:
module.fail_json(msg='Failed to login using API token, please verify validity of API token.')
self.timeout = module.params.get('timeout', 30)
self.module.fail_json(msg='Failed to login using API token, please verify validity of API token.')
def _url_builder(self, path):
if path[0] == '/':