From 81b242147f174fc5d7cc983c36769d029ac1761b Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Mon, 11 Sep 2017 11:59:09 -0400 Subject: Cleanup after Policy update Issue-ID: DCAEGEN2-96 Change-Id: Iebc195340211faea6d0bcc834015117ba9ded09d Signed-off-by: Tommy Carpenter --- cdap/cdapplugin/cdapcloudify/cdap_plugin.py | 33 ++++++++--------------------- 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'cdap/cdapplugin/cdapcloudify') diff --git a/cdap/cdapplugin/cdapcloudify/cdap_plugin.py b/cdap/cdapplugin/cdapcloudify/cdap_plugin.py index 1de0173..6f4134e 100644 --- a/cdap/cdapplugin/cdapcloudify/cdap_plugin.py +++ b/cdap/cdapplugin/cdapcloudify/cdap_plugin.py @@ -46,15 +46,17 @@ class BadConnections(NonRecoverableError): def _trigger_update(updated_policies): """ Helper function for reconfiguring after a policy update + + updated_policies is assumed to be a list of JSONs that are applicable to the brokers smart interface """ for p in updated_policies: ctx.logger.info("Reconfiguring CDAP application via smart interface") - return discovery.reconfigure_in_broker(cdap_broker_name = ctx.instance.runtime_properties[SELECTED_BROKER], - service_component_name = ctx.instance.runtime_properties[SERVICE_COMPONENT_NAME], - config = p, - reconfiguration_type = "program-flowlet-smart", - logger = ctx.logger) - + return discovery.reconfigure_in_broker( + cdap_broker_name = ctx.instance.runtime_properties[SELECTED_BROKER], + service_component_name = ctx.instance.runtime_properties[SERVICE_COMPONENT_NAME], + config = p, + reconfiguration_type = "program-flowlet-smart", + logger = ctx.logger) def _validate_conns(connections): """ @@ -107,19 +109,6 @@ def _services_calls_iterator(services_calls): for_config[s["config_key"]] = "{{ " + s["service_component_type"] + " }}" #will get bound by CBS return for_config - -###################### -# TEMPORARY!!!!!! -# THIS WILL GO AWAY ONCE ALEX HAS A NODE TYPE AND PLUGIN -###################### -@operation -@Policies.populate_policy_on_node -def policy_get(**kwargs): - """decorate with @Policies.populate_policy_on_node on dcae.policy node to - retrieve the latest policy_body for policy_id property and save it in runtime_properties - """ - pass - ###################### # Cloudify Operations ###################### @@ -252,11 +241,7 @@ def app_smart_reconfigure(new_config_template, **kwargs): """ try: ctx.logger.info("Reconfiguring CDAP application via smart interface") - discovery.reconfigure_in_broker(cdap_broker_name = ctx.instance.runtime_properties[SELECTED_BROKER], - service_component_name = ctx.instance.runtime_properties[SERVICE_COMPONENT_NAME], - config = new_config_template, #This keyname will likely change per policy handler - reconfiguration_type = "program-flowlet-smart", - logger = ctx.logger) + _trigger_update([new_config_template]) except Exception as e: raise NonRecoverableError("CDAP Reconfigure error: {0}".format(e)) -- cgit 1.2.3-korg