Beispiel #1
0
 def _validate_args(parser, namespace):
     path = namespace.profile
     if namespace.repo is not None and getattr(namespace.repo, 'location', False):
         if not path.startswith('/'):
             path = pjoin(namespace.repo.location, 'profiles', path)
     try:
         stack = profiles.ProfileStack(arghparse.existent_path(path))
     except ValueError as e:
         parser.error(e)
     if stack.node.repoconfig is None:
         parser.error("invalid profile path: '%s'" % path)
     namespace.profile = stack
Beispiel #2
0
 def _validate_args(parser, namespace):
     path = namespace.profile
     if path is None:
         if namespace.repo is not None:
             # default to the repo's main profiles dir
             path = pjoin(namespace.repo.location, 'profiles')
         else:
             # default to the configured system profile if none is selected
             path = namespace.config.get_default("domain").profile.profile
     else:
         if namespace.repo is not None and getattr(namespace.repo, 'location', False):
             if not path.startswith('/'):
                 path = pjoin(namespace.repo.location, 'profiles', path)
     try:
         stack = profiles.ProfileStack(arghparse.existent_path(path))
     except argparse.ArgumentTypeError as e:
         parser.error(e)
     if stack.node.repoconfig is None:
         parser.error(f"invalid profile path: {path!r}")
     namespace.profile = stack
Beispiel #3
0
 def _validate_args(parser, namespace):
     path = namespace.profile
     if path is None:
         if namespace.repo is not None:
             # default to the repo's main profiles dir
             path = pjoin(namespace.repo.location, 'profiles')
         else:
             # default to the configured system profile if none is selected
             path = namespace.config.get_default("domain").profile.profile
     else:
         if namespace.repo is not None and getattr(namespace.repo,
                                                   'location', False):
             if not path.startswith('/'):
                 path = pjoin(namespace.repo.location, 'profiles', path)
     try:
         stack = profiles.ProfileStack(arghparse.existent_path(path))
     except argparse.ArgumentTypeError as e:
         parser.error(e)
     if stack.node.repoconfig is None:
         parser.error(f"invalid profile path: {path!r}")
     namespace.profile = stack
Beispiel #4
0
 def __call__(self, parser, namespace, value, option_string=None):
     if value.lower() in {'false', 'no', 'n'}:
         path = pjoin(const.DATA_PATH, 'stubconfig')
     else:
         path = arghparse.existent_path(value)
     setattr(namespace, self.dest, path)