diff --git a/resource.py b/resource.py index aa33c0029824f60fba8d9f359ae7dff092c908d4..725436d11d55791dc4fd22b9f3ad3d349cbdc3e4 100644 --- a/resource.py +++ b/resource.py @@ -520,19 +520,20 @@ def create_resource(data): """ if data == {} or data is None: return {'action': False, 'error': _('No input data')} - rsc_id = str(data["id"]) + rsc_id = " id=\"" + str(data["id"]) + "\"" cate = str(data["category"]) #判断category if cate == "primitive": - rsc_type = "\" type=\"" + str(data["type"]) - rsc_class = "\" class=\"" + str(data["class"]) + rsc_class = " class=\"" + str(data["class"]) + "\"" + rsc_type = " type=\"" + str(data["type"]) + "\"" cmd = "cibadmin --create -o resources --xml-text '<" if "provider" in data: - provider = "\" provider=\"" + str(data["provider"]) - cmd_str = cmd + cate + " id=\"" + rsc_id + rsc_class + rsc_type + provider + "\">'" - cmd_str = cmd + cate + " id=\"" + rsc_id + rsc_class + rsc_type + "\">'" + provider = " provider=\"" + str(data["provider"]) + "\"" + cmd_str = cmd + cate + rsc_id + rsc_class + rsc_type + provider + ">'" + status, output = common_utils.run_cmd(cmd_str) else: - cmd_str = cmd + cate + " id=\"" + rsc_id + rsc_class + rsc_type + "\">'" + cmd_str = cmd + cate + rsc_id + rsc_class + rsc_type + ">'" + status, output = common_utils.run_cmd(cmd_str) elif cate == "group": """ @@ -569,16 +570,16 @@ def create_resource(data): cmd_str = "pcs resource clone " + ori_id #通用步骤 - status, output = common_utils.run_cmd(cmd_str) - if status != 0: - return {'action': False, 'error': _(output)} - #更新属性 - update_resource_attributes(rsc_id, data) + # status, output = common_utils.run_cmd(cmd_str) + # if status != 0: + # return {'action': False, 'error': _(output)} + # #更新属性 + # update_resource_attributes(rsc_id, data) return {"action":True, "info":"Add " + str(cate) + " resource success"} def unmigrate_rsc(is_all_rscs, rsc_id): - # 保留标签 is_all_rscs = False + # 保留标签 is_all_rscs = False # if rsc_id not in get_all_rsc(): # return {'action': False, 'error': _("Cannot find the %s: %s") % (_("resource"), str(rsc_id))} diff --git a/run.py b/run.py index 9fb2db58034693a26bad8e757c61791f02450d81..bf891364f25d2397e8f8a1967f6c38a81140019e 100644 --- a/run.py +++ b/run.py @@ -200,7 +200,7 @@ def create_app(test_config=None): #获取资源创建 @app.route('/api/' + API_VERSION + '/haclusters/1/metas//', methods=['GET', 'POST', 'PUT']) - @app.route('/api/' + API_VERSION + '/haclusters/1/metas///', methods=['GET', 'POST', 'PUT']) + @app.route('/api/' + API_VERSION + '/haclusters/1/metas////', methods=['GET', 'POST', 'PUT']) def get_rsc_meta(rsc_class, rsc_type, rsc_provider=None): if request.method == 'GET': return json.dumps(resource.get_rsc_metas(rsc_class, rsc_type, rsc_provider))