Skip to content

Non required parameters cause exception if missing #5

@cheribral

Description

@cheribral

It seems that non required parameters are actually required, since the agent will throw an exception if they are missing.

Adding a filter to parse_parameters fixes it for me:

--- /usr/lib/python2.7/site-packages/ocfagent/agent.py	2018-04-17 23:58:29.672919240 +0000
+++ -	2018-04-17 23:58:34.093745968 +0000
@@ -239,7 +239,7 @@
 	def parse_parameters(self):
 		"""Parse parameters (given with OCF_RESKEY_ prefix)"""
 		assert len(self.OCF_ENVIRON) > 0
-		for param_cls in self.parameter_spec:
+		for param_cls in [x for x in self.parameter_spec if x.required]:
 			cls_name = param_cls.name
 			env_name = "%s%s" % (OCF_RESKEY_PREFIX, cls_name)
 			if param_cls.type_def == types.IntType:  # nopep8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions