Skip to content

Commit

Permalink
Merge fa93904 into 8b99a42
Browse files Browse the repository at this point in the history
  • Loading branch information
nahumtimerman committed Jun 26, 2018
2 parents 8b99a42 + fa93904 commit f7bddda
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def save(self, save_action, cancellation_context):

save_artifact = Artifact(artifactRef=result.vmUuid, artifactName=result.vmName)

vcenter_vm_path = '/'.join([data_holder.template_resource_model.vm_location, result.vmName])
vcenter_vm_path = self._get_saved_app_result_vcenter_vm_path(data_holder, result)
saved_entity_attributes = [Attribute('vCenter VM', vcenter_vm_path),
Attribute('vCenter VM Snapshot', self.SNAPSHOT_NAME)]

Expand All @@ -86,6 +86,12 @@ def save(self, save_action, cancellation_context):
artifacts=[save_artifact],
savedEntityAttributes=saved_entity_attributes)

def _get_saved_app_result_vcenter_vm_path(self, data_holder, result):
# remove datacenter from path, its not necessary as attribute of saved app
vm_location_with_datacenter = data_holder.template_resource_model.vm_location
vm_location_without_datacenter = '/'.join(vm_location_with_datacenter.split('/')[1:])
return '/'.join([vm_location_without_datacenter, result.vmName])

def delete(self, delete_saved_app_actions, cancellation_context):
tasks = self._get_delete_tasks(delete_saved_app_actions)

Expand Down Expand Up @@ -172,6 +178,9 @@ def _prepare_vm_data_holder(self, save_action, vcenter_data_model):
save_action.actionParams.deploymentPathAttributes,
vCenterCloneVMFromVMResourceModel)

# default vm_location for saved app is actually vcenter location, we want to concentrate all our saved sandboxes in same location
deploy_from_vm_model.vm_location = self.vcenter_data_model.vm_location or deploy_from_vm_model.vm_location

VCenterDetailsFactory.set_deplyment_vcenter_params(
vcenter_resource_model=vcenter_data_model, deploy_params=deploy_from_vm_model)

Expand Down

0 comments on commit f7bddda

Please sign in to comment.