コード例 #1
0
ファイル: common.py プロジェクト: shupp/VegaDNS-CLI
def cli(ctx, environment, debug=False):
    """A command line interface for managing VegaDNS"""
    if debug:
        http_client.HTTPConnection.debuglevel = 1

        logging.basicConfig(level=logging.DEBUG)
        logging.getLogger().setLevel(logging.DEBUG)

        requests_log = logging.getLogger("requests.packages.urllib3")
        requests_log.setLevel(logging.DEBUG)
        requests_log.propagate = True

    # manage config
    if environment != 'default' and environment not in config_obj.sections():
        config_obj.add_section(environment)

    key = config_obj.get(environment, 'key')
    secret = config_obj.get(environment, 'secret')
    host = config_obj.get(environment, 'host')

    ctx.obj['config'] = config_obj
    ctx.obj['environment'] = environment

    local_commands = ['config', 'upgrade']
    if ctx.invoked_subcommand not in local_commands:
        store = AccessTokenStoreFile(
            key,
            secret,
            host,
            prefix=".vegadns-access-token-" + environment + "-"
        )
        ctx.obj['client'] = client(key, secret, host, store)
コード例 #2
0
ファイル: common.py プロジェクト: dentm42/VegaDNS-CLI
def cli(ctx, environment, debug=False):
    """A command line interface for managing VegaDNS"""
    if debug:
        http_client.HTTPConnection.debuglevel = 1

        logging.basicConfig(level=logging.DEBUG)
        logging.getLogger().setLevel(logging.DEBUG)

        requests_log = logging.getLogger("requests.packages.urllib3")
        requests_log.setLevel(logging.DEBUG)
        requests_log.propagate = True

    # manage config
    if environment != 'default' and environment not in config_obj.sections():
        config_obj.add_section(environment)

    key = config_obj.get(environment, 'key')
    secret = config_obj.get(environment, 'secret')
    host = config_obj.get(environment, 'host')

    ctx.obj['config'] = config_obj
    ctx.obj['environment'] = environment

    local_commands = ['config', 'upgrade']
    if ctx.invoked_subcommand not in local_commands:
        store = AccessTokenStoreFile(key,
                                     secret,
                                     host,
                                     prefix=".vegadns-access-token-" +
                                     environment + "-")
        ctx.obj['client'] = client(key, secret, host, store)
コード例 #3
0
ファイル: test_domain.py プロジェクト: shupp/VegaDNS-CLI
    def setUp(self):
        dk = "6d145840921dabcc85907bff35e607289abdad04b7900196ee45f5a4e12ac369"
        ds = "b1163b6387318dbfebaca5740ddb024ad61fa18831bb887ea085036f8df9c180"
        dh = "http://localhost:80"
        dn = "localhost"

        k = os.getenv("KEY", default=dk)
        s = os.getenv("SECRET", default=ds)
        h = os.getenv("HOST", default=dh)
        n = os.getenv("NAMESERVER", default=dn)

        self.ns_server = n
        self.client = vegadns_client.client(k, s, h)
        self.remove_token_file()

        self.domain = self.client.domains.create("example.com")
        self.ptrdomain = self.client.domains.create("in-addr.arpa")
        self.ip6ptrdomain = self.client.domains.create("ip6.arpa")
コード例 #4
0
ファイル: test_domain.py プロジェクト: dentm42/VegaDNS-CLI
    def setUp(self):
        dk = "6d145840921dabcc85907bff35e607289abdad04b7900196ee45f5a4e12ac369"
        ds = "b1163b6387318dbfebaca5740ddb024ad61fa18831bb887ea085036f8df9c180"
        dh = "http://localhost:80"
        dn = "localhost"

        k = os.getenv("KEY", default=dk)
        s = os.getenv("SECRET", default=ds)
        h = os.getenv("HOST", default=dh)
        n = os.getenv("NAMESERVER", default=dn)

        self.ns_server = n
        self.client = vegadns_client.client(k, s, h)
        self.remove_token_file()

        self.domain = self.client.domains.create("example.com")
        self.ptrdomain = self.client.domains.create("in-addr.arpa")
        self.ip6ptrdomain = self.client.domains.create("ip6.arpa")