Skip to content

Commit bb4f4e5

Browse files
committed
Merge pull request #122 from QualiSystems/feature/alex_59_app_orchestration
Feature/alex 59 app orchestration
2 parents f498946 + db9ac68 commit bb4f4e5

29 files changed

Lines changed: 287 additions & 106 deletions

common/utilites/command_result.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
COMMAND_RESULT_PREFIX = "command_json_result="
44
COMMAND_RESULT_POSTFIX = "=command_json_result_end"
55

6-
def get_result_from_command_output(output):
76

7+
def get_result_from_command_output(output):
88
match = search(COMMAND_RESULT_PREFIX + '(?P<result>.*)' + COMMAND_RESULT_POSTFIX, output)
99
if not match:
1010
return None
1111
return match.group('result')
1212

13+
1314
def set_command_result(output):
14-
print COMMAND_RESULT_PREFIX + str(output) + COMMAND_RESULT_POSTFIX
15+
print COMMAND_RESULT_PREFIX + str(output) + COMMAND_RESULT_POSTFIX

common/vcenter/vmomi_service.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,12 @@ def destroy_vm(self, vm):
406406
:param vm: virutal machine pyvmomi object
407407
"""
408408

409-
logger.info(
410-
("The current powerState is: {0}. Attempting to power off {1}".format(vm.runtime.powerState, vm.name)))
409+
if vm.runtime.powerState == 'poweredOn':
410+
logger.info(("The current powerState is: {0}. Attempting to power off {1}"
411+
.format(vm.runtime.powerState, vm.name)))
412+
task = vm.PowerOffVM_Task()
413+
self.wait_for_task(task)
411414

412-
task = vm.PowerOffVM_Task()
413-
self.wait_for_task(task)
414-
415-
logger.info(("{0}".format(task.info.state)))
416415
logger.info(("Destroying VM {0}".format(vm.name)))
417416

418417
task = vm.Destroy_Task()

deployed_app_service/__main__.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

deployed_app_service/connect.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

deployed_app_service/connect/__init__.py

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from common.model_factory import ResourceModelParser
2+
from deployed_app_service.proxy.deployed_app_proxy import DeployedAppService
3+
4+
5+
def main():
6+
DeployedAppService(ResourceModelParser())\
7+
.connect()
8+
9+
if __name__ == "__main__":
10+
main()

deployed_app_service/destroy_vm/__init__.py

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from common.model_factory import ResourceModelParser
2+
from deployed_app_service.proxy.deployed_app_proxy import DeployedAppService
3+
4+
5+
def main():
6+
DeployedAppService(ResourceModelParser())\
7+
.destroy_vm()
8+
9+
if __name__ == "__main__":
10+
main()

deployed_app_service/power_off/__init__.py

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from common.model_factory import ResourceModelParser
2+
from deployed_app_service.proxy.deployed_app_proxy import DeployedAppService
3+
4+
5+
def main():
6+
DeployedAppService(ResourceModelParser())\
7+
.power_off()
8+
9+
if __name__ == "__main__":
10+
main()

0 commit comments

Comments
 (0)