You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@aurora.apache.org by "brian wickman (JIRA)" <ji...@apache.org> on 2014/03/11 22:55:43 UTC

[jira] [Created] (AURORA-254) add a pluggable configuration validation mechanism

brian wickman created AURORA-254:
------------------------------------

             Summary: add a pluggable configuration validation mechanism
                 Key: AURORA-254
                 URL: https://issues.apache.org/jira/browse/AURORA-254
             Project: Aurora
          Issue Type: Task
          Components: Client
            Reporter: brian wickman
            Priority: Minor


In the past we've gone through deprecation cycles that match patterns on configs and flag warnings to the users.  We should generalize this pattern so that we can register validators to be applied to configs after parsing.  E.g.

{noformat}

class AuroraConfig(object):
  @classmethod
  def register_validator(cls, matcher, action):
    cls.VALIDATORS.append((matcher, action))

...snip snip ... in parse_config or whatever...

  for (matcher, action) in self.VALIDATORS.items():
    if matcher(self.job):
      action()
{noformat}

This way we can inject things at runtime like

{noformat}
def isupper_matcher(job):
  return any(ch.isupper() for ch in str(job.user()))

def isupper_action(job):
  die('Silly rabbit, no users have upper-case characters!  Got: %s' % job.user())

AuroraConfig.register_validator(isupper_matcher, isupper_action)
{noformat}




--
This message was sent by Atlassian JIRA
(v6.2#6252)