Use open_url directly to avoid failing tests. (#2680)

This commit is contained in:
Matt Clay 2016-08-05 11:28:02 -07:00 committed by GitHub
parent d4b0732c9f
commit 33716b1837
2 changed files with 3 additions and 5 deletions

View file

@ -550,7 +550,6 @@ class LogicMonitor(object):
self.password = params["password"] self.password = params["password"]
self.fqdn = socket.getfqdn() self.fqdn = socket.getfqdn()
self.lm_url = "logicmonitor.com/santaba" self.lm_url = "logicmonitor.com/santaba"
self.urlopen = open_url # use the ansible provided open_url
self.__version__ = self.__version__ + "-ansible-module" self.__version__ = self.__version__ + "-ansible-module"
def rpc(self, action, params): def rpc(self, action, params):
@ -577,7 +576,7 @@ class LogicMonitor(object):
headers = {"X-LM-User-Agent": self.__version__} headers = {"X-LM-User-Agent": self.__version__}
# Set headers # Set headers
f = self.urlopen(url, headers=headers) f = open_url(url, headers=headers)
raw = f.read() raw = f.read()
resp = json.loads(raw) resp = json.loads(raw)
@ -608,7 +607,7 @@ class LogicMonitor(object):
self.module.debug("Attempting to open URL: " + self.module.debug("Attempting to open URL: " +
"https://" + self.company + "." + self.lm_url + "https://" + self.company + "." + self.lm_url +
"/do/" + action + "?" + param_str) "/do/" + action + "?" + param_str)
f = self.urlopen( f = open_url(
"https://" + self.company + "." + self.lm_url + "https://" + self.company + "." + self.lm_url +
"/do/" + action + "?" + param_str) "/do/" + action + "?" + param_str)
return f.read() return f.read()

View file

@ -200,7 +200,6 @@ class LogicMonitor(object):
self.password = params["password"] self.password = params["password"]
self.fqdn = socket.getfqdn() self.fqdn = socket.getfqdn()
self.lm_url = "logicmonitor.com/santaba" self.lm_url = "logicmonitor.com/santaba"
self.urlopen = open_url # use the ansible provided open_url
self.__version__ = self.__version__ + "-ansible-module" self.__version__ = self.__version__ + "-ansible-module"
def rpc(self, action, params): def rpc(self, action, params):
@ -227,7 +226,7 @@ class LogicMonitor(object):
headers = {"X-LM-User-Agent": self.__version__} headers = {"X-LM-User-Agent": self.__version__}
# Set headers # Set headers
f = self.urlopen(url, headers=headers) f = open_url(url, headers=headers)
raw = f.read() raw = f.read()
resp = json.loads(raw) resp = json.loads(raw)