diff options
author | 2018-07-05 20:11:51 -0400 | |
---|---|---|
committer | 2018-07-05 20:12:41 -0400 | |
commit | b085856894e63b5b0990280c622a04bb0e80539c (patch) | |
tree | 98001efd4ffbccfc141cf4ef3e96d87238a7f64c /helm/plugin/workflows.py | |
parent | 795818bc87e45f7dbfd81c4ef30897275c65537b (diff) |
Reformat the helm plugin python code
Change-Id: I9b826964db98dcae59ff6165be9ed0897dcd5f47
Issue-ID: CCSDK-351
Signed-off-by: Hong Guan <hg4105@att.com>
Diffstat (limited to 'helm/plugin/workflows.py')
-rw-r--r-- | helm/plugin/workflows.py | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/helm/plugin/workflows.py b/helm/plugin/workflows.py index 7dc8272..a37293e 100644 --- a/helm/plugin/workflows.py +++ b/helm/plugin/workflows.py @@ -13,7 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -#============LICENSE_END============================================ +# ============LICENSE_END============================================ from cloudify.decorators import workflow from cloudify.workflows import ctx @@ -22,8 +22,10 @@ import urllib2 import json import yaml + @workflow -def upgrade(node_instance_id,config_json,config_url,config_format,chartVersion,chartRepo,**kwargs): +def upgrade(node_instance_id, config_json, config_url, config_format, + chartVersion, chartRepo, **kwargs): node_instance = ctx.get_node_instance(node_instance_id) if not node_instance_id: @@ -33,29 +35,30 @@ def upgrade(node_instance_id,config_json,config_url,config_format,chartVersion,c kwargs = {} if config_json == '' and config_url == '': - kwargs['config'] = config_json + kwargs['config'] = config_json elif config_json == '' and config_url != '': - response = urllib2.urlopen(config_url) - if config_format == 'json': - kwargs['config'] = json.load(response) - elif config_format == 'yaml': - kwargs['config'] = yaml.load(response) - else: - raise NonRecoverableError("Unable to get config input format") + response = urllib2.urlopen(config_url) + if config_format == 'json': + kwargs['config'] = json.load(response) + elif config_format == 'yaml': + kwargs['config'] = yaml.load(response) + else: + raise NonRecoverableError("Unable to get config input format") elif config_json != '' and config_url == '': - kwargs['config'] = config_json + kwargs['config'] = config_json + else: raise NonRecoverableError("Unable to get Json config input") - kwargs['chart_version'] = str(chartVersion) - kwargs['chart_repo'] = str(chartRepo) - operation_args = {'operation': 'upgrade',} - operation_args['kwargs'] = kwargs - node_instance.execute_operation(**operation_args) +kwargs['chart_version'] = str(chartVersion) +kwargs['chart_repo'] = str(chartRepo) +operation_args = {'operation': 'upgrade', } +operation_args['kwargs'] = kwargs +node_instance.execute_operation(**operation_args) @workflow -def rollback(node_instance_id,revision,**kwargs): +def rollback(node_instance_id, revision, **kwargs): node_instance = ctx.get_node_instance(node_instance_id) if not node_instance_id: @@ -65,6 +68,6 @@ def rollback(node_instance_id,revision,**kwargs): kwargs = {} kwargs['revision'] = str(revision) - operation_args = {'operation': 'rollback',} + operation_args = {'operation': 'rollback', } operation_args['kwargs'] = kwargs node_instance.execute_operation(**operation_args) |