diff options
author | 2017-09-11 11:59:09 -0400 | |
---|---|---|
committer | 2017-09-11 12:01:50 -0400 | |
commit | 81b242147f174fc5d7cc983c36769d029ac1761b (patch) | |
tree | 692ebc8ecf87d7cf7463866db67d4ee7a16b224f /cdap/cdapplugin/cdapcloudify/cdap_plugin.py | |
parent | 61ba70610e670c395483d3c2ef46bbca4eef7769 (diff) |
Cleanup after Policy update
Issue-ID: DCAEGEN2-96
Change-Id: Iebc195340211faea6d0bcc834015117ba9ded09d
Signed-off-by: Tommy Carpenter <tommy@research.att.com>
Diffstat (limited to 'cdap/cdapplugin/cdapcloudify/cdap_plugin.py')
-rw-r--r-- | cdap/cdapplugin/cdapcloudify/cdap_plugin.py | 33 |
1 files changed, 9 insertions, 24 deletions
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)) |