Commit f0ef7773 authored by Jürgen Haas's avatar Jürgen Haas
parent 84278118
......@@ -3,7 +3,7 @@ import os
import requests
import tempfile
import yaml
import ConfigParser
import configparser
from ansible.errors import AnsibleError as ae
from ansible.plugins.action import ActionBase
......@@ -65,7 +65,7 @@ class ActionModule(ActionBase):
result['msg'] = 'Uptime not configured'
result['changed'] = False
return result
self.config = ConfigParser.ConfigParser()
self.config = configparser.ConfigParser()
self.config.read(configPath)
section = 'Credentials'
if self.config.has_option(section, 'url') and self.config.has_option(section, 'username') and self.config.has_option(section, 'password'):
......@@ -144,7 +144,7 @@ class ActionModule(ActionBase):
request_result = requests.put(self.url + '/api/' + path, auth = auth, data = postData)
elif method == 'DELETE':
request_result = requests.delete(self.url + '/api/' + path, auth = auth)
except ae, e:
except ae as e:
raise ae('No result from Uptime API')
display.vvvvvv(request_result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment