Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def update(cls, resource, name, size, snapshot_profile,
background, cmdline=None, kernel=None):
if isinstance(size, tuple):
prefix, size = size
if prefix == '+':
disk_info = cls.info(resource)
... | [
" Update this disk. "
] |
Please provide a description of the function:def _detach(cls, disk_id):
disk = cls._info(disk_id)
opers = []
if disk.get('vms_id'):
for vm_id in disk['vms_id']:
cls.echo('The disk is still attached to the vm %s.' % vm_id)
cls.echo('Will detach... | [
" Detach a disk from a vm. "
] |
Please provide a description of the function:def delete(cls, resources, background=False):
if not isinstance(resources, (list, tuple)):
resources = [resources]
resources = [cls.usable_id(item) for item in resources]
opers = []
for disk_id in resources:
... | [
" Delete this disk."
] |
Please provide a description of the function:def _attach(cls, disk_id, vm_id, options=None):
options = options or {}
oper = cls.call('hosting.vm.disk_attach', vm_id, disk_id, options)
return oper | [
" Attach a disk to a vm. "
] |
Please provide a description of the function:def create(cls, name, vm, size, snapshotprofile, datacenter,
source, disk_type='data', background=False):
if isinstance(size, tuple):
prefix, size = size
if source:
size = None
disk_params = cls.disk_pa... | [
" Create a disk and attach it to a vm. "
] |
Please provide a description of the function:def rollback(cls, resource, background=False):
disk_id = cls.usable_id(resource)
result = cls.call('hosting.disk.rollback_from', disk_id)
if background:
return result
cls.echo('Disk rollback in progress.')
cls.di... | [
" Rollback a disk from a snapshot. "
] |
Please provide a description of the function:def migrate(cls, resource, datacenter_id, background=False):
disk_id = cls.usable_id(resource)
result = cls.call('hosting.disk.migrate', disk_id, datacenter_id)
if background:
return result
cls.echo('Disk migration in pr... | [
" Migrate a disk to another datacenter. "
] |
Please provide a description of the function:def compatcallback(f):
if getattr(click, '__version__', '0.0') >= '2.0':
return f
return update_wrapper(lambda ctx, value: f(ctx, None, value), f) | [
" Compatibility callback decorator for older click version.\n\n Click 1.0 does not have a version string stored, so we need to\n use getattr here to be safe.\n "
] |
Please provide a description of the function:def format_commands(self, ctx, formatter):
rows = []
all_cmds = self.list_all_commands(ctx)
for cmd_name in sorted(all_cmds):
cmd = all_cmds[cmd_name]
help = cmd.short_help or ''
rows.append((cmd_name, hel... | [
"Extra format methods for multi methods that adds all the commands\n after the options.\n\n Display custom help for all subcommands.\n "
] |
Please provide a description of the function:def list_sub_commmands(self, cmd_name, cmd):
ret = {}
if isinstance(cmd, click.core.Group):
for sub_cmd_name in cmd.commands:
sub_cmd = cmd.commands[sub_cmd_name]
sub = self.list_sub_commmands(sub_cmd_name,... | [
"Return all commands for a group"
] |
Please provide a description of the function:def load_commands(self):
command_folder = os.path.join(os.path.dirname(__file__),
'..', 'commands')
command_dirs = {
'gandi.cli': command_folder
}
if 'GANDICLI_PATH' in os.environ:
... | [
" Load cli commands from submodules. "
] |
Please provide a description of the function:def invoke(self, ctx):
ctx.obj = GandiContextHelper(verbose=ctx.obj['verbose'])
click.Group.invoke(self, ctx) | [
" Invoke command in context. "
] |
Please provide a description of the function:def from_name(cls, name):
sshkeys = cls.list({'name': name})
if len(sshkeys) == 1:
return sshkeys[0]['id']
elif not sshkeys:
return
raise DuplicateResults('sshkey name %s is ambiguous.' % name) | [
"Retrieve a sshkey id associated to a name."
] |
Please provide a description of the function:def usable_id(cls, id):
try:
# id is maybe a sshkey name
qry_id = cls.from_name(id)
if not qry_id:
qry_id = int(id)
except DuplicateResults as exc:
cls.error(exc.errors)
except E... | [
" Retrieve id from input which can be name or id."
] |
Please provide a description of the function:def create(cls, name, value):
sshkey_params = {
'name': name,
'value': value,
}
result = cls.call('hosting.ssh.create', sshkey_params)
return result | [
" Create a new ssh key."
] |
Please provide a description of the function:def convert_sshkey(cls, sshkey):
params = {}
if sshkey:
params['keys'] = []
for ssh in sshkey:
if os.path.exists(os.path.expanduser(ssh)):
if 'ssh_key' in params:
cls... | [
" Return dict param with valid entries for vm/paas methods. "
] |
Please provide a description of the function:def get_api_connector(cls):
if cls._api is None: # pragma: no cover
cls.load_config()
cls.debug('initialize connection to remote server')
apihost = cls.get('api.host')
if not apihost:
raise Mis... | [
" Initialize an api connector for future use."
] |
Please provide a description of the function:def call(cls, method, *args, **kwargs):
api = None
empty_key = kwargs.pop('empty_key', False)
try:
api = cls.get_api_connector()
apikey = cls.get('api.key')
if not apikey and not empty_key:
... | [
" Call a remote api method and return the result."
] |
Please provide a description of the function:def safe_call(cls, method, *args):
return cls.call(method, *args, safe=True) | [
" Call a remote api method but don't raise if an error occurred."
] |
Please provide a description of the function:def json_call(cls, method, url, **kwargs):
# retrieve api key if needed
empty_key = kwargs.pop('empty_key', False)
send_key = kwargs.pop('send_key', True)
return_header = kwargs.pop('return_header', False)
try:
api... | [
" Call a remote api using json format "
] |
Please provide a description of the function:def intty(cls):
# XXX: temporary hack until we can detect if we are in a pipe or not
return True
if hasattr(sys.stdout, 'isatty') and sys.stdout.isatty():
return True
return False | [
" Check if we are in a tty. "
] |
Please provide a description of the function:def pretty_echo(cls, message):
if cls.intty():
if message:
from pprint import pprint
pprint(message) | [
" Display message using pretty print formatting. "
] |
Please provide a description of the function:def separator_line(cls, sep='-', size=10):
if cls.intty():
cls.echo(sep * size) | [
" Display a separator line. "
] |
Please provide a description of the function:def separator_sub_line(cls, sep='-', size=10):
if cls.intty():
cls.echo("\t" + sep * size) | [
" Display a separator line. "
] |
Please provide a description of the function:def dump(cls, message):
if cls.verbose > 2:
msg = '[DUMP] %s' % message
cls.echo(msg) | [
" Display dump message if verbose level allows it. "
] |
Please provide a description of the function:def debug(cls, message):
if cls.verbose > 1:
msg = '[DEBUG] %s' % message
cls.echo(msg) | [
" Display debug message if verbose level allows it. "
] |
Please provide a description of the function:def log(cls, message):
if cls.verbose > 0:
msg = '[INFO] %s' % message
cls.echo(msg) | [
" Display info message if verbose level allows it. "
] |
Please provide a description of the function:def execute(cls, command, shell=True):
cls.debug('execute command (shell flag:%r): %r ' % (shell, command))
try:
check_call(command, shell=shell)
return True
except CalledProcessError:
return False | [
" Execute a shell command. "
] |
Please provide a description of the function:def exec_output(cls, command, shell=True, encoding='utf-8'):
proc = Popen(command, shell=shell, stdout=PIPE)
stdout, _stderr = proc.communicate()
if proc.returncode == 0:
return stdout.decode(encoding)
return '' | [
" Return execution output\n\n :param encoding: charset used to decode the stdout\n :type encoding: str\n\n :return: the return of the command\n :rtype: unicode string\n "
] |
Please provide a description of the function:def update_progress(cls, progress, starttime):
width, _height = click.get_terminal_size()
if not width:
return
duration = datetime.utcnow() - starttime
hours, remainder = divmod(duration.seconds, 3600)
minutes, se... | [
" Display an ascii progress bar while processing operation. "
] |
Please provide a description of the function:def display_progress(cls, operations):
start_crea = datetime.utcnow()
# count number of operations, 3 steps per operation
if not isinstance(operations, (list, tuple)):
operations = [operations]
count_operations = len(oper... | [
" Display progress of Gandi operations.\n\n polls API every 1 seconds to retrieve status.\n "
] |
Please provide a description of the function:def load_modules(self):
module_folder = os.path.join(os.path.dirname(__file__),
'..', 'modules')
module_dirs = {
'gandi.cli': module_folder
}
if 'GANDICLI_PATH' in os.environ:
... | [
" Import CLI commands modules. "
] |
Please provide a description of the function:def request(self, method, apikey, *args, **kwargs):
dry_run = kwargs.get('dry_run', False)
return_dry_run = kwargs.get('return_dry_run', False)
if return_dry_run:
args[-1]['--dry-run'] = True
try:
func = getat... | [
" Make a xml-rpc call to remote API. "
] |
Please provide a description of the function:def request(cls, method, url, **kwargs):
user_agent = 'gandi.cli/%s' % __version__
headers = {'User-Agent': user_agent,
'Content-Type': 'application/json; charset=utf-8'}
if kwargs.get('headers'):
headers.updat... | [
"Make a http call to a remote API and return a json response."
] |
Please provide a description of the function:def docker(gandi, vm, args):
if not [basedir for basedir in os.getenv('PATH', '.:/usr/bin').split(':')
if os.path.exists('%s/docker' % basedir)]:
gandi.echo()
return
if vm:
gandi.configure(True, 'dockervm', vm)
else:
... | [
"\n Manage docker instance\n ",
"'docker' not found in $PATH, required for this command \\\nto work\nSee https://docs.docker.com/installation/#installation to install, or use:\n # curl https://get.docker.io/ | sh",
"\nNo docker vm specified. You can create one:\n $ gandi vm create --hostname docker ... |
Please provide a description of the function:def query(cls, resources, time_range, query, resource_type, sampler):
if not isinstance(resources, (list, tuple)):
resources = [resources]
now = time.time()
start_utc = datetime.utcfromtimestamp(now - time_range)
end_utc ... | [
"Query statistics for given resources."
] |
Please provide a description of the function:def resource_list(cls):
items = cls.list({'items_per_page': 500})
ret = [vm['hostname'] for vm in items]
ret.extend([str(vm['id']) for vm in items])
return ret | [
" Get the possible list of resources (hostname, id). "
] |
Please provide a description of the function:def required_max_memory(cls, id, memory):
best = int(max(2 ** math.ceil(math.log(memory, 2)), 2048))
actual_vm = cls.info(id)
if (actual_vm['state'] == 'running'
and actual_vm['vm_max_memory'] != best):
return be... | [
"\n Recommend a max_memory setting for this vm given memory. If the\n VM already has a nice setting, return None. The max_memory\n param cannot be fixed too high, because page table allocation\n would cost too much for small memory profile. Use a range as below.\n "
] |
Please provide a description of the function:def update(cls, id, memory, cores, console, password, background,
max_memory):
if not background and not cls.intty():
background = True
vm_params = {}
if memory:
vm_params['memory'] = memory
i... | [
"Update a virtual machine."
] |
Please provide a description of the function:def create(cls, datacenter, memory, cores, ip_version, bandwidth,
login, password, hostname, image, run, background, sshkey,
size, vlan, ip, script, script_args, ssh):
from gandi.cli.modules.network import Ip, Iface
if n... | [
"Create a new virtual machine."
] |
Please provide a description of the function:def need_finalize(cls, resource):
vm_id = cls.usable_id(resource)
params = {'type': 'hosting_migration_vm',
'step': 'RUN',
'vm_id': vm_id}
result = cls.call('operation.list', params)
if not result o... | [
"Check if vm migration need to be finalized."
] |
Please provide a description of the function:def check_can_migrate(cls, resource):
vm_id = cls.usable_id(resource)
result = cls.call('hosting.vm.can_migrate', vm_id)
if not result['can_migrate']:
if result['matched']:
matched = result['matched'][0]
... | [
"Check if virtual machine can be migrated to another datacenter."
] |
Please provide a description of the function:def migrate(cls, resource, background=False, finalize=False):
vm_id = cls.usable_id(resource)
if finalize:
verb = 'Finalizing'
result = cls.call('hosting.vm.migrate', vm_id, True)
else:
verb = 'Starting'
... | [
" Migrate a virtual machine to another datacenter. "
] |
Please provide a description of the function:def from_hostname(cls, hostname):
result = cls.list({'hostname': str(hostname)})
if result:
return result[0]['id'] | [
"Retrieve virtual machine id associated to a hostname."
] |
Please provide a description of the function:def vm_ip(cls, vm_id):
vm_info = cls.info(vm_id)
for iface in vm_info['ifaces']:
if iface['type'] == 'private':
continue
for ip in iface['ips']:
return ip['version'], ip['ip'] | [
"Return the first usable ip address for this vm.\n Returns a (version, ip) tuple."
] |
Please provide a description of the function:def wait_for_sshd(cls, vm_id):
cls.echo('Waiting for the vm to come online')
version, ip_addr = cls.vm_ip(vm_id)
give_up = time.time() + 300
last_error = None
while time.time() < give_up:
try:
inet ... | [
"Insist on having the vm booted and sshd\n listening"
] |
Please provide a description of the function:def ssh_keyscan(cls, vm_id):
cls.echo('Wiping old key and learning the new one')
_version, ip_addr = cls.vm_ip(vm_id)
cls.execute('ssh-keygen -R "%s"' % ip_addr)
for _ in range(5):
output = cls.exec_output('ssh-keyscan "%... | [
"Wipe this old key and learn the new one from a freshly\n created vm. This is a security risk for this VM, however\n we dont have another way to learn the key yet, so do this\n for the user."
] |
Please provide a description of the function:def scp(cls, vm_id, login, identity, local_file, remote_file):
cmd = ['scp']
if identity:
cmd.extend(('-i', identity,))
version, ip_addr = cls.vm_ip(vm_id)
if version == 6:
ip_addr = '[%s]' % ip_addr
... | [
"Copy file to remote VM."
] |
Please provide a description of the function:def ssh(cls, vm_id, login, identity, args=None):
cmd = ['ssh']
if identity:
cmd.extend(('-i', identity,))
version, ip_addr = cls.vm_ip(vm_id)
if version == 6:
cmd.append('-6')
if not ip_addr:
... | [
"Spawn an ssh session to virtual machine."
] |
Please provide a description of the function:def console(cls, id):
vm_info = cls.info(id)
if not vm_info['console']:
# first activate console
cls.update(id, memory=None, cores=None, console=True,
password=None, background=False, max_memory=None)
... | [
"Open a console to virtual machine."
] |
Please provide a description of the function:def is_deprecated(cls, label, datacenter=None):
images = cls.list(datacenter, label)
images_visibility = dict([(image['label'], image['visibility'])
for image in images])
return images_visibility.get(label, '... | [
"Check if image if flagged as deprecated."
] |
Please provide a description of the function:def from_label(cls, label, datacenter=None):
result = cls.list(datacenter=datacenter)
image_labels = dict([(image['label'], image['disk_id'])
for image in result])
return image_labels.get(label) | [
"Retrieve disk image id associated to a label."
] |
Please provide a description of the function:def from_sysdisk(cls, label):
disks = cls.safe_call('hosting.disk.list', {'name': label})
if len(disks):
return disks[0]['id'] | [
"Retrieve disk id from available system disks"
] |
Please provide a description of the function:def usable_id(cls, id, datacenter=None):
try:
qry_id = int(id)
except Exception:
# if id is a string, prefer a system disk then a label
qry_id = cls.from_sysdisk(id) or cls.from_label(id, datacenter)
if no... | [
" Retrieve id from input which can be label or id."
] |
Please provide a description of the function:def list(cls, datacenter=None, flavor=None, match='', exact_match=False):
if not datacenter:
dc_ids = [dc['id'] for dc in Datacenter.filtered_list()]
kmap = {}
for dc_id in dc_ids:
vals = cls.safe_call('hos... | [
" List available kernels for datacenter."
] |
Please provide a description of the function:def is_available(cls, disk, kernel):
kmap = cls.list(disk['datacenter_id'], None, kernel, True)
for flavor in kmap:
if kernel in kmap[flavor]:
return True
return False | [
" Check if kernel is available for disk."
] |
Please provide a description of the function:def clone(cls, name, vhost, directory, origin):
paas_info = cls.info(name)
if 'php' in paas_info['type'] and not vhost:
cls.error('PHP instances require indicating the VHOST to clone '
'with --vhost <vhost>')
... | [
"Clone a PaaS instance's vhost into a local git repository."
] |
Please provide a description of the function:def attach(cls, name, vhost, remote_name):
paas_access = cls.get('paas_access')
if not paas_access:
paas_info = cls.info(name)
paas_access = '%s@%s' \
% (paas_info['user'], paas_info['git_server'])
... | [
"Attach an instance's vhost to a remote from the local repository."
] |
Please provide a description of the function:def deploy(cls, remote_name, branch):
def get_remote_url(remote):
return 'git config --local --get remote.%s.url' % (remote)
remote_url = cls.exec_output(get_remote_url(remote_name)) \
.replace('\n', '')
if not remot... | [
"Deploy a PaaS instance.",
"This usually happens when:\n- the current directory has no Simple Hosting git remote attached,\n in this case, please see $ gandi paas attach --help\n- the local branch being deployed hasn't been pushed to the \\\nremote repository yet,\n in this case, please try $ git push <remote> ... |
Please provide a description of the function:def quota(cls, id):
sampler = {'unit': 'minutes', 'value': 1, 'function': 'avg'}
query = 'vfs.df.bytes.all'
metrics = Metric.query(id, 60, query, 'paas', sampler)
df = {'free': 0, 'used': 0}
for metric in metrics:
... | [
"return disk quota used/free"
] |
Please provide a description of the function:def cache(cls, id):
sampler = {'unit': 'days', 'value': 1, 'function': 'sum'}
query = 'webacc.requests.cache.all'
metrics = Metric.query(id, 60 * 60 * 24, query, 'paas', sampler)
cache = {'hit': 0, 'miss': 0, 'not': 0, 'pass': 0}
... | [
"return the number of query cache for the last 24H"
] |
Please provide a description of the function:def update(cls, id, name, size, quantity, password, sshkey, upgrade,
console, snapshot_profile, reset_mysql_password, background):
if not background and not cls.intty():
background = True
paas_params = {}
if name:... | [
"Update a PaaS instance."
] |
Please provide a description of the function:def create(cls, name, size, type, quantity, duration, datacenter, vhosts,
password, snapshot_profile, background, sshkey):
if not background and not cls.intty():
background = True
datacenter_id_ = int(Datacenter.usable_id(... | [
"Create a new PaaS instance."
] |
Please provide a description of the function:def resource_list(cls):
items = cls.list({'items_per_page': 500})
ret = [paas['name'] for paas in items]
ret.extend([str(paas['id']) for paas in items])
for paas in items:
paas = cls.info(paas['id'])
ret.extend... | [
" Get the possible list of resources (name, id and vhosts). "
] |
Please provide a description of the function:def console(cls, id):
oper = cls.call('paas.update', cls.usable_id(id), {'console': 1})
cls.echo('Activation of the console on your PaaS instance')
cls.display_progress(oper)
console_url = Paas.info(cls.usable_id(id))['console']
... | [
"Open a console to a PaaS instance."
] |
Please provide a description of the function:def from_vhost(cls, vhost):
result = Vhost().list()
paas_hosts = {}
for host in result:
paas_hosts[host['name']] = host['paas_id']
return paas_hosts.get(vhost) | [
"Retrieve paas instance id associated to a vhost."
] |
Please provide a description of the function:def from_hostname(cls, hostname):
result = cls.list({'items_per_page': 500})
paas_hosts = {}
for host in result:
paas_hosts[host['name']] = host['id']
return paas_hosts.get(hostname) | [
"Retrieve paas instance id associated to a host."
] |
Please provide a description of the function:def list_names(cls):
ret = dict([(item['id'], item['name'])
for item in cls.list({'items_per_page': 500})])
return ret | [
"Retrieve paas id and names."
] |
Please provide a description of the function:def from_cn(cls, common_name):
# search with cn
result_cn = [(cert['id'], [cert['cn']] + cert['altnames'])
for cert in cls.list({'status': ['pending', 'valid'],
'items_per_page': 500,
... | [
" Retrieve a certificate by its common name. "
] |
Please provide a description of the function:def usable_ids(cls, id, accept_multi=True):
try:
qry_id = [int(id)]
except ValueError:
try:
qry_id = cls.from_cn(id)
except Exception:
qry_id = None
if not qry_id or not acc... | [
" Retrieve id from input which can be an id or a cn."
] |
Please provide a description of the function:def package_list(cls, options=None):
options = options or {}
try:
return cls.safe_call('cert.package.list', options)
except UsageError as err:
if err.code == 150020:
return []
raise | [
" List possible certificate packages."
] |
Please provide a description of the function:def advice_dcv_method(cls, csr, package, altnames, dcv_method,
cert_id=None):
params = {'csr': csr, 'package': package, 'dcv_method': dcv_method}
if cert_id:
params['cert_id'] = cert_id
result = cls.call(... | [
" Display dcv_method information. "
] |
Please provide a description of the function:def create(cls, csr, duration, package, altnames=None, dcv_method=None):
params = {'csr': csr, 'package': package, 'duration': duration}
if altnames:
params['altnames'] = altnames
if dcv_method:
params['dcv_method'] = ... | [
" Create a new certificate. "
] |
Please provide a description of the function:def update(cls, cert_id, csr, private_key, country, state, city,
organisation, branch, altnames, dcv_method):
cert = cls.info(cert_id)
if cert['status'] != 'valid':
cls.error('The certificate must be in valid status to be u... | [
" Update a certificate. "
] |
Please provide a description of the function:def create_csr(cls, common_name, private_key=None, params=None):
params = params or []
params = [(key, val) for key, val in params if val]
subj = '/' + '/'.join(['='.join(value) for value in params])
cmd, private_key = cls.gen_pk(co... | [
" Create CSR. "
] |
Please provide a description of the function:def get_common_name(cls, csr):
from tempfile import NamedTemporaryFile
fhandle = NamedTemporaryFile()
fhandle.write(csr.encode('latin1'))
fhandle.flush()
output = cls.exec_output('openssl req -noout -subject -in %s' %
... | [
" Read information from CSR. "
] |
Please provide a description of the function:def process_csr(cls, common_name, csr=None, private_key=None,
country=None, state=None, city=None, organisation=None,
branch=None):
if csr:
if branch or organisation or city or state or country:
... | [
" Create a PK and a CSR if needed."
] |
Please provide a description of the function:def pretty_format_cert(cls, cert):
crt = cert.get('cert')
if crt:
crt = ('-----BEGIN CERTIFICATE-----\n' +
'\n'.join([crt[index * 64:(index + 1) * 64]
for index in range(int(len(crt) / 64) ... | [
" Pretty display of a certificate."
] |
Please provide a description of the function:def delete(cls, cert_id, background=False):
result = cls.call('cert.delete', cert_id)
if background:
return result
cls.echo("Deleting your certificate.")
cls.display_progress(result)
cls.echo('Your certificate %s... | [
" Delete a certificate."
] |
Please provide a description of the function:def create_dry_run(cls, params):
return cls.call('contact.create', dict(params), empty_key=True,
dry_run=True, return_dry_run=True) | [
"Create a new contact."
] |
Please provide a description of the function:def list(gandi, limit, format):
options = {
'items_per_page': limit,
}
result = gandi.webacc.list(options)
if format:
output_json(gandi, format, result)
return result
output_keys = ['name', 'state', 'ssl']
for num, webac... | [
" List webaccelerators "
] |
Please provide a description of the function:def info(gandi, resource, format):
result = gandi.webacc.info(resource)
if format:
output_json(gandi, format, result)
return result
output_base = {
'name': result['name'],
'algorithm': result['lb']['algorithm'],
'data... | [
" Display information about a webaccelerator "
] |
Please provide a description of the function:def create(gandi, name, datacenter, backend, port, vhost, algorithm,
ssl_enable, zone_alter, ssl, private_key, poll_cert):
try:
gandi.datacenter.is_opened(datacenter, 'iaas')
except DatacenterLimited as exc:
gandi.echo('/!\ Datacenter ... | [
" Create a webaccelerator "
] |
Please provide a description of the function:def update(gandi, resource, name, algorithm, ssl_enable, ssl_disable):
result = gandi.webacc.update(resource, name, algorithm, ssl_enable,
ssl_disable)
return result | [
"Update a webaccelerator"
] |
Please provide a description of the function:def delete(gandi, webacc, vhost, backend, port):
result = []
if webacc:
result = gandi.webacc.delete(webacc)
if backend:
backends = backend
for backend in backends:
if 'port' not in backend:
if not port:
... | [
" Delete a webaccelerator, a vhost or a backend "
] |
Please provide a description of the function:def add(gandi, resource, vhost, zone_alter, backend, port, ssl, private_key,
poll_cert):
result = []
if backend:
backends = backend
for backend in backends:
# Check if a port is set for each backend, else set a default port
... | [
" Add a backend or a vhost on a webaccelerator "
] |
Please provide a description of the function:def enable(gandi, resource, backend, port, probe):
result = []
if backend:
backends = backend
for backend in backends:
if 'port' not in backend:
if not port:
backend['port'] = click.prompt('Please s... | [
" Enable a backend or a probe on a webaccelerator "
] |
Please provide a description of the function:def disable(gandi, resource, backend, port, probe):
result = []
if backend:
backends = backend
for backend in backends:
if 'port' not in backend:
if not port:
backend['port'] = click.prompt('Please ... | [
" Disable a backend or a probe on a webaccelerator "
] |
Please provide a description of the function:def probe(gandi, resource, enable, disable, test, host, interval, http_method,
http_response, threshold, timeout, url, window):
result = gandi.webacc.probe(resource, enable, disable, test, host,
interval, http_method, http_r... | [
" Manage a probe for a webaccelerator "
] |
Please provide a description of the function:def domain_list(gandi):
domains = gandi.dns.list()
for domain in domains:
gandi.echo(domain['fqdn'])
return domains | [
"List domains manageable by REST API."
] |
Please provide a description of the function:def list(gandi, fqdn, name, sort, type, rrset_type, text):
domains = gandi.dns.list()
domains = [domain['fqdn'] for domain in domains]
if fqdn not in domains:
gandi.echo('Sorry domain %s does not exist' % fqdn)
gandi.echo('Please use one of t... | [
"Display records for a domain."
] |
Please provide a description of the function:def create(gandi, fqdn, name, type, value, ttl):
domains = gandi.dns.list()
domains = [domain['fqdn'] for domain in domains]
if fqdn not in domains:
gandi.echo('Sorry domain %s does not exist' % fqdn)
gandi.echo('Please use one of the followi... | [
"Create new record entry for a domain.\n\n multiple value parameters can be provided.\n "
] |
Please provide a description of the function:def update(gandi, fqdn, name, type, value, ttl, file):
domains = gandi.dns.list()
domains = [domain['fqdn'] for domain in domains]
if fqdn not in domains:
gandi.echo('Sorry domain %s does not exist' % fqdn)
gandi.echo('Please use one of the f... | [
"Update record entry for a domain.\n\n --file option will ignore other parameters and overwrite current zone\n content with provided file content.\n "
] |
Please provide a description of the function:def delete(gandi, fqdn, name, type, force):
domains = gandi.dns.list()
domains = [domain['fqdn'] for domain in domains]
if fqdn not in domains:
gandi.echo('Sorry domain %s does not exist' % fqdn)
gandi.echo('Please use one of the following: %... | [
"Delete record entry for a domain."
] |
Please provide a description of the function:def keys_list(gandi, fqdn):
keys = gandi.dns.keys(fqdn)
output_keys = ['uuid', 'algorithm', 'algorithm_name', 'ds', 'flags',
'status']
for num, key in enumerate(keys):
if num:
gandi.separator_line()
output_gener... | [
"List domain keys."
] |
Please provide a description of the function:def keys_info(gandi, fqdn, key):
key_info = gandi.dns.keys_info(fqdn, key)
output_keys = ['uuid', 'algorithm', 'algorithm_name', 'ds', 'fingerprint',
'public_key', 'flags', 'tag', 'status']
output_generic(gandi, key_info, output_keys, just... | [
"Display information about a domain key."
] |
Please provide a description of the function:def keys_create(gandi, fqdn, flag):
key_info = gandi.dns.keys_create(fqdn, int(flag))
output_keys = ['uuid', 'algorithm', 'algorithm_name', 'ds', 'fingerprint',
'public_key', 'flags', 'tag', 'status']
output_generic(gandi, key_info, outpu... | [
"Create key for a domain."
] |
Please provide a description of the function:def keys_delete(gandi, fqdn, key, force):
if not force:
proceed = click.confirm('Are you sure you want to delete key %s on '
'domain %s?' % (key, fqdn))
if not proceed:
return
result = gandi.dns.keys_... | [
"Delete a key for a domain."
] |
Please provide a description of the function:def keys_recover(gandi, fqdn, key):
result = gandi.dns.keys_recover(fqdn, key)
gandi.echo('Recover successful.')
return result | [
"Recover deleted key for a domain."
] |
Please provide a description of the function:def handle(cls, vm, args):
docker = Iaas.info(vm)
if not docker:
raise Exception('docker vm %s not found' % vm)
if docker['state'] != 'running':
Iaas.start(vm)
# XXX
remote_addr = docker['ifaces'][0][... | [
"\n Setup forwarding connection to given VM and pipe docker cmds over SSH.\n "
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.