Skip to content

Commit a095e02

Browse files
DEVOPS-274 run commands using python for vmsss
1 parent b606392 commit a095e02

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

az_vm_runcommands.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ def run_commands_on_vm(resource_group:str, subscription_id:str, vm_name:str):
1919
command_id='RunShellScript',
2020
script=['sudo systemctl start jenkins']
2121
)
22-
22+
print(f'Executing Run commands on {vm_name} VM of resource group {resource_group}')
2323
response = compute_mgmt_client.virtual_machines.begin_run_command(resource_group_name=resource_group,
2424
vm_name=vm_name,parameters=run_command_parameters)
2525

2626
result = response.result()
27-
print(result.value[0].message)
27+
if result.value[0].code == "ProvisioningState/succeeded":
28+
print(f"Run command execution in VM {vm_name} of resource group {resource_group} completed successfully")
29+
else:
30+
print('Something went wrong!!')
31+
2832

2933

3034
def main():

0 commit comments

Comments
 (0)