Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for https #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions chaoswm/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def mappings(self) -> List[Any]:
r = requests.get(
self.mappings_url,
headers=self.headers,
timeout=self.timeout)
timeout=self.timeout,
verify=False )
if r.status_code != 200:
logger.error(
"[mappings]:Error retrieving mappings: {}".format(
Expand All @@ -68,7 +69,8 @@ def mapping_by_id(self, id=int) -> Dict[str, Any]:
r = requests.get(
"{}/{}".format(self.mappings_url, id),
headers=self.headers,
timeout=self.timeout)
timeout=self.timeout,
verify=False)
if r.status_code != 200:
logger.error(
"[mapping_by_id]:Error retrieving mapping: {}".format(
Expand Down Expand Up @@ -173,7 +175,8 @@ def add_mapping(self, mapping: Mapping[str, Any]) -> int:
self.mappings_url,
headers=self.headers,
data=json.dumps(mapping),
timeout=self.timeout)
timeout=self.timeout,
verify=False)
if r.status_code != 201:
logger.error("Error creating a mapping: " + r.text)
return None
Expand All @@ -184,7 +187,8 @@ def add_mapping(self, mapping: Mapping[str, Any]) -> int:
def delete_mapping(self, id: str):
r = requests.delete(
"{}/{}".format(self.mappings_url, id),
timeout=self.timeout)
timeout=self.timeout,
verify=False)
if r.status_code != 200:
logger.error("Error deleting mapping {}: {}".format(id, r.text))
return -1
Expand Down Expand Up @@ -220,7 +224,8 @@ def global_fixed_delay(self, fixedDelay: int) -> int:
self.settings_url,
headers=self.headers,
data=json.dumps({"fixedDelay": fixedDelay}),
timeout=self.timeout)
timeout=self.timeout,
verify=False)
if r.status_code != 200:
logger.error(
"[global_fixed_delay]: Error setting delay: {}".format(
Expand Down Expand Up @@ -259,7 +264,8 @@ def global_random_delay(self, delayDistribution: Mapping[str, Any]) -> int:
self.settings_url,
headers=self.headers,
data=json.dumps({"delayDistribution": delayDistribution}),
timeout=self.timeout)
timeout=self.timeout,
verify=False)
if r.status_code != 200:
logger.error(
"[global_random_delay]: Error setting delay: {}".format(
Expand Down Expand Up @@ -324,7 +330,8 @@ def reset(self) -> int:
r = requests.post(
self.reset_url,
headers=self.headers,
timeout=self.timeout)
timeout=self.timeout,
verify=False)
if r.status_code != 200:
logger.error("[reset]:Error resetting wiremock server " + r.text)
return -1
Expand Down
3 changes: 1 addition & 2 deletions chaoswm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ def get_wm_params(c: Dict[str, Any]) -> Optional[Dict[str, Any]]:

host = wm_conf.get("host", None)
port = wm_conf.get("port", None)
url = wm_conf.get("url", None)
context_path = wm_conf.get("contextPath", "")
timeout = wm_conf.get("timeout", 1)

url = ""

if host and port:
url = "http://{}:{}{}".format(host, port, context_path)

Expand Down