Commit 046beb0c authored by Romain Courteaud's avatar Romain Courteaud

slapos_cloud: stop instance tree propagation on instance_slap_interface_workflow

Some alarm call request directly on the Instance Tree (this is expected)
parent f5047f61
...@@ -25,6 +25,18 @@ if is_slave not in [True, False]: ...@@ -25,6 +25,18 @@ if is_slave not in [True, False]:
# Instance tree is used as the root of the instance tree # Instance tree is used as the root of the instance tree
if requester_instance.getPortalType() == "Instance Tree": if requester_instance.getPortalType() == "Instance Tree":
instance_tree = requester_instance instance_tree = requester_instance
# Do not propagate instante tree changes if current user
# subscription status is not OK
subscription_state = instance_tree.Service_getSubscriptionStatus()
if subscription_state in ('not_subscribed', 'nopaid'):
context.REQUEST.set('request_instance', None)
return
elif subscription_state in ('subscribed', 'todestroy'):
pass
else:
raise NotImplementedError('Unhandled subscription state: %s' % subscription_state)
else: else:
instance_tree = requester_instance.getSpecialiseValue(portal_type="Instance Tree") instance_tree = requester_instance.getSpecialiseValue(portal_type="Instance Tree")
......
...@@ -91,23 +91,15 @@ elif (root_state == "destroyed"): ...@@ -91,23 +91,15 @@ elif (root_state == "destroyed"):
else: else:
raise ValueError, "state should be started, stopped or destroyed" raise ValueError, "state should be started, stopped or destroyed"
subscription_state = request_instance_tree.Service_getSubscriptionStatus() request_instance_tree.requestInstance(
request_instance_tree.log('subscription_state %s' % subscription_state) software_release=software_release_url_string,
if subscription_state in ('not_subscribed', 'nopaid'): software_title=software_title,
context.REQUEST.set('request_instance', None) software_type=software_type,
pass instance_xml=instance_xml,
elif subscription_state in ('subscribed', 'todestroy'): sla_xml=sla_xml,
request_instance_tree.requestInstance( shared=is_slave,
software_release=software_release_url_string, state=root_state,
software_title=software_title, )
software_type=software_type,
instance_xml=instance_xml,
sla_xml=sla_xml,
shared=is_slave,
state=root_state,
)
else:
raise NotImplementedError('Unhandled subscription state: %s' % subscription_state)
# Change the state at the end to allow to execute updateLocalRoles only once in the transaction # Change the state at the end to allow to execute updateLocalRoles only once in the transaction
validation_state = request_instance_tree.getValidationState() validation_state = request_instance_tree.getValidationState()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment