def arg_clone(self): doParser = ArgumentParser(prog=self.cmd_name+" clone", add_help = True, description="Clones the template. The clone is copying the meta-data of the template") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the template to clone") mandatory.add_argument('--name', dest='name', required=True, help="the name to use for the new cloned template") mandatory.add_argument('--version', dest='version', required=True, help="the version to use for the cloned template") return doParser
def arg_publish(self): doParser = ArgumentParser(prog=self.cmd_name+" publish", add_help = True, description="Publish (upload and register) a built machine image to a target environment") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="json file providing the cloud account parameters required for upload and registration") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--id',dest='id',required=False, help="id of the image to publish") return doParser
def arg_export(self): doParser = ArgumentParser(prog=self.cmd_name+" export", add_help = True, description="Exports a template by creating an archive (compressed tar file) that includes the json template configuration file") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the template to export") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--file', dest='file', required=False, help="destination path where to store the template configuration file on the local filesystem") return doParser
def arg_import(self): doParser = ArgumentParser(prog=self.cmd_name+" import", add_help = True, description="Imports (or transforms) the scan to a template") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the scan to import") mandatory.add_argument('--name', dest='name', required=True, help="the name to use for the template created from the scan") mandatory.add_argument('--version', dest='version', required=True, help="the version to use for the template created from the scan") return doParser
def arg_delete(self): doParser = ArgumentParser(prog=self.cmd_name+" delete", add_help = True, description="Deletes an existing template") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the template to delete") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--no-confirm',dest='no_confirm',action='store_true', required=False, help="do not print confirmation dialog") optional.set_defaults(no_confirm=False) return doParser
def arg_delete(self): doParser = ArgumentParser(prog=self.cmd_name+" delete", add_help = True, description="Deletes an existing scan") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the scan to delete") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--scantype', dest='scantype', required=False, help="the scan type, values in [instance|scan|all] (default is scan)") optional.add_argument('--scansonly', dest='scansonly', required=False, action='store_true', help="if scan type is instance, remove only all scans not the instance itself") return doParser
def arg_build(self): doParser = ArgumentParser(prog=self.cmd_name+" build", add_help = True, description="Builds a machine image from the template") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="json file providing the builder parameters") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--id',dest='id',required=False, help="id of the template to build") optional.add_argument('--junit',dest='junit',required=False, help="name of junit XML output file") optional.add_argument('--simulate', dest='simulated', action='store_true', help='Simulate the generation (only the Checking Dependencies process will be executed)', required = False) return doParser
def arg_create(self): doParser = ArgumentParser(prog=self.cmd_name+" create", add_help = True, description="Create a new template and save to the UForge server") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="json file containing the template content") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--archive-path', dest='archive_path', required=False, help="path of where to store the archive of the created template. If provided hammr, creates an archive of the created template, equivalent to running template export") optional.add_argument('-f', '--force', dest='force', action='store_true', help='force template creation (delete template/bundle if already exist)', required = False) optional.set_defaults(force=False) return doParser
def arg_import(self): doParser = ArgumentParser(prog=self.cmd_name+" import", add_help = True, description="Creates a template from an archive") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="the path of the archive") optional = doParser.add_argument_group("optional arguments") optional.add_argument('-f', '--force', dest='force', action='store_true', help='force template creation (delete template/bundle if already exist)', required = False) optional.add_argument('--usemajor', dest='use_major', action='store_true', help='use distribution major version if exit', required = False) optional.set_defaults(force=False) optional.set_defaults(use_major=False) return doParser
def arg_search(self): doParser = ArgumentParser(prog=self.cmd_name+" search", add_help = True, description="Search packages from an OS", formatter_class=RawTextHelpFormatter) mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="Os id") mandatory.add_argument('--pkg', dest='pkg', required=True, help='''\ Regular expression of the package:\n\ "string" : search all packages wich contains "string"\n\ "^string": search all packages wich start with "string"\n\ "string$": search all packages wich end with "string"''') return doParser
def arg_run(self): doParser = ArgumentParser(prog=self.cmd_name+" run", add_help = True, description="Executes a deep scan of a running system") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--ip', dest='ip', required=True, help="the IP address or fully qualified hostname of the running system") mandatory.add_argument('--scan-login', dest='login', required=True, help="the root user name (normally root)") mandatory.add_argument('--name', dest='name', required=True, help="the scan name to use when creating the scan meta-data") optional = doParser.add_argument_group("optional arguments") optional.add_argument('--scan-password', dest='password', required=False, help="the root password to authenticate to the running system") optional.add_argument('--dir', dest='dir', required=False, help="the directory where to install the uforge-scan.bin binary used to execute the deep scan") optional.add_argument('--exclude', dest='exclude', nargs='+', required=False, help="a list of directories or files to exclude during the deep scan") return doParser
def arg_delete(self): doParser = ArgumentParser(prog=self.cmd_name+" delete", add_help = True, description="Deletes an existing scan") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the scan to delete") return doParser
def arg_create(self): doParser = ArgumentParser(prog=self.cmd_name+" create", add_help = True, description="Creates a new cloud account") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="json file providing the cloud account parameters") return doParser
def arg_build(self): doParser = ArgumentParser(prog=self.cmd_name+" build", add_help = True, description="Builds a machine image from a scan") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the scan to generate the machine image from") mandatory.add_argument('--file', dest='file', required=True, help="json file providing the builder parameters") return doParser
def arg_delete(self): doParser = ArgumentParser(prog=self.cmd_name+" delete", add_help = True, description="Deletes a machine image or publish information") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the machine image to delete") return doParser
def arg_cancel(self): doParser = ArgumentParser(prog=self.cmd_name+" cancel", add_help = True, description="Cancels a machine image build or publish") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the machine image to cancel") return doParser
def arg_download(self): doParser = ArgumentParser(prog=self.cmd_name+" download", add_help = True, description="Downloads a machine image to the local filesystem") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--id', dest='id', required=True, help="the ID of the machine image to delete") mandatory.add_argument('--file', dest='file', required=True, help="the pathname where to store the machine image") return doParser
def arg_import(self): doParser = ArgumentParser(prog=self.cmd_name+" import", add_help = True, description="Creates a template from an archive") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="the path of the archive") return doParser
def arg_validate(self): doParser = ArgumentParser(prog=self.cmd_name+" validate", add_help = True, description="Validates the syntax of a template configuration file") mandatory = doParser.add_argument_group("mandatory arguments") mandatory.add_argument('--file', dest='file', required=True, help="the json template configuration file") return doParser