Esempio n. 1
0
from oslocfg import cfg

# CONF is global var
CONF = cfg.CONF

_cli_opts = [
    cfg.StrOpt('name',
               short='n',
               required=True,
               help='Gopcdn resource for objfile'),
]

CONF.register_cli_opts(_cli_opts)
CONF()
Esempio n. 2
0
from oslocfg import cfg

CONF = cfg.CONF

ddns_opts = [
    cfg.StrOpt('domain', required=True, help='Ddns domain'),
    cfg.StrOpt('subdomain', required=True, help='Ddns sub domain'),
    cfg.StrOpt('plugin', default='dnspod', help='ddns notify plugin'),
    cfg.StrOpt('ethernet', short='i', help='External ethernet interface name'),
    cfg.StrOpt('etype',
               short='e',
               choices=['dhcp', 'pppoe'],
               default='pppoe',
               help='External ipaddres fetch type'),
    cfg.StrOpt(
        'datadir',
        default='/var/lib/simpleddns',
        help=
        'External ipaddres data path, point to the state directory of systemd'
    ),
    cfg.IntOpt('timeout',
               short='t',
               min=10,
               max=180,
               default=30,
               help='Ddns process Max run time'),
    cfg.StrOpt('guess',
               default='udp',
               help='Guess the external ipaddr by action'),
    cfg.BoolOpt('force', default=False, help='Force update ddns server'),
    cfg.BoolOpt('logging', default=False, help='Logging on'),
Esempio n. 3
0
from oslocfg import cfg

CONF = cfg.CONF

NAME = 'ddns.dnspod'

opts = [
    cfg.StrOpt('api',
               default='https://dnsapi.cn',
               help='Dnspod modify recode api address'),
    cfg.IntOpt('id', help='Dnspod api token id'),
    cfg.StrOpt('token', secret=True, help='Dnspod api token'),
    cfg.IntOpt('record_id', help='Sub domain record id on dnspod'),
    cfg.IntOpt('timeout',
               max=30,
               min=1,
               default=5,
               help='Dnspod api request timeout')
]


def register_opts():
    group = cfg.OptGroup(NAME)
    CONF.register_group(group)
    CONF.register_opts(opts, group)
    conf = CONF[NAME]

    if not conf.id:
        raise ValueError('dnspod id can not be found')

    if not conf.token:
Esempio n. 4
0
import collections
import logging
import operator
import sys
import textwrap

import six
import traceback

from oslocfg import cfg

LOG = logging.getLogger(__name__)

_generator_opts = [
    cfg.StrOpt('output-file',
               help='Path of the file to write to. Defaults to stdout.'),
    cfg.IntOpt('wrap-width',
               default=70,
               help='The maximum length of help lines.'),
    cfg.MultiStrOpt('opts',
                    required=True,
                    default=[],
                    help='Function query for options'),
    cfg.MultiStrOpt('updates',
                    default=[],
                    help='Function reset default value of opts'),
]


def import_class(import_str):
    """Returns a class from a string including module and class.