def _shared(self, args, release): """process shared arguments between the pxe and iso commands""" if args.config: yaml_file = os.path.join(self.cfg["paths"]["configs"], args.config) yaml_file += ".yaml" overrides = utils.yaml_read(yaml_file) if "args" in overrides: args = settings.override(args, overrides) config = dict(self.cfg.items() + overrides.items()) else: config = self.cfg if args.overlay: path = os.path.join(self.cfg["paths"]["overlays"], args.overlay) if os.path.isdir(path): args.path = path else: raise self.exception('file overlay directory "%s" does not ' "exist" % path) if not "." in args.fqdn: raise self.exception('"%s" is not a fully qualified domain name' % args.fqdn) if not args.seed: args.seed = release args.seeds = [args.seed] + args.additional for seed_file in args.seeds: file_name = os.path.join(self.cfg["paths"]["seeds"], seed_file) file_name += ".seed" if not os.path.isfile(file_name): raise self.exception('preseed file "%s" does not exist' % file_name) if args.puppet: for index, manifest in enumerate(args.puppet): file_name = os.path.join(config["paths"]["puppet_manifests"], manifest + ".pp") if not os.path.isfile(file_name): err = 'Puppet manifest "%s" does not exist' % file_name raise self.exception(err) else: args.puppet[index] = manifest return args, config
def _shared(self, args, release_type): """process shared arguments between the pxe and iso commands""" if args.config: yaml_file = os.path.join(self.cfg["paths"]["configs"], args.config) yaml_file += ".yaml" overrides = utils.yaml_read(yaml_file) if "args" in overrides: args = settings.override(args, overrides) config = self._merge_config(self.cfg, overrides) else: config = self.cfg if not args.release: args.release = self.cfg["default_release"][release_type] else: args.release = args.release try: release = args.release.split("-")[1] except (ValueError, IndexError): raise self.exception( '"%s" is not a valid release, use the ' '"seedbank list" command to list available releases' % args.release ) if "overlay" in args and args.overlay: path = os.path.join(self.cfg["paths"]["overlays"], args.overlay) if os.path.isdir(path): args.path = path else: raise self.exception('file overlay directory "%s" does not ' "exist" % path) if not args.fqdn: raise self.exception( "you will need to specify a fully qualified " "domain name on the command line or in the args section of a " "config override file" ) elif not "." in args.fqdn: raise self.exception('"%s" is not a fully qualified domain name' % args.fqdn) if not args.seed: args.seed = release args.seeds = [args.seed] + args.additional for seed_file in args.seeds: file_name = os.path.join(self.cfg["paths"]["seeds"], seed_file) file_name += ".seed" if not os.path.isfile(file_name): raise self.exception('preseed file "%s" does not exist' % file_name) if args.puppet: for index, manifest in enumerate(args.puppet): file_name = os.path.join(config["paths"]["puppet_manifests"], manifest + ".pp") if not os.path.isfile(file_name): err = 'Puppet manifest "%s" does not exist' % file_name raise self.exception(err) else: args.puppet[index] = manifest return args, config
def _shared(self, args, release_type): """process shared arguments between the pxe and iso commands""" if args.config: yaml_file = os.path.join(self.cfg['paths']['configs'], args.config) yaml_file += '.yaml' overrides = utils.yaml_read(yaml_file) if 'args' in overrides: args = settings.override(args, overrides) config = self._merge_config(self.cfg, overrides) else: config = self.cfg if not args.release: args.release = self.cfg['default_release'][release_type] else: args.release = args.release try: release = args.release.split('-')[1] except (ValueError, IndexError): raise self.exception( '"%s" is not a valid release, use the ' '"seedbank list" command to list available releases' % args.release) if 'overlay' in args and args.overlay: path = os.path.join(self.cfg['paths']['overlays'], args.overlay) if os.path.isdir(path): args.path = path else: raise self.exception('file overlay directory "%s" does not ' 'exist' % path) if not args.fqdn: raise self.exception( 'you will need to specify a fully qualified ' 'domain name on the command line or in the args section of a ' 'config override file') elif not '.' in args.fqdn: raise self.exception('"%s" is not a fully qualified domain name' % args.fqdn) if not args.seed: args.seed = release args.seeds = [args.seed] + args.additional for seed_file in args.seeds: file_name = os.path.join(self.cfg['paths']['seeds'], seed_file) file_name += '.seed' if not os.path.isfile(file_name): raise self.exception('preseed file "%s" does not exist' % file_name) if args.puppet: for index, manifest in enumerate(args.puppet): file_name = os.path.join(config['paths']['puppet_manifests'], manifest + '.pp') if not os.path.isfile(file_name): err = 'Puppet manifest "%s" does not exist' % file_name raise self.exception(err) else: args.puppet[index] = manifest return args, config