Skip to content

Commit

Permalink
fix case issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Warnock committed Apr 14, 2020
1 parent 97a5f61 commit 15daa49
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 11 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]

[requires]
python_version = "3.7"
8 changes: 5 additions & 3 deletions cloudendure/cloudendure.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ def check_licenses(self) -> Dict[str, Any]:
license_data: Dict[str, Any] = machine.get("license", {})
license_use: str = license_data.get("startOfUseDateTime")
license_date: datetime = datetime.datetime.strptime(license_use, "%Y-%m-%dT%H:%M:%S.%f%z")
print(f"{machine_name} agent install: {license_date}")
delta: timedelta = now - license_date
if expirationday < delta:
response_dict[machine_name] = {
Expand Down Expand Up @@ -534,13 +535,14 @@ def launch(self) -> Dict[str, Any]:
for machine in json.loads(machines_response.text).get("items", []):
source_props: Dict[str, Any] = machine.get("sourceProperties", {})
machine_data: Dict[str, Any] = {}
if _machine == source_props.get("name", "NONE"):
ce_name = source_props.get("name","NONE")
if _machine == ce_name.upper():
if machine.get("replica"):
print("Target machine already launched")
self.event_handler.add_event(Event.EVENT_ALREADY_LAUNCHED, machine_name=_machine)
continue
machine_data = {
"items": [{"machineId": machine["id"]}],
"items": [{"machineId": ce_name}],
"launchType": "TEST",
}

Expand All @@ -563,7 +565,7 @@ def launch(self) -> Dict[str, Any]:
print("ERROR: Launch target machine failed!")
self.event_handler.add_event(Event.EVENT_FAILED, machine_name=_machine)
else:
print(f"Machine: ({source_props['name']}) - Not a machine we want to launch...")
#print(f"Machine: ({source_props['name']}) - Not a machine we want to launch...")
self.event_handler.add_event(Event.EVENT_IGNORED, machine_name=_machine)
return response_dict

Expand Down

0 comments on commit 15daa49

Please sign in to comment.