Example #1
0
    def do_install(cli_args, client):
        """
        Install a DNS server.
        """

        return ClientRequestBuilderBase._format_request(
            ['dns', 'install']
        )
Example #2
0
    def do_get_zone(cli_args, client):
        """
        Retrieve a zone.
        """

        return ClientRequestBuilderBase._format_request(
            ['dns', 'get_zone'], {
                'domain': cli_args.domain
            }
        )
Example #3
0
    def do_deploy(cli_args, client):
        """
        Deploy a site from a profile.
        """

        return ClientRequestBuilderBase._format_request(
            ['site', 'deploy'], {
                'profile': cli_args.profile,
                'domain':  cli_args.domain,
            }
        )
Example #4
0
    def do_rm_record(cli_args, client):
        """
        Remove a record.
        """

        args = {
            'zone': cli_args.zone,
            'record': {
                'name':    cli_args.name,
                'type':    cli_args.type,
                'content': cli_args.content,
            },
        }

        return ClientRequestBuilderBase._format_request(
            ['dns', 'rm_record'], args
        )
Example #5
0
    def do_add_record(cli_args, client):
        """
        Add a record to an existing zone.
        """

        args = {
            'zone': cli_args.zone,
            'record': {
                'name':     cli_args.name,
                'type':     cli_args.type,
                'content':  cli_args.content,
                'ttl':      int(cli_args.ttl),
                'priority': int(cli_args.priority),
            },
        }

        if args['record']['priority'] == -1:
            args['record']['priority'] = None

        return ClientRequestBuilderBase._format_request(
            ['dns', 'add_record'], args
        )
Example #6
0
    def do_add_zone(cli_args, client):
        """
        Add a zone.
        """

        args = {'zone': {}, 'soa': {}}

        for a in ClientRequestBuilder.ZONE_ATTR_INT:
            args['zone'][a] = int(getattr(cli_args, a))
        for a in ClientRequestBuilder.ZONE_ATTR_STR:
            args['zone'][a] = getattr(cli_args, a)

        for a in ClientRequestBuilder.SOA_ATTR_INT:
            args['soa'][a] = int(getattr(cli_args, "soa_%s" %(a)))
        for a in ClientRequestBuilder.SOA_ATTR_STR:
            args['soa'][a] = getattr(cli_args, "soa_%s" %(a))

        for a in ['origin', 'ttl']:
            if args['zone'][a] == -1:
                args['zone'][a] = None

        return ClientRequestBuilderBase._format_request(
            ['dns', 'add_zone'], args
        )
Example #7
0
 def do_load_averages(cli_args, client):
     return ClientRequestBuilderBase._format_request(
         ['health', 'load_averages']
     )