Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
fence-agents.4605
0004-fence_azure_arm-remove-reboot-action-remov...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-fence_azure_arm-remove-reboot-action-remove-sys.exit.patch of Package fence-agents.4605
commit ab0fffafb95dea5b24e756d9e76c7af0510bb4a6 Author: Sebastian Dusch <sedusch@microsoft.com> Date: Wed Nov 9 16:52:45 2016 +0100 fence_azure_arm: remove reboot action, remove sys.exit for setting powerstate, remove global compute_client and pass it as argument to functions diff --git a/fence/agents/azure_arm/fence_azure_arm.py b/fence/agents/azure_arm/fence_azure_arm.py index 4638930..16d29ae 100644 --- a/fence/agents/azure_arm/fence_azure_arm.py +++ b/fence/agents/azure_arm/fence_azure_arm.py @@ -13,9 +13,7 @@ BUILD_DATE="(built Thu Nov 3 15:43:03 STD 2016)" REDHAT_COPYRIGHT="Copyright (C) Red Hat, Inc. 2004-2010 All rights reserved." #END_VERSION_GENERATION -compute_client = None - -def get_nodes_list(conn, options): +def get_nodes_list(compute_client, options): result = {} if compute_client: rgName = options["--resourceGroup"] @@ -25,7 +23,7 @@ def get_nodes_list(conn, options): return result -def get_power_status(conn, options): +def get_power_status(compute_client, options): logging.info("getting power status for VM " + options["--plug"]) if compute_client: @@ -45,7 +43,7 @@ def get_power_status(conn, options): return "off" -def set_power_status(conn, options): +def set_power_status(compute_client, options): logging.info("setting power status for VM " + options["--plug"] + " to " + options["--action"]) if compute_client: @@ -55,13 +53,10 @@ def set_power_status(conn, options): if (options["--action"]=="off"): logging.info("Deallocating " + vmName + "in resource group " + rgName) compute_client.virtual_machines.deallocate(rgName, vmName) - elif (options["--action"]=="reboot"): - logging.info("Restarting " + vmName + "in resource group " + rgName) - compute_client.virtual_machines.restart(rgName, vmName) - - sys.exit(0) + elif (options["--action"]=="on"): + logging.info("Starting " + vmName + "in resource group " + rgName) + compute_client.virtual_machines.start(rgName, vmName) - sys.exit(1) def define_new_opts(): all_opt["resourceGroup"] = { @@ -91,7 +86,7 @@ def define_new_opts(): # Main agent method def main(): - global compute_client + compute_client = None device_opt = ["resourceGroup", "login", "passwd", "tenantId", "subscriptionId","port"] @@ -129,7 +124,7 @@ def main(): fail_usage("Azure Resource Manager Pyhton SDK not found or not accessible") # Operate the fencing device - result = fence_action(None, options, set_power_status, get_power_status, get_nodes_list) + result = fence_action(compute_client, options, set_power_status, get_power_status, get_nodes_list) sys.exit(result) if __name__ == "__main__":
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor