Skip to content

Commit

Permalink
Fix pacemaker property name validation - added cib
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjelinek committed Sep 15, 2014
1 parent a465326 commit d972695
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pcs/prop.py
Expand Up @@ -98,8 +98,13 @@ def get_default_properties():
utils.err("unable to get crmd metadata\n"+output)
crmd_root = ET.fromstring(output)

(output, retVal) = utils.run([settings.cib_binary, "metadata"])
if retVal != 0:
utils.err("unable to get cib metadata\n"+output)
cib_root = ET.fromstring(output)

parameters = {}
for root in [pe_root, crmd_root]:
for root in [pe_root, crmd_root, cib_root]:
for param in root.getiterator('parameter'):
name = param.attrib["name"]
content = param.find("content")
Expand Down
1 change: 1 addition & 0 deletions pcs/settings.py
Expand Up @@ -5,6 +5,7 @@
fence_agent_binaries = "/usr/sbin/"
pengine_binary = "/usr/libexec/pacemaker/pengine"
crmd_binary = "/usr/libexec/pacemaker/crmd"
cib_binary = "/usr/libexec/pacemaker/cib"
stonithd_binary = "/usr/libexec/pacemaker/stonithd"
pcs_version = "0.9.127"
crm_report = pacemaker_binaries + "crm_report"
Expand Down
10 changes: 10 additions & 0 deletions pcs/utils.py
Expand Up @@ -1212,6 +1212,16 @@ def is_valid_property(prop):
if p.getAttribute("name") == prop:
return True

output, retval = run([settings.cib_binary, "metadata"])
if retval != 0:
err("unable to run cib\n" + output)

dom = parseString(output)
properties = dom.getElementsByTagName("parameter");
for p in properties:
if p.getAttribute("name") == prop:
return True

return False

def get_node_attributes():
Expand Down

0 comments on commit d972695

Please sign in to comment.