Skip to content

Commit

Permalink
Implements #618
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 22, 2018
1 parent 64d2ac1 commit 9b0263a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion IM/connectors/Azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,21 @@ def create_vms(self, inf, radl, requested_radl, num_vm, location, storage_accoun
group_name = "rg-%s" % (vm_name)

try:
tags = {}
if radl.systems[0].getValue('instance_tags'):
keypairs = radl.systems[0].getValue('instance_tags').split(",")
for keypair in keypairs:
parts = keypair.split("=")
key = parts[0].strip()
value = parts[1].strip()
tags[key] = value

args = {'location': location}
if tags:
args['tags'] = tags

# Create resource group for the VM
resource_client.resource_groups.create_or_update(group_name, {'location': location})
resource_client.resource_groups.create_or_update(group_name, args)

vm = VirtualMachine(inf, group_name + '/' + vm_name, self.cloud, radl, requested_radl, self)
vm.info.systems[0].setValue('instance_id', group_name + '/' + vm_name)
Expand Down

0 comments on commit 9b0263a

Please sign in to comment.