Exemplo n.º 1
0
 def arg_batch(self):
     doParser = ArgumentParser(
         "batch",
         add_help=False,
         description=
         "Execute uforge-cli batch command from a file (for scripting)")
     mandatory = doParser.add_argument_group("mandatory arguments")
     optionnal = doParser.add_argument_group("optional arguments")
     mandatory.add_argument('--file',
                            dest='file',
                            required=True,
                            help="uforge-cli batch file commands")
     optionnal.add_argument(
         '-f',
         '--fatal',
         dest='fatal',
         action='store_true',
         required=False,
         help="exit on first error in batch file (default is to continue)")
     # Help is not call at the doParser declaration because it would create two separate argument group for optional arguments.
     optionnal.add_argument('-h',
                            '--help',
                            action='help',
                            help="show this help message and exit")
     return doParser
Exemplo n.º 2
0
 def arg_remove(self):
     do_parser = ArgumentParser(
         prog=self.cmd_name + " remove",
         add_help=True,
         description=
         "Remove a user as an administrator of subscription profiles")
     mandatory = do_parser.add_argument_group("mandatory arguments")
     mandatory.add_argument('--name',
                            dest='name',
                            required=True,
                            help="the name of the subscription profile")
     mandatory.add_argument(
         '--admins',
         dest='admins',
         nargs='+',
         required=True,
         help=
         "the login names of the users to be removed from the the subscription profile administrators"
     )
     optional = do_parser.add_argument_group("optional arguments")
     optional.add_argument(
         '--org',
         dest='org',
         required=False,
         help=
         "the organization name. If no organization is provided, then the default organization is used."
     )
     return do_parser
Exemplo n.º 3
0
 def arg_update(self):
     do_parser = ArgumentParser(
         prog=self.cmd_name + " update",
         add_help=True,
         description="Updates a new subscription profile")
     mandatory = do_parser.add_argument_group("mandatory arguments")
     mandatory.add_argument(
         '--name',
         dest='name',
         required=True,
         help="the name of the subscription profile to update")
     optional = do_parser.add_argument_group("optional arguments")
     optional.add_argument(
         '--description',
         dest='description',
         required=False,
         help="the description of the subscription profile to update")
     optional.add_argument(
         '--active',
         dest='active',
         required=False,
         help="flag to make the subscription profile active.")
     optional.add_argument(
         '--org',
         dest='org',
         required=False,
         help=
         "the organization name. If no organization is provided, then the default organization is used."
     )
     return do_parser
Exemplo n.º 4
0
    def arg_add(self):
        do_parser = ArgumentParser(
            prog=self.cmd_name + " add",
            add_help=True,
            description=
            "Add one or more roles to the user (note the role(s) must exist in the organization where the user is a member)"
        )

        mandatory = do_parser.add_argument_group("mandatory arguments")
        optional = do_parser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--account',
            dest='account',
            required=True,
            help=
            "user name of the account for which the current command should be executed"
        )
        mandatory.add_argument(
            '--roles',
            dest='roles',
            nargs='+',
            required=True,
            help=
            "a list of roles to be added to this user (example: --roles \"role1 role2 role3\"). For a list of available roles, run the command: uforge role list --org <org name>"
        )

        optional.add_argument(
            '--org',
            dest='org',
            required=False,
            help=
            "the organization name. If no organization is provided, then the default organization is used."
        )
        return do_parser
Exemplo n.º 5
0
    def arg_removeTargetPlatform(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "Remove one or more target platforms from a target format in the organization"
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--id',
            dest='id',
            type=str,
            required=True,
            help="Id of the target format to remove to target platforms.")
        mandatory.add_argument(
            '--targetPlatforms',
            dest='targetPlatforms',
            nargs='+',
            required=True,
            help="target platform(s) in which remove the target format.")
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )

        return doParser
Exemplo n.º 6
0
    def arg_remove(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "Remove user account from the default organization or from the provided one"
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--account',
            dest='account',
            type=str,
            required=True,
            help=
            "User name of the account for which the current command should be executed"
        )
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization where the user is/will be a member/administrator (depending on command context). If no organization is provided, then the default organization is used."
        )

        return doParser
Exemplo n.º 7
0
    def arg_remove(self):
        do_parser = ArgumentParser(
            prog=self.cmd_name + " remove",
            add_help=True,
            description=
            "Remove one or more entitlements to a role within the specified organization"
        )

        mandatory = do_parser.add_argument_group("mandatory arguments")

        mandatory.add_argument(
            '--account',
            dest='account',
            required=True,
            help=
            "user name of the account for which the current command should be executed"
        )
        mandatory.add_argument(
            '--roles',
            dest='roles',
            nargs='+',
            required=True,
            help=
            "a list of roles to be removed (example: --roles \"role1 role2 role3\")."
        )
        return do_parser
Exemplo n.º 8
0
 def arg_list(self):
     do_parser = ArgumentParser(prog=self.cmd_name + " list", add_help=True,
                                description="List all the roles for a given organization.  If not organization is provided the default organization is used.")
     optional = do_parser.add_argument_group("optional arguments")
     optional.add_argument('--org', dest='org', required=False,
                           help="the organization name. If no organization is provided, then the default organization is used.")
     return do_parser
 def arg_remove(self):
     do_parser = ArgumentParser(
         prog=self.cmd_name + " remove",
         add_help=True,
         description=
         "Remove one or several roles from a subscription profile")
     mandatory = do_parser.add_argument_group("mandatory arguments")
     mandatory.add_argument('--name',
                            dest='name',
                            required=True,
                            help="the name of the subscription profile")
     mandatory.add_argument(
         '--roles',
         dest='roles',
         nargs='+',
         required=True,
         help="the roles to add to the subscription profile")
     optional = do_parser.add_argument_group("optional arguments")
     optional.add_argument(
         '--org',
         dest='org',
         required=False,
         help=
         "the organization name. If no organization is provided, then the default organization is used."
     )
     return do_parser
Exemplo n.º 10
0
 def arg_run(self):
     do_parser = ArgumentParser(
         prog=self.cmd_name + " run",
         add_help=True,
         description="Executes a deep scan of a running system")
     mandatory = do_parser.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 = do_parser.add_argument_group("optional arguments")
     optional.add_argument('--scan-port',
                           dest='port',
                           required=False,
                           help="the ssh port of the running system")
     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")
     optional.add_argument(
         '-o',
         '--overlay',
         dest='overlay',
         action='store_true',
         required=False,
         help="perform a scan with overlay into the given scanned instance")
     optional.add_argument(
         '--identity-file',
         dest='id_file',
         required=False,
         help=
         "the file containing the private ssh key used to connect to the source machine"
     )
     return do_parser
Exemplo n.º 11
0
    def arg_add(self):
        doParser = ArgumentParser(
            prog=self.cmd_name + " add",
            add_help=True,
            description=
            "Add one or more entitlements to a role within the specified organization"
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument('--name',
                               dest='name',
                               required=True,
                               help="The name of role")
        mandatory.add_argument(
            '--entitlements',
            dest='entitlements',
            nargs='+',
            required=True,
            help=
            "List of entitlements to add to a role. You can use Unix matching system (*,?,[seq],[!seq]) and multiple match separating by space."
        )
        optional.add_argument(
            '--org',
            dest='org',
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )
        return doParser
Exemplo n.º 12
0
    def arg_create(self):
        doParser = ArgumentParser(
            add_help=True,
            description="Create one or more categories in the organization")

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--name',
            dest='name',
            type=str,
            required=True,
            help="Name of the category to create in the organization.")
        mandatory.add_argument(
            '--type',
            dest='type',
            type=str,
            required=True,
            help=
            "Type of the category to create in the organization. Possible values are : TEMPLATE, PROJECT, IMAGEFORMAT."
        )
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )
        return doParser
Exemplo n.º 13
0
    def arg_delete(self):
        doParser = ArgumentParser(
            add_help=True,
            description="Delete one or more categories in the organization")

        optional = doParser.add_argument_group("optional arguments")

        optional.add_argument(
            '--name',
            dest='name',
            nargs='+',
            required=False,
            help=
            "One or more categories to delete (category names provided) in the organization.  Names separated by commas (e.g. cat 1, cat 2, cat 3)."
        )
        optional.add_argument(
            '--ids',
            dest='ids',
            nargs='+',
            required=False,
            help=
            "One or more categories to delete (category Ids provided) in the organization.  Ids separated by commas (e.g. id1, id2, id3)."
        )
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )
        return doParser
Exemplo n.º 14
0
    def arg_info(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "Prints out all the information for a user group within an organization"
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument('--name',
                               dest='name',
                               type=str,
                               required=True,
                               help="Name of the user group")
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )

        return doParser
Exemplo n.º 15
0
 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(
         '-r',
         '--rbundles',
         dest='rbundles',
         action='store_true',
         help=
         'if a bundle already exists, use it in the new template. Warning: this option ignore the content of the bundle described in the template file',
         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
Exemplo n.º 16
0
    def arg_delete(self):
        doParser = ArgumentParser(
            add_help=True,
            description="Delete a repository in the organization")

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--ids',
            dest='ids',
            nargs='+',
            required=True,
            help=
            "One or more repositories to delete (repository Ids provided) in the organization.  Ids separated by space (e.g. 1 2 3)"
        )
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )

        return doParser
Exemplo n.º 17
0
 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="yaml/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)
     optional.add_argument('--force',
                           dest='forced',
                           action='store_true',
                           help='Force the checking dependencies',
                           required=False)
     return doParser
Exemplo n.º 18
0
    def arg_list(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "List all the repositories for the provided organization")

        optional = doParser.add_argument_group("optional arguments")

        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )
        optional.add_argument(
            '--sortField',
            dest='sort',
            type=str,
            required=False,
            help=
            "Sort the repository list by a field between Name, ID, Url and Type"
        )

        return doParser
Exemplo n.º 19
0
 def arg_list(self):
     doParser = ArgumentParser(
         prog=self.cmd_name + " list",
         add_help=True,
         description="Displays all the deployments and instances information"
     )
     return doParser
Exemplo n.º 20
0
    def arg_list(self):
        doParser = ArgumentParser(
            prog=self.cmd_name + " list",
            add_help=True,
            description="List all milestones from a distribution.")

        mandatory = doParser.add_argument_group("mandatory arguments")

        mandatory.add_argument(
            '--darch',
            dest='darch',
            required=True,
            help="Operating system architecture (i386, x86_64).")
        mandatory.add_argument(
            '--dname',
            dest='dname',
            required=True,
            help=
            "Operating system(s) name (for example CentOS, Debian etc) for which the current command should be executed."
        )
        mandatory.add_argument('--dversion',
                               dest='dversion',
                               required=True,
                               help="Operating system version (13, 5.6, ...).")
        return doParser
Exemplo n.º 21
0
    def arg_list(self):
        do_parser = ArgumentParser(
            prog=self.cmd_name + " list",
            add_help=True,
            description="Display the current list of roles for the user")

        mandatory = do_parser.add_argument_group("mandatory arguments")
        optional = do_parser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--account',
            dest='account',
            required=True,
            help=
            "User name of the account for which the current command should be executed"
        )

        optional.add_argument(
            '--org',
            dest='org',
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )
        return do_parser
Exemplo n.º 22
0
    def arg_remove(self):
        doParser = ArgumentParser(
            prog=self.cmd_name + " remove",
            add_help=True,
            description="Remove a milestone from an operating system.")

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--darch',
            dest='darch',
            required=True,
            help="Operating system architecture (i386, x86_64).")
        mandatory.add_argument(
            '--dname',
            dest='dname',
            required=True,
            help=
            "Operating system(s) name (for example CentOS, Debian etc) for which the current command should be executed."
        )
        mandatory.add_argument('--dversion',
                               dest='dversion',
                               required=True,
                               help="Operating system version (13, 5.6, ...).")
        mandatory.add_argument('--name',
                               dest='name',
                               required=True,
                               help="The name of the milestone.")
        return doParser
Exemplo n.º 23
0
    def arg_listTargetPlatform(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "List all target platform in the provided target format in the organization"
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--id',
            dest='id',
            type=str,
            required=True,
            help="Id of the target format you want to list target platforms.")
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )

        return doParser
Exemplo n.º 24
0
 def arg_delete(self):
     doParser = ArgumentParser(
         prog=self.cmd_name + " delete",
         add_help=True,
         description="Deletes an existing instance or scan")
     mandatory = doParser.add_argument_group("mandatory arguments")
     mandatory.add_argument('--id',
                            dest='id',
                            required=True,
                            help="the ID of the instance or scan to delete")
     optional = doParser.add_argument_group("optional arguments")
     optional.add_argument(
         '--scantype',
         dest='scantype',
         required=False,
         help=
         "the scan type, values is [instance|scan|all] (default is scan)")
     optional.add_argument(
         '--scansonly',
         dest='scansonly',
         required=False,
         action='store_true',
         help=
         "if scan type is instance, and this argument is used, will only remove the scans not the instance itself"
     )
     return doParser
Exemplo n.º 25
0
    def arg_disable(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "Disable one or more target formats for the provided organization."
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--targetFormats',
            dest='targetFormats',
            nargs='+',
            required=True,
            help=
            "Target Format(s) for which the current command should be executed. You can use Unix matching system (*,?,[seq],[!seq]) and multiple match separating by space."
        )
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )

        return doParser
Exemplo n.º 26
0
    def arg_disable(self):
        doParser = ArgumentParser(prog=self.cmd_name + " disable", add_help=True, description="Disable provided user. This is restricted to administrators.")
        mandatory = doParser.add_argument_group("mandatory arguments")

        mandatory.add_argument('--account', dest='account', required=True,
                               help="user name of the account for which the current command should be executed")
        return doParser
Exemplo n.º 27
0
 def arg_add(self):
     do_parser = ArgumentParser(
         prog=self.cmd_name + " add",
         add_help=True,
         description="Add a user as a subscription profile administrator.")
     mandatory = do_parser.add_argument_group("mandatory arguments")
     mandatory.add_argument('--name',
                            dest='name',
                            required=True,
                            help="the name of the subscription profile")
     mandatory.add_argument(
         '--admins',
         dest='admins',
         nargs='+',
         required=True,
         help=
         "the login names to add as new subscription profile administrators."
     )
     optional = do_parser.add_argument_group("optional arguments")
     optional.add_argument(
         '--org',
         dest='org',
         required=False,
         help=
         "the organization name. If no organization is provided, then the default organization is used."
     )
     return do_parser
Exemplo n.º 28
0
 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 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"
     )
     optional.add_argument(
         '--outputFormat',
         dest='output_format',
         required=False,
         help=
         "output format (yaml or json) of the template file to export (yaml is the default one)"
     )
     return doParser
Exemplo n.º 29
0
    def arg_create(self):
        doParser = ArgumentParser(add_help=True,
                                  description="Create new organization")

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--org',
            dest='org',
            type=str,
            required=True,
            help="Name of organization which should be created.")
        optional.add_argument(
            '--autoActivate',
            dest='autoActivate',
            action="store_true",
            required=False,
            help="Flag to tell if organization auto activates new users or not."
        )
        optional.add_argument(
            '--hasStore',
            dest='hasStore',
            action="store_true",
            required=False,
            help="Flag to tell if organization has a Store or not.")
        return doParser
Exemplo n.º 30
0
    def arg_addTargetFormat(self):
        doParser = ArgumentParser(
            add_help=True,
            description=
            "Add one or more target formats to a target platform in the organization"
        )

        mandatory = doParser.add_argument_group("mandatory arguments")
        optional = doParser.add_argument_group("optional arguments")

        mandatory.add_argument(
            '--id',
            dest='id',
            type=str,
            required=True,
            help="Id of the target platform where adding target formats.")
        mandatory.add_argument(
            '--targetFormats',
            dest='targetFormats',
            nargs='+',
            required=True,
            help="target format(s) to put in the target platform.")
        optional.add_argument(
            '--org',
            dest='org',
            type=str,
            required=False,
            help=
            "The organization name. If no organization is provided, then the default organization is used."
        )

        return doParser