Skip to content

Sample is not failing if Cluster Name argument passed is not Valid.As… #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions samples/vsphere/tagging/tagging_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ def _setup(self):
if self.servicemanager is None:
self.servicemanager = self.get_service_manager()

# Sample is not failing if Clustername passed is not valid
# Validating if Cluster Name passed is Valid
print('finding the cluster {0}'.format(self.cluster_name))
self.cluster_moid = get_cluster_id(service_manager=self.servicemanager, cluster_name=self.cluster_name)
assert self.cluster_moid is not None
print('Found cluster:{0} mo_id:{1}'.format(self.cluster_name, self.cluster_moid))

self.category_svc = Category(self.servicemanager.stub_config)
self.tag_svc = Tag(self.servicemanager.stub_config)
self.tag_association = TagAssociation(self.servicemanager.stub_config)
Expand All @@ -119,7 +126,8 @@ def _execute(self):
print('No Tag Found...')

print('creating a new tag category...')
self.category_id = self.create_tag_category(self.category_name, self.category_desc, CategoryModel.Cardinality.MULTIPLE)
self.category_id = self.create_tag_category(self.category_name, self.category_desc,
CategoryModel.Cardinality.MULTIPLE)
assert self.category_id is not None
print('Tag category created; Id: {0}'.format(self.category_id))

Expand All @@ -133,11 +141,6 @@ def _execute(self):
self.update_tag(self.tag_id, 'Server Tag updated at ' + date_time)
print('Tag updated; Id: {0}'.format(self.tag_id))

print('finding the cluster {0}'.format(self.cluster_name))
self.cluster_moid = get_cluster_id(service_manager=self.servicemanager, cluster_name=self.cluster_name)
assert self.cluster_moid is not None
print('Found cluster:{0} mo_id:{1}'.format('vAPISDKCluster', self.cluster_moid))

print('Tagging the cluster {0}...'.format(self.cluster_name))
self.dynamic_id = DynamicID(type='ClusterComputeResource', id=self.cluster_moid)
self.tag_association.attach(tag_id=self.tag_id, object_id=self.dynamic_id)
Expand Down