id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12,500 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | get_previous_request | def get_previous_request(rid):
"""Return the last ceph broker request sent on a given relation
@param rid: Relation id to query for request
"""
request = None
broker_req = relation_get(attribute='broker_req', rid=rid,
unit=local_unit())
if broker_req:
reque... | python | def get_previous_request(rid):
"""Return the last ceph broker request sent on a given relation
@param rid: Relation id to query for request
"""
request = None
broker_req = relation_get(attribute='broker_req', rid=rid,
unit=local_unit())
if broker_req:
reque... | [
"def",
"get_previous_request",
"(",
"rid",
")",
":",
"request",
"=",
"None",
"broker_req",
"=",
"relation_get",
"(",
"attribute",
"=",
"'broker_req'",
",",
"rid",
"=",
"rid",
",",
"unit",
"=",
"local_unit",
"(",
")",
")",
"if",
"broker_req",
":",
"request_... | Return the last ceph broker request sent on a given relation
@param rid: Relation id to query for request | [
"Return",
"the",
"last",
"ceph",
"broker",
"request",
"sent",
"on",
"a",
"given",
"relation"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1351-L1365 |
12,501 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | get_request_states | def get_request_states(request, relation='ceph'):
"""Return a dict of requests per relation id with their corresponding
completion state.
This allows a charm, which has a request for ceph, to see whether there is
an equivalent request already being processed and if so what state that
request is ... | python | def get_request_states(request, relation='ceph'):
"""Return a dict of requests per relation id with their corresponding
completion state.
This allows a charm, which has a request for ceph, to see whether there is
an equivalent request already being processed and if so what state that
request is ... | [
"def",
"get_request_states",
"(",
"request",
",",
"relation",
"=",
"'ceph'",
")",
":",
"complete",
"=",
"[",
"]",
"requests",
"=",
"{",
"}",
"for",
"rid",
"in",
"relation_ids",
"(",
"relation",
")",
":",
"complete",
"=",
"False",
"previous_request",
"=",
... | Return a dict of requests per relation id with their corresponding
completion state.
This allows a charm, which has a request for ceph, to see whether there is
an equivalent request already being processed and if so what state that
request is in.
@param request: A CephBrokerRq object | [
"Return",
"a",
"dict",
"of",
"requests",
"per",
"relation",
"id",
"with",
"their",
"corresponding",
"completion",
"state",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1368-L1395 |
12,502 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | is_request_sent | def is_request_sent(request, relation='ceph'):
"""Check to see if a functionally equivalent request has already been sent
Returns True if a similair request has been sent
@param request: A CephBrokerRq object
"""
states = get_request_states(request, relation=relation)
for rid in states.keys():... | python | def is_request_sent(request, relation='ceph'):
"""Check to see if a functionally equivalent request has already been sent
Returns True if a similair request has been sent
@param request: A CephBrokerRq object
"""
states = get_request_states(request, relation=relation)
for rid in states.keys():... | [
"def",
"is_request_sent",
"(",
"request",
",",
"relation",
"=",
"'ceph'",
")",
":",
"states",
"=",
"get_request_states",
"(",
"request",
",",
"relation",
"=",
"relation",
")",
"for",
"rid",
"in",
"states",
".",
"keys",
"(",
")",
":",
"if",
"not",
"states... | Check to see if a functionally equivalent request has already been sent
Returns True if a similair request has been sent
@param request: A CephBrokerRq object | [
"Check",
"to",
"see",
"if",
"a",
"functionally",
"equivalent",
"request",
"has",
"already",
"been",
"sent"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1398-L1410 |
12,503 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | is_request_complete_for_rid | def is_request_complete_for_rid(request, rid):
"""Check if a given request has been completed on the given relation
@param request: A CephBrokerRq object
@param rid: Relation ID
"""
broker_key = get_broker_rsp_key()
for unit in related_units(rid):
rdata = relation_get(rid=rid, unit=unit... | python | def is_request_complete_for_rid(request, rid):
"""Check if a given request has been completed on the given relation
@param request: A CephBrokerRq object
@param rid: Relation ID
"""
broker_key = get_broker_rsp_key()
for unit in related_units(rid):
rdata = relation_get(rid=rid, unit=unit... | [
"def",
"is_request_complete_for_rid",
"(",
"request",
",",
"rid",
")",
":",
"broker_key",
"=",
"get_broker_rsp_key",
"(",
")",
"for",
"unit",
"in",
"related_units",
"(",
"rid",
")",
":",
"rdata",
"=",
"relation_get",
"(",
"rid",
"=",
"rid",
",",
"unit",
"=... | Check if a given request has been completed on the given relation
@param request: A CephBrokerRq object
@param rid: Relation ID | [
"Check",
"if",
"a",
"given",
"request",
"has",
"been",
"completed",
"on",
"the",
"given",
"relation"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1429-L1459 |
12,504 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | send_request_if_needed | def send_request_if_needed(request, relation='ceph'):
"""Send broker request if an equivalent request has not already been sent
@param request: A CephBrokerRq object
"""
if is_request_sent(request, relation=relation):
log('Request already sent but not complete, not sending new request',
... | python | def send_request_if_needed(request, relation='ceph'):
"""Send broker request if an equivalent request has not already been sent
@param request: A CephBrokerRq object
"""
if is_request_sent(request, relation=relation):
log('Request already sent but not complete, not sending new request',
... | [
"def",
"send_request_if_needed",
"(",
"request",
",",
"relation",
"=",
"'ceph'",
")",
":",
"if",
"is_request_sent",
"(",
"request",
",",
"relation",
"=",
"relation",
")",
":",
"log",
"(",
"'Request already sent but not complete, not sending new request'",
",",
"level"... | Send broker request if an equivalent request has not already been sent
@param request: A CephBrokerRq object | [
"Send",
"broker",
"request",
"if",
"an",
"equivalent",
"request",
"has",
"not",
"already",
"been",
"sent"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1471-L1482 |
12,505 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | is_broker_action_done | def is_broker_action_done(action, rid=None, unit=None):
"""Check whether broker action has completed yet.
@param action: name of action to be performed
@returns True if action complete otherwise False
"""
rdata = relation_get(rid, unit) or {}
broker_rsp = rdata.get(get_broker_rsp_key())
if ... | python | def is_broker_action_done(action, rid=None, unit=None):
"""Check whether broker action has completed yet.
@param action: name of action to be performed
@returns True if action complete otherwise False
"""
rdata = relation_get(rid, unit) or {}
broker_rsp = rdata.get(get_broker_rsp_key())
if ... | [
"def",
"is_broker_action_done",
"(",
"action",
",",
"rid",
"=",
"None",
",",
"unit",
"=",
"None",
")",
":",
"rdata",
"=",
"relation_get",
"(",
"rid",
",",
"unit",
")",
"or",
"{",
"}",
"broker_rsp",
"=",
"rdata",
".",
"get",
"(",
"get_broker_rsp_key",
"... | Check whether broker action has completed yet.
@param action: name of action to be performed
@returns True if action complete otherwise False | [
"Check",
"whether",
"broker",
"action",
"has",
"completed",
"yet",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1485-L1504 |
12,506 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | mark_broker_action_done | def mark_broker_action_done(action, rid=None, unit=None):
"""Mark action as having been completed.
@param action: name of action to be performed
@returns None
"""
rdata = relation_get(rid, unit) or {}
broker_rsp = rdata.get(get_broker_rsp_key())
if not broker_rsp:
return
rsp = ... | python | def mark_broker_action_done(action, rid=None, unit=None):
"""Mark action as having been completed.
@param action: name of action to be performed
@returns None
"""
rdata = relation_get(rid, unit) or {}
broker_rsp = rdata.get(get_broker_rsp_key())
if not broker_rsp:
return
rsp = ... | [
"def",
"mark_broker_action_done",
"(",
"action",
",",
"rid",
"=",
"None",
",",
"unit",
"=",
"None",
")",
":",
"rdata",
"=",
"relation_get",
"(",
"rid",
",",
"unit",
")",
"or",
"{",
"}",
"broker_rsp",
"=",
"rdata",
".",
"get",
"(",
"get_broker_rsp_key",
... | Mark action as having been completed.
@param action: name of action to be performed
@returns None | [
"Mark",
"action",
"as",
"having",
"been",
"completed",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1507-L1523 |
12,507 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | Pool.get_pgs | def get_pgs(self, pool_size, percent_data=DEFAULT_POOL_WEIGHT,
device_class=None):
"""Return the number of placement groups to use when creating the pool.
Returns the number of placement groups which should be specified when
creating the pool. This is based upon the calculation ... | python | def get_pgs(self, pool_size, percent_data=DEFAULT_POOL_WEIGHT,
device_class=None):
"""Return the number of placement groups to use when creating the pool.
Returns the number of placement groups which should be specified when
creating the pool. This is based upon the calculation ... | [
"def",
"get_pgs",
"(",
"self",
",",
"pool_size",
",",
"percent_data",
"=",
"DEFAULT_POOL_WEIGHT",
",",
"device_class",
"=",
"None",
")",
":",
"# Note: This calculation follows the approach that is provided",
"# by the Ceph PG Calculator located at http://ceph.com/pgcalc/.",
"vali... | Return the number of placement groups to use when creating the pool.
Returns the number of placement groups which should be specified when
creating the pool. This is based upon the calculation guidelines
provided by the Ceph Placement Group Calculator (located online at
http://ceph.com/... | [
"Return",
"the",
"number",
"of",
"placement",
"groups",
"to",
"use",
"when",
"creating",
"the",
"pool",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L199-L296 |
12,508 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | CephBrokerRq.add_op_create_replicated_pool | def add_op_create_replicated_pool(self, name, replica_count=3, pg_num=None,
weight=None, group=None, namespace=None,
app_name=None, max_bytes=None,
max_objects=None):
"""Adds an operation to create ... | python | def add_op_create_replicated_pool(self, name, replica_count=3, pg_num=None,
weight=None, group=None, namespace=None,
app_name=None, max_bytes=None,
max_objects=None):
"""Adds an operation to create ... | [
"def",
"add_op_create_replicated_pool",
"(",
"self",
",",
"name",
",",
"replica_count",
"=",
"3",
",",
"pg_num",
"=",
"None",
",",
"weight",
"=",
"None",
",",
"group",
"=",
"None",
",",
"namespace",
"=",
"None",
",",
"app_name",
"=",
"None",
",",
"max_by... | Adds an operation to create a replicated pool.
:param name: Name of pool to create
:type name: str
:param replica_count: Number of copies Ceph should keep of your data.
:type replica_count: int
:param pg_num: Request specific number of Placement Groups to create
... | [
"Adds",
"an",
"operation",
"to",
"create",
"a",
"replicated",
"pool",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1168-L1207 |
12,509 | juju/charm-helpers | charmhelpers/contrib/storage/linux/ceph.py | CephBrokerRq.add_op_create_erasure_pool | def add_op_create_erasure_pool(self, name, erasure_profile=None,
weight=None, group=None, app_name=None,
max_bytes=None, max_objects=None):
"""Adds an operation to create a erasure coded pool.
:param name: Name of pool to create
... | python | def add_op_create_erasure_pool(self, name, erasure_profile=None,
weight=None, group=None, app_name=None,
max_bytes=None, max_objects=None):
"""Adds an operation to create a erasure coded pool.
:param name: Name of pool to create
... | [
"def",
"add_op_create_erasure_pool",
"(",
"self",
",",
"name",
",",
"erasure_profile",
"=",
"None",
",",
"weight",
"=",
"None",
",",
"group",
"=",
"None",
",",
"app_name",
"=",
"None",
",",
"max_bytes",
"=",
"None",
",",
"max_objects",
"=",
"None",
")",
... | Adds an operation to create a erasure coded pool.
:param name: Name of pool to create
:type name: str
:param erasure_profile: Name of erasure code profile to use. If not
set the ceph-mon unit handling the broker
request will set i... | [
"Adds",
"an",
"operation",
"to",
"create",
"a",
"erasure",
"coded",
"pool",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/storage/linux/ceph.py#L1209-L1240 |
12,510 | juju/charm-helpers | charmhelpers/contrib/charmsupport/nrpe.py | get_nagios_unit_name | def get_nagios_unit_name(relation_name='nrpe-external-master'):
"""
Return the nagios unit name prepended with host_context if needed
:param str relation_name: Name of relation nrpe sub joined to
"""
host_context = get_nagios_hostcontext(relation_name)
if host_context:
unit = "%s:%s" % ... | python | def get_nagios_unit_name(relation_name='nrpe-external-master'):
"""
Return the nagios unit name prepended with host_context if needed
:param str relation_name: Name of relation nrpe sub joined to
"""
host_context = get_nagios_hostcontext(relation_name)
if host_context:
unit = "%s:%s" % ... | [
"def",
"get_nagios_unit_name",
"(",
"relation_name",
"=",
"'nrpe-external-master'",
")",
":",
"host_context",
"=",
"get_nagios_hostcontext",
"(",
"relation_name",
")",
"if",
"host_context",
":",
"unit",
"=",
"\"%s:%s\"",
"%",
"(",
"host_context",
",",
"local_unit",
... | Return the nagios unit name prepended with host_context if needed
:param str relation_name: Name of relation nrpe sub joined to | [
"Return",
"the",
"nagios",
"unit",
"name",
"prepended",
"with",
"host_context",
"if",
"needed"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/charmsupport/nrpe.py#L341-L352 |
12,511 | juju/charm-helpers | charmhelpers/contrib/charmsupport/nrpe.py | copy_nrpe_checks | def copy_nrpe_checks(nrpe_files_dir=None):
"""
Copy the nrpe checks into place
"""
NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins'
if nrpe_files_dir is None:
# determine if "charmhelpers" is in CHARMDIR or CHARMDIR/hooks
for segment in ['.', 'hooks']:
nrpe_files_dir = o... | python | def copy_nrpe_checks(nrpe_files_dir=None):
"""
Copy the nrpe checks into place
"""
NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins'
if nrpe_files_dir is None:
# determine if "charmhelpers" is in CHARMDIR or CHARMDIR/hooks
for segment in ['.', 'hooks']:
nrpe_files_dir = o... | [
"def",
"copy_nrpe_checks",
"(",
"nrpe_files_dir",
"=",
"None",
")",
":",
"NAGIOS_PLUGINS",
"=",
"'/usr/local/lib/nagios/plugins'",
"if",
"nrpe_files_dir",
"is",
"None",
":",
"# determine if \"charmhelpers\" is in CHARMDIR or CHARMDIR/hooks",
"for",
"segment",
"in",
"[",
"'.... | Copy the nrpe checks into place | [
"Copy",
"the",
"nrpe",
"checks",
"into",
"place"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/charmsupport/nrpe.py#L413-L438 |
12,512 | juju/charm-helpers | charmhelpers/contrib/openstack/vaultlocker.py | write_vaultlocker_conf | def write_vaultlocker_conf(context, priority=100):
"""Write vaultlocker configuration to disk and install alternative
:param context: Dict of data from vault-kv relation
:ptype: context: dict
:param priority: Priority of alternative configuration
:ptype: priority: int"""
charm_vl_path = "/var/l... | python | def write_vaultlocker_conf(context, priority=100):
"""Write vaultlocker configuration to disk and install alternative
:param context: Dict of data from vault-kv relation
:ptype: context: dict
:param priority: Priority of alternative configuration
:ptype: priority: int"""
charm_vl_path = "/var/l... | [
"def",
"write_vaultlocker_conf",
"(",
"context",
",",
"priority",
"=",
"100",
")",
":",
"charm_vl_path",
"=",
"\"/var/lib/charm/{}/vaultlocker.conf\"",
".",
"format",
"(",
"hookenv",
".",
"service_name",
"(",
")",
")",
"host",
".",
"mkdir",
"(",
"os",
".",
"pa... | Write vaultlocker configuration to disk and install alternative
:param context: Dict of data from vault-kv relation
:ptype: context: dict
:param priority: Priority of alternative configuration
:ptype: priority: int | [
"Write",
"vaultlocker",
"configuration",
"to",
"disk",
"and",
"install",
"alternative"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/vaultlocker.py#L80-L96 |
12,513 | juju/charm-helpers | charmhelpers/contrib/openstack/vaultlocker.py | vault_relation_complete | def vault_relation_complete(backend=None):
"""Determine whether vault relation is complete
:param backend: Name of secrets backend requested
:ptype backend: string
:returns: whether the relation to vault is complete
:rtype: bool"""
vault_kv = VaultKVContext(secret_backend=backend or VAULTLOCKER... | python | def vault_relation_complete(backend=None):
"""Determine whether vault relation is complete
:param backend: Name of secrets backend requested
:ptype backend: string
:returns: whether the relation to vault is complete
:rtype: bool"""
vault_kv = VaultKVContext(secret_backend=backend or VAULTLOCKER... | [
"def",
"vault_relation_complete",
"(",
"backend",
"=",
"None",
")",
":",
"vault_kv",
"=",
"VaultKVContext",
"(",
"secret_backend",
"=",
"backend",
"or",
"VAULTLOCKER_BACKEND",
")",
"vault_kv",
"(",
")",
"return",
"vault_kv",
".",
"complete"
] | Determine whether vault relation is complete
:param backend: Name of secrets backend requested
:ptype backend: string
:returns: whether the relation to vault is complete
:rtype: bool | [
"Determine",
"whether",
"vault",
"relation",
"is",
"complete"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/vaultlocker.py#L99-L108 |
12,514 | juju/charm-helpers | charmhelpers/contrib/openstack/vaultlocker.py | retrieve_secret_id | def retrieve_secret_id(url, token):
"""Retrieve a response-wrapped secret_id from Vault
:param url: URL to Vault Server
:ptype url: str
:param token: One shot Token to use
:ptype token: str
:returns: secret_id to use for Vault Access
:rtype: str"""
import hvac
client = hvac.Client(u... | python | def retrieve_secret_id(url, token):
"""Retrieve a response-wrapped secret_id from Vault
:param url: URL to Vault Server
:ptype url: str
:param token: One shot Token to use
:ptype token: str
:returns: secret_id to use for Vault Access
:rtype: str"""
import hvac
client = hvac.Client(u... | [
"def",
"retrieve_secret_id",
"(",
"url",
",",
"token",
")",
":",
"import",
"hvac",
"client",
"=",
"hvac",
".",
"Client",
"(",
"url",
"=",
"url",
",",
"token",
"=",
"token",
")",
"response",
"=",
"client",
".",
"_post",
"(",
"'/v1/sys/wrapping/unwrap'",
"... | Retrieve a response-wrapped secret_id from Vault
:param url: URL to Vault Server
:ptype url: str
:param token: One shot Token to use
:ptype token: str
:returns: secret_id to use for Vault Access
:rtype: str | [
"Retrieve",
"a",
"response",
"-",
"wrapped",
"secret_id",
"from",
"Vault"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/vaultlocker.py#L112-L126 |
12,515 | juju/charm-helpers | charmhelpers/core/decorators.py | retry_on_exception | def retry_on_exception(num_retries, base_delay=0, exc_type=Exception):
"""If the decorated function raises exception exc_type, allow num_retries
retry attempts before raise the exception.
"""
def _retry_on_exception_inner_1(f):
def _retry_on_exception_inner_2(*args, **kwargs):
retrie... | python | def retry_on_exception(num_retries, base_delay=0, exc_type=Exception):
"""If the decorated function raises exception exc_type, allow num_retries
retry attempts before raise the exception.
"""
def _retry_on_exception_inner_1(f):
def _retry_on_exception_inner_2(*args, **kwargs):
retrie... | [
"def",
"retry_on_exception",
"(",
"num_retries",
",",
"base_delay",
"=",
"0",
",",
"exc_type",
"=",
"Exception",
")",
":",
"def",
"_retry_on_exception_inner_1",
"(",
"f",
")",
":",
"def",
"_retry_on_exception_inner_2",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs"... | If the decorated function raises exception exc_type, allow num_retries
retry attempts before raise the exception. | [
"If",
"the",
"decorated",
"function",
"raises",
"exception",
"exc_type",
"allow",
"num_retries",
"retry",
"attempts",
"before",
"raise",
"the",
"exception",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/decorators.py#L30-L55 |
12,516 | juju/charm-helpers | charmhelpers/fetch/snap.py | _snap_exec | def _snap_exec(commands):
"""
Execute snap commands.
:param commands: List commands
:return: Integer exit code
"""
assert type(commands) == list
retry_count = 0
return_code = None
while return_code is None or return_code == SNAP_NO_LOCK:
try:
return_code = subp... | python | def _snap_exec(commands):
"""
Execute snap commands.
:param commands: List commands
:return: Integer exit code
"""
assert type(commands) == list
retry_count = 0
return_code = None
while return_code is None or return_code == SNAP_NO_LOCK:
try:
return_code = subp... | [
"def",
"_snap_exec",
"(",
"commands",
")",
":",
"assert",
"type",
"(",
"commands",
")",
"==",
"list",
"retry_count",
"=",
"0",
"return_code",
"=",
"None",
"while",
"return_code",
"is",
"None",
"or",
"return_code",
"==",
"SNAP_NO_LOCK",
":",
"try",
":",
"re... | Execute snap commands.
:param commands: List commands
:return: Integer exit code | [
"Execute",
"snap",
"commands",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/fetch/snap.py#L48-L75 |
12,517 | juju/charm-helpers | charmhelpers/fetch/snap.py | snap_remove | def snap_remove(packages, *flags):
"""
Remove a snap package.
:param packages: String or List String package name
:param flags: List String flags to pass to remove command
:return: Integer return code from snap
"""
if type(packages) is not list:
packages = [packages]
flags = li... | python | def snap_remove(packages, *flags):
"""
Remove a snap package.
:param packages: String or List String package name
:param flags: List String flags to pass to remove command
:return: Integer return code from snap
"""
if type(packages) is not list:
packages = [packages]
flags = li... | [
"def",
"snap_remove",
"(",
"packages",
",",
"*",
"flags",
")",
":",
"if",
"type",
"(",
"packages",
")",
"is",
"not",
"list",
":",
"packages",
"=",
"[",
"packages",
"]",
"flags",
"=",
"list",
"(",
"flags",
")",
"message",
"=",
"'Removing snap(s) \"%s\"'",... | Remove a snap package.
:param packages: String or List String package name
:param flags: List String flags to pass to remove command
:return: Integer return code from snap | [
"Remove",
"a",
"snap",
"package",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/fetch/snap.py#L99-L117 |
12,518 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_v2_endpoint_data | def validate_v2_endpoint_data(self, endpoints, admin_port, internal_port,
public_port, expected):
"""Validate endpoint data.
Validate actual endpoint data vs expected endpoint data. The ports
are used to find the matching endpoint.
"""
... | python | def validate_v2_endpoint_data(self, endpoints, admin_port, internal_port,
public_port, expected):
"""Validate endpoint data.
Validate actual endpoint data vs expected endpoint data. The ports
are used to find the matching endpoint.
"""
... | [
"def",
"validate_v2_endpoint_data",
"(",
"self",
",",
"endpoints",
",",
"admin_port",
",",
"internal_port",
",",
"public_port",
",",
"expected",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating endpoint data...'",
")",
"self",
".",
"log",
".",
"de... | Validate endpoint data.
Validate actual endpoint data vs expected endpoint data. The ports
are used to find the matching endpoint. | [
"Validate",
"endpoint",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L102-L129 |
12,519 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_v3_endpoint_data | def validate_v3_endpoint_data(self, endpoints, admin_port, internal_port,
public_port, expected, expected_num_eps=3):
"""Validate keystone v3 endpoint data.
Validate the v3 endpoint data which has changed from v2. The
ports are used to find the matching endpoi... | python | def validate_v3_endpoint_data(self, endpoints, admin_port, internal_port,
public_port, expected, expected_num_eps=3):
"""Validate keystone v3 endpoint data.
Validate the v3 endpoint data which has changed from v2. The
ports are used to find the matching endpoi... | [
"def",
"validate_v3_endpoint_data",
"(",
"self",
",",
"endpoints",
",",
"admin_port",
",",
"internal_port",
",",
"public_port",
",",
"expected",
",",
"expected_num_eps",
"=",
"3",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating v3 endpoint data...'",... | Validate keystone v3 endpoint data.
Validate the v3 endpoint data which has changed from v2. The
ports are used to find the matching endpoint.
The new v3 endpoint data looks like:
[<Endpoint enabled=True,
id=0432655fc2f74d1e9fa17bdaa6f6e60b,
inte... | [
"Validate",
"keystone",
"v3",
"endpoint",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L131-L179 |
12,520 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.convert_svc_catalog_endpoint_data_to_v3 | def convert_svc_catalog_endpoint_data_to_v3(self, ep_data):
"""Convert v2 endpoint data into v3.
{
'service_name1': [
{
'adminURL': adminURL,
'id': id,
'region': region.
'pub... | python | def convert_svc_catalog_endpoint_data_to_v3(self, ep_data):
"""Convert v2 endpoint data into v3.
{
'service_name1': [
{
'adminURL': adminURL,
'id': id,
'region': region.
'pub... | [
"def",
"convert_svc_catalog_endpoint_data_to_v3",
"(",
"self",
",",
"ep_data",
")",
":",
"self",
".",
"log",
".",
"warn",
"(",
"\"Endpoint ID and Region ID validation is limited to not \"",
"\"null checks after v2 to v3 conversion\"",
")",
"for",
"svc",
"in",
"ep_data",
"."... | Convert v2 endpoint data into v3.
{
'service_name1': [
{
'adminURL': adminURL,
'id': id,
'region': region.
'publicURL': publicURL,
'internalURL': internalURL
... | [
"Convert",
"v2",
"endpoint",
"data",
"into",
"v3",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L181-L227 |
12,521 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_v2_svc_catalog_endpoint_data | def validate_v2_svc_catalog_endpoint_data(self, expected, actual):
"""Validate service catalog endpoint data.
Validate a list of actual service catalog endpoints vs a list of
expected service catalog endpoints.
"""
self.log.debug('Validating service catalog endpoint dat... | python | def validate_v2_svc_catalog_endpoint_data(self, expected, actual):
"""Validate service catalog endpoint data.
Validate a list of actual service catalog endpoints vs a list of
expected service catalog endpoints.
"""
self.log.debug('Validating service catalog endpoint dat... | [
"def",
"validate_v2_svc_catalog_endpoint_data",
"(",
"self",
",",
"expected",
",",
"actual",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating service catalog endpoint data...'",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'actual: {}'",
".",
"format"... | Validate service catalog endpoint data.
Validate a list of actual service catalog endpoints vs a list of
expected service catalog endpoints. | [
"Validate",
"service",
"catalog",
"endpoint",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L260-L275 |
12,522 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_v3_svc_catalog_endpoint_data | def validate_v3_svc_catalog_endpoint_data(self, expected, actual):
"""Validate the keystone v3 catalog endpoint data.
Validate a list of dictinaries that make up the keystone v3 service
catalogue.
It is in the form of:
{u'identity': [{u'id': u'48346b01c6804b298cdd7349aadb732e... | python | def validate_v3_svc_catalog_endpoint_data(self, expected, actual):
"""Validate the keystone v3 catalog endpoint data.
Validate a list of dictinaries that make up the keystone v3 service
catalogue.
It is in the form of:
{u'identity': [{u'id': u'48346b01c6804b298cdd7349aadb732e... | [
"def",
"validate_v3_svc_catalog_endpoint_data",
"(",
"self",
",",
"expected",
",",
"actual",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating v3 service catalog endpoint data...'",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'actual: {}'",
".",
"form... | Validate the keystone v3 catalog endpoint data.
Validate a list of dictinaries that make up the keystone v3 service
catalogue.
It is in the form of:
{u'identity': [{u'id': u'48346b01c6804b298cdd7349aadb732e',
u'interface': u'admin',
u'r... | [
"Validate",
"the",
"keystone",
"v3",
"catalog",
"endpoint",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L277-L341 |
12,523 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_tenant_data | def validate_tenant_data(self, expected, actual):
"""Validate tenant data.
Validate a list of actual tenant data vs list of expected tenant
data.
"""
self.log.debug('Validating tenant data...')
self.log.debug('actual: {}'.format(repr(actual)))
for e in e... | python | def validate_tenant_data(self, expected, actual):
"""Validate tenant data.
Validate a list of actual tenant data vs list of expected tenant
data.
"""
self.log.debug('Validating tenant data...')
self.log.debug('actual: {}'.format(repr(actual)))
for e in e... | [
"def",
"validate_tenant_data",
"(",
"self",
",",
"expected",
",",
"actual",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating tenant data...'",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'actual: {}'",
".",
"format",
"(",
"repr",
"(",
"actual... | Validate tenant data.
Validate a list of actual tenant data vs list of expected tenant
data. | [
"Validate",
"tenant",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L343-L363 |
12,524 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_user_data | def validate_user_data(self, expected, actual, api_version=None):
"""Validate user data.
Validate a list of actual user data vs a list of expected user
data.
"""
self.log.debug('Validating user data...')
self.log.debug('actual: {}'.format(repr(actual)))
... | python | def validate_user_data(self, expected, actual, api_version=None):
"""Validate user data.
Validate a list of actual user data vs a list of expected user
data.
"""
self.log.debug('Validating user data...')
self.log.debug('actual: {}'.format(repr(actual)))
... | [
"def",
"validate_user_data",
"(",
"self",
",",
"expected",
",",
"actual",
",",
"api_version",
"=",
"None",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating user data...'",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'actual: {}'",
".",
"forma... | Validate user data.
Validate a list of actual user data vs a list of expected user
data. | [
"Validate",
"user",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L386-L412 |
12,525 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_flavor_data | def validate_flavor_data(self, expected, actual):
"""Validate flavor data.
Validate a list of actual flavors vs a list of expected flavors.
"""
self.log.debug('Validating flavor data...')
self.log.debug('actual: {}'.format(repr(actual)))
act = [a.name for a in actu... | python | def validate_flavor_data(self, expected, actual):
"""Validate flavor data.
Validate a list of actual flavors vs a list of expected flavors.
"""
self.log.debug('Validating flavor data...')
self.log.debug('actual: {}'.format(repr(actual)))
act = [a.name for a in actu... | [
"def",
"validate_flavor_data",
"(",
"self",
",",
"expected",
",",
"actual",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Validating flavor data...'",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'actual: {}'",
".",
"format",
"(",
"repr",
"(",
"actual... | Validate flavor data.
Validate a list of actual flavors vs a list of expected flavors. | [
"Validate",
"flavor",
"data",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L414-L422 |
12,526 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.tenant_exists | def tenant_exists(self, keystone, tenant):
"""Return True if tenant exists."""
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
return tenant in [t.name for t in keystone.tenants.list()] | python | def tenant_exists(self, keystone, tenant):
"""Return True if tenant exists."""
self.log.debug('Checking if tenant exists ({})...'.format(tenant))
return tenant in [t.name for t in keystone.tenants.list()] | [
"def",
"tenant_exists",
"(",
"self",
",",
"keystone",
",",
"tenant",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Checking if tenant exists ({})...'",
".",
"format",
"(",
"tenant",
")",
")",
"return",
"tenant",
"in",
"[",
"t",
".",
"name",
"for",
"... | Return True if tenant exists. | [
"Return",
"True",
"if",
"tenant",
"exists",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L424-L427 |
12,527 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.keystone_wait_for_propagation | def keystone_wait_for_propagation(self, sentry_relation_pairs,
api_version):
"""Iterate over list of sentry and relation tuples and verify that
api_version has the expected value.
:param sentry_relation_pairs: list of sentry, relation name tuples used
... | python | def keystone_wait_for_propagation(self, sentry_relation_pairs,
api_version):
"""Iterate over list of sentry and relation tuples and verify that
api_version has the expected value.
:param sentry_relation_pairs: list of sentry, relation name tuples used
... | [
"def",
"keystone_wait_for_propagation",
"(",
"self",
",",
"sentry_relation_pairs",
",",
"api_version",
")",
":",
"for",
"(",
"sentry",
",",
"relation_name",
")",
"in",
"sentry_relation_pairs",
":",
"rel",
"=",
"sentry",
".",
"relation",
"(",
"'identity-service'",
... | Iterate over list of sentry and relation tuples and verify that
api_version has the expected value.
:param sentry_relation_pairs: list of sentry, relation name tuples used
for monitoring propagation of relation
data
... | [
"Iterate",
"over",
"list",
"of",
"sentry",
"and",
"relation",
"tuples",
"and",
"verify",
"that",
"api_version",
"has",
"the",
"expected",
"value",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L430-L448 |
12,528 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.keystone_configure_api_version | def keystone_configure_api_version(self, sentry_relation_pairs, deployment,
api_version):
"""Configure preferred-api-version of keystone in deployment and
monitor provided list of relation objects for propagation
before returning to caller.
:... | python | def keystone_configure_api_version(self, sentry_relation_pairs, deployment,
api_version):
"""Configure preferred-api-version of keystone in deployment and
monitor provided list of relation objects for propagation
before returning to caller.
:... | [
"def",
"keystone_configure_api_version",
"(",
"self",
",",
"sentry_relation_pairs",
",",
"deployment",
",",
"api_version",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"Setting keystone preferred-api-version: '{}'\"",
"\"\"",
".",
"format",
"(",
"api_version",
"... | Configure preferred-api-version of keystone in deployment and
monitor provided list of relation objects for propagation
before returning to caller.
:param sentry_relation_pairs: list of sentry, relation tuples used for
monitoring propagation of relati... | [
"Configure",
"preferred",
"-",
"api",
"-",
"version",
"of",
"keystone",
"in",
"deployment",
"and",
"monitor",
"provided",
"list",
"of",
"relation",
"objects",
"for",
"propagation",
"before",
"returning",
"to",
"caller",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L450-L468 |
12,529 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_cinder_admin | def authenticate_cinder_admin(self, keystone, api_version=2):
"""Authenticates admin user with cinder."""
self.log.debug('Authenticating cinder admin...')
_clients = {
1: cinder_client.Client,
2: cinder_clientv2.Client}
return _clients[api_version](session=keyston... | python | def authenticate_cinder_admin(self, keystone, api_version=2):
"""Authenticates admin user with cinder."""
self.log.debug('Authenticating cinder admin...')
_clients = {
1: cinder_client.Client,
2: cinder_clientv2.Client}
return _clients[api_version](session=keyston... | [
"def",
"authenticate_cinder_admin",
"(",
"self",
",",
"keystone",
",",
"api_version",
"=",
"2",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating cinder admin...'",
")",
"_clients",
"=",
"{",
"1",
":",
"cinder_client",
".",
"Client",
",",
"2"... | Authenticates admin user with cinder. | [
"Authenticates",
"admin",
"user",
"with",
"cinder",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L470-L476 |
12,530 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_keystone | def authenticate_keystone(self, keystone_ip, username, password,
api_version=False, admin_port=False,
user_domain_name=None, domain_name=None,
project_domain_name=None, project_name=None):
"""Authenticate with Keystone"""
... | python | def authenticate_keystone(self, keystone_ip, username, password,
api_version=False, admin_port=False,
user_domain_name=None, domain_name=None,
project_domain_name=None, project_name=None):
"""Authenticate with Keystone"""
... | [
"def",
"authenticate_keystone",
"(",
"self",
",",
"keystone_ip",
",",
"username",
",",
"password",
",",
"api_version",
"=",
"False",
",",
"admin_port",
"=",
"False",
",",
"user_domain_name",
"=",
"None",
",",
"domain_name",
"=",
"None",
",",
"project_domain_name... | Authenticate with Keystone | [
"Authenticate",
"with",
"Keystone"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L478-L503 |
12,531 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_keystone_session | def get_keystone_session(self, keystone_ip, username, password,
api_version=False, admin_port=False,
user_domain_name=None, domain_name=None,
project_domain_name=None, project_name=None):
"""Return a keystone session object""... | python | def get_keystone_session(self, keystone_ip, username, password,
api_version=False, admin_port=False,
user_domain_name=None, domain_name=None,
project_domain_name=None, project_name=None):
"""Return a keystone session object""... | [
"def",
"get_keystone_session",
"(",
"self",
",",
"keystone_ip",
",",
"username",
",",
"password",
",",
"api_version",
"=",
"False",
",",
"admin_port",
"=",
"False",
",",
"user_domain_name",
"=",
"None",
",",
"domain_name",
"=",
"None",
",",
"project_domain_name"... | Return a keystone session object | [
"Return",
"a",
"keystone",
"session",
"object"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L505-L532 |
12,532 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_keystone_endpoint | def get_keystone_endpoint(self, keystone_ip, api_version=None,
admin_port=False):
"""Return keystone endpoint"""
port = 5000
if admin_port:
port = 35357
base_ep = "http://{}:{}".format(keystone_ip.strip().decode('utf-8'),
... | python | def get_keystone_endpoint(self, keystone_ip, api_version=None,
admin_port=False):
"""Return keystone endpoint"""
port = 5000
if admin_port:
port = 35357
base_ep = "http://{}:{}".format(keystone_ip.strip().decode('utf-8'),
... | [
"def",
"get_keystone_endpoint",
"(",
"self",
",",
"keystone_ip",
",",
"api_version",
"=",
"None",
",",
"admin_port",
"=",
"False",
")",
":",
"port",
"=",
"5000",
"if",
"admin_port",
":",
"port",
"=",
"35357",
"base_ep",
"=",
"\"http://{}:{}\"",
".",
"format"... | Return keystone endpoint | [
"Return",
"keystone",
"endpoint"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L534-L546 |
12,533 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_default_keystone_session | def get_default_keystone_session(self, keystone_sentry,
openstack_release=None, api_version=2):
"""Return a keystone session object and client object assuming standard
default settings
Example call in amulet tests:
self.keystone_session,... | python | def get_default_keystone_session(self, keystone_sentry,
openstack_release=None, api_version=2):
"""Return a keystone session object and client object assuming standard
default settings
Example call in amulet tests:
self.keystone_session,... | [
"def",
"get_default_keystone_session",
"(",
"self",
",",
"keystone_sentry",
",",
"openstack_release",
"=",
"None",
",",
"api_version",
"=",
"2",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating keystone admin...'",
")",
"# 11 => xenial_queens",
"if"... | Return a keystone session object and client object assuming standard
default settings
Example call in amulet tests:
self.keystone_session, self.keystone = u.get_default_keystone_session(
self.keystone_sentry,
openstack_release=self._get_opensta... | [
"Return",
"a",
"keystone",
"session",
"object",
"and",
"client",
"object",
"assuming",
"standard",
"default",
"settings"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L548-L582 |
12,534 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_keystone_admin | def authenticate_keystone_admin(self, keystone_sentry, user, password,
tenant=None, api_version=None,
keystone_ip=None, user_domain_name=None,
project_domain_name=None,
project... | python | def authenticate_keystone_admin(self, keystone_sentry, user, password,
tenant=None, api_version=None,
keystone_ip=None, user_domain_name=None,
project_domain_name=None,
project... | [
"def",
"authenticate_keystone_admin",
"(",
"self",
",",
"keystone_sentry",
",",
"user",
",",
"password",
",",
"tenant",
"=",
"None",
",",
"api_version",
"=",
"None",
",",
"keystone_ip",
"=",
"None",
",",
"user_domain_name",
"=",
"None",
",",
"project_domain_name... | Authenticates admin user with the keystone admin endpoint. | [
"Authenticates",
"admin",
"user",
"with",
"the",
"keystone",
"admin",
"endpoint",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L584-L610 |
12,535 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_keystone_user | def authenticate_keystone_user(self, keystone, user, password, tenant):
"""Authenticates a regular user with the keystone public endpoint."""
self.log.debug('Authenticating keystone user ({})...'.format(user))
ep = keystone.service_catalog.url_for(service_type='identity',
... | python | def authenticate_keystone_user(self, keystone, user, password, tenant):
"""Authenticates a regular user with the keystone public endpoint."""
self.log.debug('Authenticating keystone user ({})...'.format(user))
ep = keystone.service_catalog.url_for(service_type='identity',
... | [
"def",
"authenticate_keystone_user",
"(",
"self",
",",
"keystone",
",",
"user",
",",
"password",
",",
"tenant",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating keystone user ({})...'",
".",
"format",
"(",
"user",
")",
")",
"ep",
"=",
"keyst... | Authenticates a regular user with the keystone public endpoint. | [
"Authenticates",
"a",
"regular",
"user",
"with",
"the",
"keystone",
"public",
"endpoint",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L612-L620 |
12,536 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_glance_admin | def authenticate_glance_admin(self, keystone, force_v1_client=False):
"""Authenticates admin user with glance."""
self.log.debug('Authenticating glance admin...')
ep = keystone.service_catalog.url_for(service_type='image',
interface='adminURL')
... | python | def authenticate_glance_admin(self, keystone, force_v1_client=False):
"""Authenticates admin user with glance."""
self.log.debug('Authenticating glance admin...')
ep = keystone.service_catalog.url_for(service_type='image',
interface='adminURL')
... | [
"def",
"authenticate_glance_admin",
"(",
"self",
",",
"keystone",
",",
"force_v1_client",
"=",
"False",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating glance admin...'",
")",
"ep",
"=",
"keystone",
".",
"service_catalog",
".",
"url_for",
"(",
... | Authenticates admin user with glance. | [
"Authenticates",
"admin",
"user",
"with",
"glance",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L622-L630 |
12,537 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_heat_admin | def authenticate_heat_admin(self, keystone):
"""Authenticates the admin user with heat."""
self.log.debug('Authenticating heat admin...')
ep = keystone.service_catalog.url_for(service_type='orchestration',
interface='publicURL')
if keystone.s... | python | def authenticate_heat_admin(self, keystone):
"""Authenticates the admin user with heat."""
self.log.debug('Authenticating heat admin...')
ep = keystone.service_catalog.url_for(service_type='orchestration',
interface='publicURL')
if keystone.s... | [
"def",
"authenticate_heat_admin",
"(",
"self",
",",
"keystone",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating heat admin...'",
")",
"ep",
"=",
"keystone",
".",
"service_catalog",
".",
"url_for",
"(",
"service_type",
"=",
"'orchestration'",
",... | Authenticates the admin user with heat. | [
"Authenticates",
"the",
"admin",
"user",
"with",
"heat",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L632-L640 |
12,538 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_nova_user | def authenticate_nova_user(self, keystone, user, password, tenant):
"""Authenticates a regular user with nova-api."""
self.log.debug('Authenticating nova user ({})...'.format(user))
ep = keystone.service_catalog.url_for(service_type='identity',
inter... | python | def authenticate_nova_user(self, keystone, user, password, tenant):
"""Authenticates a regular user with nova-api."""
self.log.debug('Authenticating nova user ({})...'.format(user))
ep = keystone.service_catalog.url_for(service_type='identity',
inter... | [
"def",
"authenticate_nova_user",
"(",
"self",
",",
"keystone",
",",
"user",
",",
"password",
",",
"tenant",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating nova user ({})...'",
".",
"format",
"(",
"user",
")",
")",
"ep",
"=",
"keystone",
... | Authenticates a regular user with nova-api. | [
"Authenticates",
"a",
"regular",
"user",
"with",
"nova",
"-",
"api",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L642-L658 |
12,539 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.authenticate_swift_user | def authenticate_swift_user(self, keystone, user, password, tenant):
"""Authenticates a regular user with swift api."""
self.log.debug('Authenticating swift user ({})...'.format(user))
ep = keystone.service_catalog.url_for(service_type='identity',
in... | python | def authenticate_swift_user(self, keystone, user, password, tenant):
"""Authenticates a regular user with swift api."""
self.log.debug('Authenticating swift user ({})...'.format(user))
ep = keystone.service_catalog.url_for(service_type='identity',
in... | [
"def",
"authenticate_swift_user",
"(",
"self",
",",
"keystone",
",",
"user",
",",
"password",
",",
"tenant",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Authenticating swift user ({})...'",
".",
"format",
"(",
"user",
")",
")",
"ep",
"=",
"keystone",
... | Authenticates a regular user with swift api. | [
"Authenticates",
"a",
"regular",
"user",
"with",
"swift",
"api",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L660-L672 |
12,540 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.create_flavor | def create_flavor(self, nova, name, ram, vcpus, disk, flavorid="auto",
ephemeral=0, swap=0, rxtx_factor=1.0, is_public=True):
"""Create the specified flavor."""
try:
nova.flavors.find(name=name)
except (exceptions.NotFound, exceptions.NoUniqueMatch):
... | python | def create_flavor(self, nova, name, ram, vcpus, disk, flavorid="auto",
ephemeral=0, swap=0, rxtx_factor=1.0, is_public=True):
"""Create the specified flavor."""
try:
nova.flavors.find(name=name)
except (exceptions.NotFound, exceptions.NoUniqueMatch):
... | [
"def",
"create_flavor",
"(",
"self",
",",
"nova",
",",
"name",
",",
"ram",
",",
"vcpus",
",",
"disk",
",",
"flavorid",
"=",
"\"auto\"",
",",
"ephemeral",
"=",
"0",
",",
"swap",
"=",
"0",
",",
"rxtx_factor",
"=",
"1.0",
",",
"is_public",
"=",
"True",
... | Create the specified flavor. | [
"Create",
"the",
"specified",
"flavor",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L674-L682 |
12,541 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.glance_create_image | def glance_create_image(self, glance, image_name, image_url,
download_dir='tests',
hypervisor_type=None,
disk_format='qcow2',
architecture='x86_64',
container_format='bare'):
... | python | def glance_create_image(self, glance, image_name, image_url,
download_dir='tests',
hypervisor_type=None,
disk_format='qcow2',
architecture='x86_64',
container_format='bare'):
... | [
"def",
"glance_create_image",
"(",
"self",
",",
"glance",
",",
"image_name",
",",
"image_url",
",",
"download_dir",
"=",
"'tests'",
",",
"hypervisor_type",
"=",
"None",
",",
"disk_format",
"=",
"'qcow2'",
",",
"architecture",
"=",
"'x86_64'",
",",
"container_for... | Download an image and upload it to glance, validate its status
and return an image object pointer. KVM defaults, can override for
LXD.
:param glance: pointer to authenticated glance api connection
:param image_name: display name for new image
:param image_url: url to retrieve
... | [
"Download",
"an",
"image",
"and",
"upload",
"it",
"to",
"glance",
"validate",
"its",
"status",
"and",
"return",
"an",
"image",
"object",
"pointer",
".",
"KVM",
"defaults",
"can",
"override",
"for",
"LXD",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L684-L779 |
12,542 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.create_cirros_image | def create_cirros_image(self, glance, image_name, hypervisor_type=None):
"""Download the latest cirros image and upload it to glance,
validate and return a resource pointer.
:param glance: pointer to authenticated glance connection
:param image_name: display name for new image
:... | python | def create_cirros_image(self, glance, image_name, hypervisor_type=None):
"""Download the latest cirros image and upload it to glance,
validate and return a resource pointer.
:param glance: pointer to authenticated glance connection
:param image_name: display name for new image
:... | [
"def",
"create_cirros_image",
"(",
"self",
",",
"glance",
",",
"image_name",
",",
"hypervisor_type",
"=",
"None",
")",
":",
"# /!\\ DEPRECATION WARNING",
"self",
".",
"log",
".",
"warn",
"(",
"'/!\\\\ DEPRECATION WARNING: use '",
"'glance_create_image instead of '",
"'... | Download the latest cirros image and upload it to glance,
validate and return a resource pointer.
:param glance: pointer to authenticated glance connection
:param image_name: display name for new image
:param hypervisor_type: glance image hypervisor property
:returns: glance ima... | [
"Download",
"the",
"latest",
"cirros",
"image",
"and",
"upload",
"it",
"to",
"glance",
"validate",
"and",
"return",
"a",
"resource",
"pointer",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L781-L818 |
12,543 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.delete_image | def delete_image(self, glance, image):
"""Delete the specified image."""
# /!\ DEPRECATION WARNING
self.log.warn('/!\\ DEPRECATION WARNING: use '
'delete_resource instead of delete_image.')
self.log.debug('Deleting glance image ({})...'.format(image))
retu... | python | def delete_image(self, glance, image):
"""Delete the specified image."""
# /!\ DEPRECATION WARNING
self.log.warn('/!\\ DEPRECATION WARNING: use '
'delete_resource instead of delete_image.')
self.log.debug('Deleting glance image ({})...'.format(image))
retu... | [
"def",
"delete_image",
"(",
"self",
",",
"glance",
",",
"image",
")",
":",
"# /!\\ DEPRECATION WARNING",
"self",
".",
"log",
".",
"warn",
"(",
"'/!\\\\ DEPRECATION WARNING: use '",
"'delete_resource instead of delete_image.'",
")",
"self",
".",
"log",
".",
"debug",
... | Delete the specified image. | [
"Delete",
"the",
"specified",
"image",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L820-L827 |
12,544 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.create_instance | def create_instance(self, nova, image_name, instance_name, flavor):
"""Create the specified instance."""
self.log.debug('Creating instance '
'({}|{}|{})'.format(instance_name, image_name, flavor))
image = nova.glance.find_image(image_name)
flavor = nova.flavors.fin... | python | def create_instance(self, nova, image_name, instance_name, flavor):
"""Create the specified instance."""
self.log.debug('Creating instance '
'({}|{}|{})'.format(instance_name, image_name, flavor))
image = nova.glance.find_image(image_name)
flavor = nova.flavors.fin... | [
"def",
"create_instance",
"(",
"self",
",",
"nova",
",",
"image_name",
",",
"instance_name",
",",
"flavor",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Creating instance '",
"'({}|{}|{})'",
".",
"format",
"(",
"instance_name",
",",
"image_name",
",",
... | Create the specified instance. | [
"Create",
"the",
"specified",
"instance",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L829-L851 |
12,545 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.delete_instance | def delete_instance(self, nova, instance):
"""Delete the specified instance."""
# /!\ DEPRECATION WARNING
self.log.warn('/!\\ DEPRECATION WARNING: use '
'delete_resource instead of delete_instance.')
self.log.debug('Deleting instance ({})...'.format(instance))
... | python | def delete_instance(self, nova, instance):
"""Delete the specified instance."""
# /!\ DEPRECATION WARNING
self.log.warn('/!\\ DEPRECATION WARNING: use '
'delete_resource instead of delete_instance.')
self.log.debug('Deleting instance ({})...'.format(instance))
... | [
"def",
"delete_instance",
"(",
"self",
",",
"nova",
",",
"instance",
")",
":",
"# /!\\ DEPRECATION WARNING",
"self",
".",
"log",
".",
"warn",
"(",
"'/!\\\\ DEPRECATION WARNING: use '",
"'delete_resource instead of delete_instance.'",
")",
"self",
".",
"log",
".",
"de... | Delete the specified instance. | [
"Delete",
"the",
"specified",
"instance",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L853-L861 |
12,546 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.create_or_get_keypair | def create_or_get_keypair(self, nova, keypair_name="testkey"):
"""Create a new keypair, or return pointer if it already exists."""
try:
_keypair = nova.keypairs.get(keypair_name)
self.log.debug('Keypair ({}) already exists, '
'using it.'.format(keypair_... | python | def create_or_get_keypair(self, nova, keypair_name="testkey"):
"""Create a new keypair, or return pointer if it already exists."""
try:
_keypair = nova.keypairs.get(keypair_name)
self.log.debug('Keypair ({}) already exists, '
'using it.'.format(keypair_... | [
"def",
"create_or_get_keypair",
"(",
"self",
",",
"nova",
",",
"keypair_name",
"=",
"\"testkey\"",
")",
":",
"try",
":",
"_keypair",
"=",
"nova",
".",
"keypairs",
".",
"get",
"(",
"keypair_name",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'Keypair ({}) a... | Create a new keypair, or return pointer if it already exists. | [
"Create",
"a",
"new",
"keypair",
"or",
"return",
"pointer",
"if",
"it",
"already",
"exists",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L863-L875 |
12,547 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.create_cinder_volume | def create_cinder_volume(self, cinder, vol_name="demo-vol", vol_size=1,
img_id=None, src_vol_id=None, snap_id=None):
"""Create cinder volume, optionally from a glance image, OR
optionally as a clone of an existing volume, OR optionally
from a snapshot. Wait for the ... | python | def create_cinder_volume(self, cinder, vol_name="demo-vol", vol_size=1,
img_id=None, src_vol_id=None, snap_id=None):
"""Create cinder volume, optionally from a glance image, OR
optionally as a clone of an existing volume, OR optionally
from a snapshot. Wait for the ... | [
"def",
"create_cinder_volume",
"(",
"self",
",",
"cinder",
",",
"vol_name",
"=",
"\"demo-vol\"",
",",
"vol_size",
"=",
"1",
",",
"img_id",
"=",
"None",
",",
"src_vol_id",
"=",
"None",
",",
"snap_id",
"=",
"None",
")",
":",
"# Handle parameter input and avoid i... | Create cinder volume, optionally from a glance image, OR
optionally as a clone of an existing volume, OR optionally
from a snapshot. Wait for the new volume status to reach
the expected status, validate and return a resource pointer.
:param vol_name: cinder volume display name
... | [
"Create",
"cinder",
"volume",
"optionally",
"from",
"a",
"glance",
"image",
"OR",
"optionally",
"as",
"a",
"clone",
"of",
"an",
"existing",
"volume",
"OR",
"optionally",
"from",
"a",
"snapshot",
".",
"Wait",
"for",
"the",
"new",
"volume",
"status",
"to",
"... | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L889-L976 |
12,548 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.delete_resource | def delete_resource(self, resource, resource_id,
msg="resource", max_wait=120):
"""Delete one openstack resource, such as one instance, keypair,
image, volume, stack, etc., and confirm deletion within max wait time.
:param resource: pointer to os resource type, ex:glance... | python | def delete_resource(self, resource, resource_id,
msg="resource", max_wait=120):
"""Delete one openstack resource, such as one instance, keypair,
image, volume, stack, etc., and confirm deletion within max wait time.
:param resource: pointer to os resource type, ex:glance... | [
"def",
"delete_resource",
"(",
"self",
",",
"resource",
",",
"resource_id",
",",
"msg",
"=",
"\"resource\"",
",",
"max_wait",
"=",
"120",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Deleting OpenStack resource '",
"'{} ({})'",
".",
"format",
"(",
"res... | Delete one openstack resource, such as one instance, keypair,
image, volume, stack, etc., and confirm deletion within max wait time.
:param resource: pointer to os resource type, ex:glance_client.images
:param resource_id: unique name or id for the openstack resource
:param msg: text to... | [
"Delete",
"one",
"openstack",
"resource",
"such",
"as",
"one",
"instance",
"keypair",
"image",
"volume",
"stack",
"etc",
".",
"and",
"confirm",
"deletion",
"within",
"max",
"wait",
"time",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L978-L1013 |
12,549 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.resource_reaches_status | def resource_reaches_status(self, resource, resource_id,
expected_stat='available',
msg='resource', max_wait=120):
"""Wait for an openstack resources status to reach an
expected status within a specified time. Useful to confirm that
... | python | def resource_reaches_status(self, resource, resource_id,
expected_stat='available',
msg='resource', max_wait=120):
"""Wait for an openstack resources status to reach an
expected status within a specified time. Useful to confirm that
... | [
"def",
"resource_reaches_status",
"(",
"self",
",",
"resource",
",",
"resource_id",
",",
"expected_stat",
"=",
"'available'",
",",
"msg",
"=",
"'resource'",
",",
"max_wait",
"=",
"120",
")",
":",
"tries",
"=",
"0",
"resource_stat",
"=",
"resource",
".",
"get... | Wait for an openstack resources status to reach an
expected status within a specified time. Useful to confirm that
nova instances, cinder vols, snapshots, glance images, heat stacks
and other resources eventually reach the expected status.
:param resource: pointer to os resour... | [
"Wait",
"for",
"an",
"openstack",
"resources",
"status",
"to",
"reach",
"an",
"expected",
"status",
"within",
"a",
"specified",
"time",
".",
"Useful",
"to",
"confirm",
"that",
"nova",
"instances",
"cinder",
"vols",
"snapshots",
"glance",
"images",
"heat",
"sta... | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1015-L1051 |
12,550 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_ceph_pools | def get_ceph_pools(self, sentry_unit):
"""Return a dict of ceph pools from a single ceph unit, with
pool name as keys, pool id as vals."""
pools = {}
cmd = 'sudo ceph osd lspools'
output, code = sentry_unit.run(cmd)
if code != 0:
msg = ('{} `{}` returned {} '
... | python | def get_ceph_pools(self, sentry_unit):
"""Return a dict of ceph pools from a single ceph unit, with
pool name as keys, pool id as vals."""
pools = {}
cmd = 'sudo ceph osd lspools'
output, code = sentry_unit.run(cmd)
if code != 0:
msg = ('{} `{}` returned {} '
... | [
"def",
"get_ceph_pools",
"(",
"self",
",",
"sentry_unit",
")",
":",
"pools",
"=",
"{",
"}",
"cmd",
"=",
"'sudo ceph osd lspools'",
"output",
",",
"code",
"=",
"sentry_unit",
".",
"run",
"(",
"cmd",
")",
"if",
"code",
"!=",
"0",
":",
"msg",
"=",
"(",
... | Return a dict of ceph pools from a single ceph unit, with
pool name as keys, pool id as vals. | [
"Return",
"a",
"dict",
"of",
"ceph",
"pools",
"from",
"a",
"single",
"ceph",
"unit",
"with",
"pool",
"name",
"as",
"keys",
"pool",
"id",
"as",
"vals",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1059-L1084 |
12,551 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_ceph_df | def get_ceph_df(self, sentry_unit):
"""Return dict of ceph df json output, including ceph pool state.
:param sentry_unit: Pointer to amulet sentry instance (juju unit)
:returns: Dict of ceph df output
"""
cmd = 'sudo ceph df --format=json'
output, code = sentry_unit.run(... | python | def get_ceph_df(self, sentry_unit):
"""Return dict of ceph df json output, including ceph pool state.
:param sentry_unit: Pointer to amulet sentry instance (juju unit)
:returns: Dict of ceph df output
"""
cmd = 'sudo ceph df --format=json'
output, code = sentry_unit.run(... | [
"def",
"get_ceph_df",
"(",
"self",
",",
"sentry_unit",
")",
":",
"cmd",
"=",
"'sudo ceph df --format=json'",
"output",
",",
"code",
"=",
"sentry_unit",
".",
"run",
"(",
"cmd",
")",
"if",
"code",
"!=",
"0",
":",
"msg",
"=",
"(",
"'{} `{}` returned {} '",
"'... | Return dict of ceph df json output, including ceph pool state.
:param sentry_unit: Pointer to amulet sentry instance (juju unit)
:returns: Dict of ceph df output | [
"Return",
"dict",
"of",
"ceph",
"df",
"json",
"output",
"including",
"ceph",
"pool",
"state",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1086-L1099 |
12,552 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_ceph_pool_sample | def get_ceph_pool_sample(self, sentry_unit, pool_id=0):
"""Take a sample of attributes of a ceph pool, returning ceph
pool name, object count and disk space used for the specified
pool ID number.
:param sentry_unit: Pointer to amulet sentry instance (juju unit)
:param pool_id: C... | python | def get_ceph_pool_sample(self, sentry_unit, pool_id=0):
"""Take a sample of attributes of a ceph pool, returning ceph
pool name, object count and disk space used for the specified
pool ID number.
:param sentry_unit: Pointer to amulet sentry instance (juju unit)
:param pool_id: C... | [
"def",
"get_ceph_pool_sample",
"(",
"self",
",",
"sentry_unit",
",",
"pool_id",
"=",
"0",
")",
":",
"df",
"=",
"self",
".",
"get_ceph_df",
"(",
"sentry_unit",
")",
"for",
"pool",
"in",
"df",
"[",
"'pools'",
"]",
":",
"if",
"pool",
"[",
"'id'",
"]",
"... | Take a sample of attributes of a ceph pool, returning ceph
pool name, object count and disk space used for the specified
pool ID number.
:param sentry_unit: Pointer to amulet sentry instance (juju unit)
:param pool_id: Ceph pool ID
:returns: List of pool name, object count, kb d... | [
"Take",
"a",
"sample",
"of",
"attributes",
"of",
"a",
"ceph",
"pool",
"returning",
"ceph",
"pool",
"name",
"object",
"count",
"and",
"disk",
"space",
"used",
"for",
"the",
"specified",
"pool",
"ID",
"number",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1101-L1120 |
12,553 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_ceph_pool_samples | def validate_ceph_pool_samples(self, samples, sample_type="resource pool"):
"""Validate ceph pool samples taken over time, such as pool
object counts or pool kb used, before adding, after adding, and
after deleting items which affect those pool attributes. The
2nd element is expected to... | python | def validate_ceph_pool_samples(self, samples, sample_type="resource pool"):
"""Validate ceph pool samples taken over time, such as pool
object counts or pool kb used, before adding, after adding, and
after deleting items which affect those pool attributes. The
2nd element is expected to... | [
"def",
"validate_ceph_pool_samples",
"(",
"self",
",",
"samples",
",",
"sample_type",
"=",
"\"resource pool\"",
")",
":",
"original",
",",
"created",
",",
"deleted",
"=",
"range",
"(",
"3",
")",
"if",
"samples",
"[",
"created",
"]",
"<=",
"samples",
"[",
"... | Validate ceph pool samples taken over time, such as pool
object counts or pool kb used, before adding, after adding, and
after deleting items which affect those pool attributes. The
2nd element is expected to be greater than the 1st; 3rd is expected
to be less than the 2nd.
:pa... | [
"Validate",
"ceph",
"pool",
"samples",
"taken",
"over",
"time",
"such",
"as",
"pool",
"object",
"counts",
"or",
"pool",
"kb",
"used",
"before",
"adding",
"after",
"adding",
"and",
"after",
"deleting",
"items",
"which",
"affect",
"those",
"pool",
"attributes",
... | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1122-L1141 |
12,554 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.rmq_wait_for_cluster | def rmq_wait_for_cluster(self, deployment, init_sleep=15, timeout=1200):
"""Wait for rmq units extended status to show cluster readiness,
after an optional initial sleep period. Initial sleep is likely
necessary to be effective following a config change, as status
message may not instan... | python | def rmq_wait_for_cluster(self, deployment, init_sleep=15, timeout=1200):
"""Wait for rmq units extended status to show cluster readiness,
after an optional initial sleep period. Initial sleep is likely
necessary to be effective following a config change, as status
message may not instan... | [
"def",
"rmq_wait_for_cluster",
"(",
"self",
",",
"deployment",
",",
"init_sleep",
"=",
"15",
",",
"timeout",
"=",
"1200",
")",
":",
"if",
"init_sleep",
":",
"time",
".",
"sleep",
"(",
"init_sleep",
")",
"message",
"=",
"re",
".",
"compile",
"(",
"'^Unit ... | Wait for rmq units extended status to show cluster readiness,
after an optional initial sleep period. Initial sleep is likely
necessary to be effective following a config change, as status
message may not instantly update to non-ready. | [
"Wait",
"for",
"rmq",
"units",
"extended",
"status",
"to",
"show",
"cluster",
"readiness",
"after",
"an",
"optional",
"initial",
"sleep",
"period",
".",
"Initial",
"sleep",
"is",
"likely",
"necessary",
"to",
"be",
"effective",
"following",
"a",
"config",
"chan... | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1145-L1157 |
12,555 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_rmq_cluster_status | def get_rmq_cluster_status(self, sentry_unit):
"""Execute rabbitmq cluster status command on a unit and return
the full output.
:param unit: sentry unit
:returns: String containing console output of cluster status command
"""
cmd = 'rabbitmqctl cluster_status'
ou... | python | def get_rmq_cluster_status(self, sentry_unit):
"""Execute rabbitmq cluster status command on a unit and return
the full output.
:param unit: sentry unit
:returns: String containing console output of cluster status command
"""
cmd = 'rabbitmqctl cluster_status'
ou... | [
"def",
"get_rmq_cluster_status",
"(",
"self",
",",
"sentry_unit",
")",
":",
"cmd",
"=",
"'rabbitmqctl cluster_status'",
"output",
",",
"_",
"=",
"self",
".",
"run_cmd_unit",
"(",
"sentry_unit",
",",
"cmd",
")",
"self",
".",
"log",
".",
"debug",
"(",
"'{} clu... | Execute rabbitmq cluster status command on a unit and return
the full output.
:param unit: sentry unit
:returns: String containing console output of cluster status command | [
"Execute",
"rabbitmq",
"cluster",
"status",
"command",
"on",
"a",
"unit",
"and",
"return",
"the",
"full",
"output",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1218-L1229 |
12,556 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_rmq_cluster_running_nodes | def get_rmq_cluster_running_nodes(self, sentry_unit):
"""Parse rabbitmqctl cluster_status output string, return list of
running rabbitmq cluster nodes.
:param unit: sentry unit
:returns: List containing node names of running nodes
"""
# NOTE(beisner): rabbitmqctl cluster... | python | def get_rmq_cluster_running_nodes(self, sentry_unit):
"""Parse rabbitmqctl cluster_status output string, return list of
running rabbitmq cluster nodes.
:param unit: sentry unit
:returns: List containing node names of running nodes
"""
# NOTE(beisner): rabbitmqctl cluster... | [
"def",
"get_rmq_cluster_running_nodes",
"(",
"self",
",",
"sentry_unit",
")",
":",
"# NOTE(beisner): rabbitmqctl cluster_status output is not",
"# json-parsable, do string chop foo, then json.loads that.",
"str_stat",
"=",
"self",
".",
"get_rmq_cluster_status",
"(",
"sentry_unit",
... | Parse rabbitmqctl cluster_status output string, return list of
running rabbitmq cluster nodes.
:param unit: sentry unit
:returns: List containing node names of running nodes | [
"Parse",
"rabbitmqctl",
"cluster_status",
"output",
"string",
"return",
"list",
"of",
"running",
"rabbitmq",
"cluster",
"nodes",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1231-L1248 |
12,557 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_rmq_cluster_running_nodes | def validate_rmq_cluster_running_nodes(self, sentry_units):
"""Check that all rmq unit hostnames are represented in the
cluster_status output of all units.
:param host_names: dict of juju unit names to host names
:param units: list of sentry unit pointers (all rmq units)
:return... | python | def validate_rmq_cluster_running_nodes(self, sentry_units):
"""Check that all rmq unit hostnames are represented in the
cluster_status output of all units.
:param host_names: dict of juju unit names to host names
:param units: list of sentry unit pointers (all rmq units)
:return... | [
"def",
"validate_rmq_cluster_running_nodes",
"(",
"self",
",",
"sentry_units",
")",
":",
"host_names",
"=",
"self",
".",
"get_unit_hostnames",
"(",
"sentry_units",
")",
"errors",
"=",
"[",
"]",
"# Query every unit for cluster_status running nodes",
"for",
"query_unit",
... | Check that all rmq unit hostnames are represented in the
cluster_status output of all units.
:param host_names: dict of juju unit names to host names
:param units: list of sentry unit pointers (all rmq units)
:returns: None if successful, otherwise return error message | [
"Check",
"that",
"all",
"rmq",
"unit",
"hostnames",
"are",
"represented",
"in",
"the",
"cluster_status",
"output",
"of",
"all",
"units",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1250-L1278 |
12,558 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.rmq_ssl_is_enabled_on_unit | def rmq_ssl_is_enabled_on_unit(self, sentry_unit, port=None):
"""Check a single juju rmq unit for ssl and port in the config file."""
host = sentry_unit.info['public-address']
unit_name = sentry_unit.info['unit_name']
conf_file = '/etc/rabbitmq/rabbitmq.config'
conf_contents = s... | python | def rmq_ssl_is_enabled_on_unit(self, sentry_unit, port=None):
"""Check a single juju rmq unit for ssl and port in the config file."""
host = sentry_unit.info['public-address']
unit_name = sentry_unit.info['unit_name']
conf_file = '/etc/rabbitmq/rabbitmq.config'
conf_contents = s... | [
"def",
"rmq_ssl_is_enabled_on_unit",
"(",
"self",
",",
"sentry_unit",
",",
"port",
"=",
"None",
")",
":",
"host",
"=",
"sentry_unit",
".",
"info",
"[",
"'public-address'",
"]",
"unit_name",
"=",
"sentry_unit",
".",
"info",
"[",
"'unit_name'",
"]",
"conf_file",... | Check a single juju rmq unit for ssl and port in the config file. | [
"Check",
"a",
"single",
"juju",
"rmq",
"unit",
"for",
"ssl",
"and",
"port",
"in",
"the",
"config",
"file",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1280-L1313 |
12,559 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_rmq_ssl_enabled_units | def validate_rmq_ssl_enabled_units(self, sentry_units, port=None):
"""Check that ssl is enabled on rmq juju sentry units.
:param sentry_units: list of all rmq sentry units
:param port: optional ssl port override to validate
:returns: None if successful, otherwise return error message
... | python | def validate_rmq_ssl_enabled_units(self, sentry_units, port=None):
"""Check that ssl is enabled on rmq juju sentry units.
:param sentry_units: list of all rmq sentry units
:param port: optional ssl port override to validate
:returns: None if successful, otherwise return error message
... | [
"def",
"validate_rmq_ssl_enabled_units",
"(",
"self",
",",
"sentry_units",
",",
"port",
"=",
"None",
")",
":",
"for",
"sentry_unit",
"in",
"sentry_units",
":",
"if",
"not",
"self",
".",
"rmq_ssl_is_enabled_on_unit",
"(",
"sentry_unit",
",",
"port",
"=",
"port",
... | Check that ssl is enabled on rmq juju sentry units.
:param sentry_units: list of all rmq sentry units
:param port: optional ssl port override to validate
:returns: None if successful, otherwise return error message | [
"Check",
"that",
"ssl",
"is",
"enabled",
"on",
"rmq",
"juju",
"sentry",
"units",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1315-L1326 |
12,560 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_rmq_ssl_disabled_units | def validate_rmq_ssl_disabled_units(self, sentry_units):
"""Check that ssl is enabled on listed rmq juju sentry units.
:param sentry_units: list of all rmq sentry units
:returns: True if successful. Raise on error.
"""
for sentry_unit in sentry_units:
if self.rmq_ss... | python | def validate_rmq_ssl_disabled_units(self, sentry_units):
"""Check that ssl is enabled on listed rmq juju sentry units.
:param sentry_units: list of all rmq sentry units
:returns: True if successful. Raise on error.
"""
for sentry_unit in sentry_units:
if self.rmq_ss... | [
"def",
"validate_rmq_ssl_disabled_units",
"(",
"self",
",",
"sentry_units",
")",
":",
"for",
"sentry_unit",
"in",
"sentry_units",
":",
"if",
"self",
".",
"rmq_ssl_is_enabled_on_unit",
"(",
"sentry_unit",
")",
":",
"return",
"(",
"'Unexpected condition: ssl is enabled o... | Check that ssl is enabled on listed rmq juju sentry units.
:param sentry_units: list of all rmq sentry units
:returns: True if successful. Raise on error. | [
"Check",
"that",
"ssl",
"is",
"enabled",
"on",
"listed",
"rmq",
"juju",
"sentry",
"units",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1328-L1338 |
12,561 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.configure_rmq_ssl_on | def configure_rmq_ssl_on(self, sentry_units, deployment,
port=None, max_wait=60):
"""Turn ssl charm config option on, with optional non-default
ssl port specification. Confirm that it is enabled on every
unit.
:param sentry_units: list of sentry units
... | python | def configure_rmq_ssl_on(self, sentry_units, deployment,
port=None, max_wait=60):
"""Turn ssl charm config option on, with optional non-default
ssl port specification. Confirm that it is enabled on every
unit.
:param sentry_units: list of sentry units
... | [
"def",
"configure_rmq_ssl_on",
"(",
"self",
",",
"sentry_units",
",",
"deployment",
",",
"port",
"=",
"None",
",",
"max_wait",
"=",
"60",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Setting ssl charm config option: on'",
")",
"# Enable RMQ SSL",
"config"... | Turn ssl charm config option on, with optional non-default
ssl port specification. Confirm that it is enabled on every
unit.
:param sentry_units: list of sentry units
:param deployment: amulet deployment object pointer
:param port: amqp port, use defaults if None
:param... | [
"Turn",
"ssl",
"charm",
"config",
"option",
"on",
"with",
"optional",
"non",
"-",
"default",
"ssl",
"port",
"specification",
".",
"Confirm",
"that",
"it",
"is",
"enabled",
"on",
"every",
"unit",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1340-L1374 |
12,562 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.configure_rmq_ssl_off | def configure_rmq_ssl_off(self, sentry_units, deployment, max_wait=60):
"""Turn ssl charm config option off, confirm that it is disabled
on every unit.
:param sentry_units: list of sentry units
:param deployment: amulet deployment object pointer
:param max_wait: maximum time to ... | python | def configure_rmq_ssl_off(self, sentry_units, deployment, max_wait=60):
"""Turn ssl charm config option off, confirm that it is disabled
on every unit.
:param sentry_units: list of sentry units
:param deployment: amulet deployment object pointer
:param max_wait: maximum time to ... | [
"def",
"configure_rmq_ssl_off",
"(",
"self",
",",
"sentry_units",
",",
"deployment",
",",
"max_wait",
"=",
"60",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"'Setting ssl charm config option: off'",
")",
"# Disable RMQ SSL",
"config",
"=",
"{",
"'ssl'",
":... | Turn ssl charm config option off, confirm that it is disabled
on every unit.
:param sentry_units: list of sentry units
:param deployment: amulet deployment object pointer
:param max_wait: maximum time to wait in seconds to confirm
:returns: None if successful. Raise on error. | [
"Turn",
"ssl",
"charm",
"config",
"option",
"off",
"confirm",
"that",
"it",
"is",
"disabled",
"on",
"every",
"unit",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1376-L1404 |
12,563 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.connect_amqp_by_unit | def connect_amqp_by_unit(self, sentry_unit, ssl=False,
port=None, fatal=True,
username="testuser1", password="changeme"):
"""Establish and return a pika amqp connection to the rabbitmq service
running on a rmq juju unit.
:param sentry_un... | python | def connect_amqp_by_unit(self, sentry_unit, ssl=False,
port=None, fatal=True,
username="testuser1", password="changeme"):
"""Establish and return a pika amqp connection to the rabbitmq service
running on a rmq juju unit.
:param sentry_un... | [
"def",
"connect_amqp_by_unit",
"(",
"self",
",",
"sentry_unit",
",",
"ssl",
"=",
"False",
",",
"port",
"=",
"None",
",",
"fatal",
"=",
"True",
",",
"username",
"=",
"\"testuser1\"",
",",
"password",
"=",
"\"changeme\"",
")",
":",
"host",
"=",
"sentry_unit"... | Establish and return a pika amqp connection to the rabbitmq service
running on a rmq juju unit.
:param sentry_unit: sentry unit pointer
:param ssl: boolean, default to False
:param port: amqp port, use defaults if None
:param fatal: boolean, default to True (raises on connect er... | [
"Establish",
"and",
"return",
"a",
"pika",
"amqp",
"connection",
"to",
"the",
"rabbitmq",
"service",
"running",
"on",
"a",
"rmq",
"juju",
"unit",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1406-L1452 |
12,564 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.publish_amqp_message_by_unit | def publish_amqp_message_by_unit(self, sentry_unit, message,
queue="test", ssl=False,
username="testuser1",
password="changeme",
port=None):
"""Publish an amqp mess... | python | def publish_amqp_message_by_unit(self, sentry_unit, message,
queue="test", ssl=False,
username="testuser1",
password="changeme",
port=None):
"""Publish an amqp mess... | [
"def",
"publish_amqp_message_by_unit",
"(",
"self",
",",
"sentry_unit",
",",
"message",
",",
"queue",
"=",
"\"test\"",
",",
"ssl",
"=",
"False",
",",
"username",
"=",
"\"testuser1\"",
",",
"password",
"=",
"\"changeme\"",
",",
"port",
"=",
"None",
")",
":",
... | Publish an amqp message to a rmq juju unit.
:param sentry_unit: sentry unit pointer
:param message: amqp message string
:param queue: message queue, default to test
:param username: amqp user name, default to testuser1
:param password: amqp user password
:param ssl: bool... | [
"Publish",
"an",
"amqp",
"message",
"to",
"a",
"rmq",
"juju",
"unit",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1454-L1489 |
12,565 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.get_amqp_message_by_unit | def get_amqp_message_by_unit(self, sentry_unit, queue="test",
username="testuser1",
password="changeme",
ssl=False, port=None):
"""Get an amqp message from a rmq juju unit.
:param sentry_unit: sentry unit... | python | def get_amqp_message_by_unit(self, sentry_unit, queue="test",
username="testuser1",
password="changeme",
ssl=False, port=None):
"""Get an amqp message from a rmq juju unit.
:param sentry_unit: sentry unit... | [
"def",
"get_amqp_message_by_unit",
"(",
"self",
",",
"sentry_unit",
",",
"queue",
"=",
"\"test\"",
",",
"username",
"=",
"\"testuser1\"",
",",
"password",
"=",
"\"changeme\"",
",",
"ssl",
"=",
"False",
",",
"port",
"=",
"None",
")",
":",
"connection",
"=",
... | Get an amqp message from a rmq juju unit.
:param sentry_unit: sentry unit pointer
:param queue: message queue, default to test
:param username: amqp user name, default to testuser1
:param password: amqp user password
:param ssl: boolean, default to False
:param port: amq... | [
"Get",
"an",
"amqp",
"message",
"from",
"a",
"rmq",
"juju",
"unit",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1491-L1521 |
12,566 | juju/charm-helpers | charmhelpers/contrib/openstack/amulet/utils.py | OpenStackAmuletUtils.validate_memcache | def validate_memcache(self, sentry_unit, conf, os_release,
earliest_release=5, section='keystone_authtoken',
check_kvs=None):
"""Check Memcache is running and is configured to be used
Example call from Amulet test:
def test_110_memcache(s... | python | def validate_memcache(self, sentry_unit, conf, os_release,
earliest_release=5, section='keystone_authtoken',
check_kvs=None):
"""Check Memcache is running and is configured to be used
Example call from Amulet test:
def test_110_memcache(s... | [
"def",
"validate_memcache",
"(",
"self",
",",
"sentry_unit",
",",
"conf",
",",
"os_release",
",",
"earliest_release",
"=",
"5",
",",
"section",
"=",
"'keystone_authtoken'",
",",
"check_kvs",
"=",
"None",
")",
":",
"if",
"os_release",
"<",
"earliest_release",
"... | Check Memcache is running and is configured to be used
Example call from Amulet test:
def test_110_memcache(self):
u.validate_memcache(self.neutron_api_sentry,
'/etc/neutron/neutron.conf',
self._get_openstack_r... | [
"Check",
"Memcache",
"is",
"running",
"and",
"is",
"configured",
"to",
"be",
"used"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/amulet/utils.py#L1523-L1588 |
12,567 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.acquire | def acquire(self, lock):
'''Acquire the named lock, non-blocking.
The lock may be granted immediately, or in a future hook.
Returns True if the lock has been granted. The lock will be
automatically released at the end of the hook in which it is
granted.
Do not mindless... | python | def acquire(self, lock):
'''Acquire the named lock, non-blocking.
The lock may be granted immediately, or in a future hook.
Returns True if the lock has been granted. The lock will be
automatically released at the end of the hook in which it is
granted.
Do not mindless... | [
"def",
"acquire",
"(",
"self",
",",
"lock",
")",
":",
"unit",
"=",
"hookenv",
".",
"local_unit",
"(",
")",
"ts",
"=",
"self",
".",
"requests",
"[",
"unit",
"]",
".",
"get",
"(",
"lock",
")",
"if",
"not",
"ts",
":",
"# If there is no outstanding request... | Acquire the named lock, non-blocking.
The lock may be granted immediately, or in a future hook.
Returns True if the lock has been granted. The lock will be
automatically released at the end of the hook in which it is
granted.
Do not mindlessly call this method, as it triggers ... | [
"Acquire",
"the",
"named",
"lock",
"non",
"-",
"blocking",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L301-L336 |
12,568 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.granted | def granted(self, lock):
'''Return True if a previously requested lock has been granted'''
unit = hookenv.local_unit()
ts = self.requests[unit].get(lock)
if ts and self.grants.get(unit, {}).get(lock) == ts:
return True
return False | python | def granted(self, lock):
'''Return True if a previously requested lock has been granted'''
unit = hookenv.local_unit()
ts = self.requests[unit].get(lock)
if ts and self.grants.get(unit, {}).get(lock) == ts:
return True
return False | [
"def",
"granted",
"(",
"self",
",",
"lock",
")",
":",
"unit",
"=",
"hookenv",
".",
"local_unit",
"(",
")",
"ts",
"=",
"self",
".",
"requests",
"[",
"unit",
"]",
".",
"get",
"(",
"lock",
")",
"if",
"ts",
"and",
"self",
".",
"grants",
".",
"get",
... | Return True if a previously requested lock has been granted | [
"Return",
"True",
"if",
"a",
"previously",
"requested",
"lock",
"has",
"been",
"granted"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L338-L344 |
12,569 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.request_timestamp | def request_timestamp(self, lock):
'''Return the timestamp of our outstanding request for lock, or None.
Returns a datetime.datetime() UTC timestamp, with no tzinfo attribute.
'''
ts = self.requests[hookenv.local_unit()].get(lock, None)
if ts is not None:
return date... | python | def request_timestamp(self, lock):
'''Return the timestamp of our outstanding request for lock, or None.
Returns a datetime.datetime() UTC timestamp, with no tzinfo attribute.
'''
ts = self.requests[hookenv.local_unit()].get(lock, None)
if ts is not None:
return date... | [
"def",
"request_timestamp",
"(",
"self",
",",
"lock",
")",
":",
"ts",
"=",
"self",
".",
"requests",
"[",
"hookenv",
".",
"local_unit",
"(",
")",
"]",
".",
"get",
"(",
"lock",
",",
"None",
")",
"if",
"ts",
"is",
"not",
"None",
":",
"return",
"dateti... | Return the timestamp of our outstanding request for lock, or None.
Returns a datetime.datetime() UTC timestamp, with no tzinfo attribute. | [
"Return",
"the",
"timestamp",
"of",
"our",
"outstanding",
"request",
"for",
"lock",
"or",
"None",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L350-L357 |
12,570 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.grant | def grant(self, lock, unit):
'''Maybe grant the lock to a unit.
The decision to grant the lock or not is made for $lock
by a corresponding method grant_$lock, which you may define
in a subclass. If no such method is defined, the default_grant
method is used. See Serial.default_g... | python | def grant(self, lock, unit):
'''Maybe grant the lock to a unit.
The decision to grant the lock or not is made for $lock
by a corresponding method grant_$lock, which you may define
in a subclass. If no such method is defined, the default_grant
method is used. See Serial.default_g... | [
"def",
"grant",
"(",
"self",
",",
"lock",
",",
"unit",
")",
":",
"if",
"not",
"hookenv",
".",
"is_leader",
"(",
")",
":",
"return",
"False",
"# Not the leader, so we cannot grant.",
"# Set of units already granted the lock.",
"granted",
"=",
"set",
"(",
")",
"fo... | Maybe grant the lock to a unit.
The decision to grant the lock or not is made for $lock
by a corresponding method grant_$lock, which you may define
in a subclass. If no such method is defined, the default_grant
method is used. See Serial.default_grant() for details. | [
"Maybe",
"grant",
"the",
"lock",
"to",
"a",
"unit",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L387-L427 |
12,571 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.released | def released(self, unit, lock, timestamp):
'''Called on the leader when it has released a lock.
By default, does nothing but log messages. Override if you
need to perform additional housekeeping when a lock is released,
for example recording timestamps.
'''
interval = _u... | python | def released(self, unit, lock, timestamp):
'''Called on the leader when it has released a lock.
By default, does nothing but log messages. Override if you
need to perform additional housekeeping when a lock is released,
for example recording timestamps.
'''
interval = _u... | [
"def",
"released",
"(",
"self",
",",
"unit",
",",
"lock",
",",
"timestamp",
")",
":",
"interval",
"=",
"_utcnow",
"(",
")",
"-",
"timestamp",
"self",
".",
"msg",
"(",
"'Leader released {} from {}, held {}'",
".",
"format",
"(",
"lock",
",",
"unit",
",",
... | Called on the leader when it has released a lock.
By default, does nothing but log messages. Override if you
need to perform additional housekeeping when a lock is released,
for example recording timestamps. | [
"Called",
"on",
"the",
"leader",
"when",
"it",
"has",
"released",
"a",
"lock",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L429-L438 |
12,572 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.require | def require(self, lock, guard_func, *guard_args, **guard_kw):
"""Decorate a function to be run only when a lock is acquired.
The lock is requested if the guard function returns True.
The decorated function is called if the lock has been granted.
"""
def decorator(f):
... | python | def require(self, lock, guard_func, *guard_args, **guard_kw):
"""Decorate a function to be run only when a lock is acquired.
The lock is requested if the guard function returns True.
The decorated function is called if the lock has been granted.
"""
def decorator(f):
... | [
"def",
"require",
"(",
"self",
",",
"lock",
",",
"guard_func",
",",
"*",
"guard_args",
",",
"*",
"*",
"guard_kw",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
... | Decorate a function to be run only when a lock is acquired.
The lock is requested if the guard function returns True.
The decorated function is called if the lock has been granted. | [
"Decorate",
"a",
"function",
"to",
"be",
"run",
"only",
"when",
"a",
"lock",
"is",
"acquired",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L440-L457 |
12,573 | juju/charm-helpers | charmhelpers/coordinator.py | BaseCoordinator.msg | def msg(self, msg):
'''Emit a message. Override to customize log spam.'''
hookenv.log('coordinator.{} {}'.format(self._name(), msg),
level=hookenv.INFO) | python | def msg(self, msg):
'''Emit a message. Override to customize log spam.'''
hookenv.log('coordinator.{} {}'.format(self._name(), msg),
level=hookenv.INFO) | [
"def",
"msg",
"(",
"self",
",",
"msg",
")",
":",
"hookenv",
".",
"log",
"(",
"'coordinator.{} {}'",
".",
"format",
"(",
"self",
".",
"_name",
"(",
")",
",",
"msg",
")",
",",
"level",
"=",
"hookenv",
".",
"INFO",
")"
] | Emit a message. Override to customize log spam. | [
"Emit",
"a",
"message",
".",
"Override",
"to",
"customize",
"log",
"spam",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/coordinator.py#L459-L462 |
12,574 | juju/charm-helpers | charmhelpers/__init__.py | deprecate | def deprecate(warning, date=None, log=None):
"""Add a deprecation warning the first time the function is used.
The date, which is a string in semi-ISO8660 format indicate the year-month
that the function is officially going to be removed.
usage:
@deprecate('use core/fetch/add_source() instead', '2... | python | def deprecate(warning, date=None, log=None):
"""Add a deprecation warning the first time the function is used.
The date, which is a string in semi-ISO8660 format indicate the year-month
that the function is officially going to be removed.
usage:
@deprecate('use core/fetch/add_source() instead', '2... | [
"def",
"deprecate",
"(",
"warning",
",",
"date",
"=",
"None",
",",
"log",
"=",
"None",
")",
":",
"def",
"wrap",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapped_f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")... | Add a deprecation warning the first time the function is used.
The date, which is a string in semi-ISO8660 format indicate the year-month
that the function is officially going to be removed.
usage:
@deprecate('use core/fetch/add_source() instead', '2017-04')
def contributed_add_source_thing(...):
... | [
"Add",
"a",
"deprecation",
"warning",
"the",
"first",
"time",
"the",
"function",
"is",
"used",
".",
"The",
"date",
"which",
"is",
"a",
"string",
"in",
"semi",
"-",
"ISO8660",
"format",
"indicate",
"the",
"year",
"-",
"month",
"that",
"the",
"function",
"... | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/__init__.py#L50-L97 |
12,575 | juju/charm-helpers | charmhelpers/fetch/archiveurl.py | ArchiveUrlFetchHandler.download | def download(self, source, dest):
"""
Download an archive file.
:param str source: URL pointing to an archive file.
:param str dest: Local path location to download archive file to.
"""
# propagate all exceptions
# URLError, OSError, etc
proto, netloc, pa... | python | def download(self, source, dest):
"""
Download an archive file.
:param str source: URL pointing to an archive file.
:param str dest: Local path location to download archive file to.
"""
# propagate all exceptions
# URLError, OSError, etc
proto, netloc, pa... | [
"def",
"download",
"(",
"self",
",",
"source",
",",
"dest",
")",
":",
"# propagate all exceptions",
"# URLError, OSError, etc",
"proto",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"fragment",
"=",
"urlparse",
"(",
"source",
")",
"if",
"pro... | Download an archive file.
:param str source: URL pointing to an archive file.
:param str dest: Local path location to download archive file to. | [
"Download",
"an",
"archive",
"file",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/fetch/archiveurl.py#L85-L114 |
12,576 | juju/charm-helpers | charmhelpers/fetch/archiveurl.py | ArchiveUrlFetchHandler.install | def install(self, source, dest=None, checksum=None, hash_type='sha1'):
"""
Download and install an archive file, with optional checksum validation.
The checksum can also be given on the `source` URL's fragment.
For example::
handler.install('http://example.com/file.tgz#sha1... | python | def install(self, source, dest=None, checksum=None, hash_type='sha1'):
"""
Download and install an archive file, with optional checksum validation.
The checksum can also be given on the `source` URL's fragment.
For example::
handler.install('http://example.com/file.tgz#sha1... | [
"def",
"install",
"(",
"self",
",",
"source",
",",
"dest",
"=",
"None",
",",
"checksum",
"=",
"None",
",",
"hash_type",
"=",
"'sha1'",
")",
":",
"url_parts",
"=",
"self",
".",
"parse_url",
"(",
"source",
")",
"dest_dir",
"=",
"os",
".",
"path",
".",
... | Download and install an archive file, with optional checksum validation.
The checksum can also be given on the `source` URL's fragment.
For example::
handler.install('http://example.com/file.tgz#sha1=deadbeef')
:param str source: URL pointing to an archive file.
:param str... | [
"Download",
"and",
"install",
"an",
"archive",
"file",
"with",
"optional",
"checksum",
"validation",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/fetch/archiveurl.py#L122-L165 |
12,577 | juju/charm-helpers | charmhelpers/fetch/python/debug.py | set_trace | def set_trace(addr=DEFAULT_ADDR, port=DEFAULT_PORT):
"""
Set a trace point using the remote debugger
"""
atexit.register(close_port, port)
try:
log("Starting a remote python debugger session on %s:%s" % (addr,
port))
... | python | def set_trace(addr=DEFAULT_ADDR, port=DEFAULT_PORT):
"""
Set a trace point using the remote debugger
"""
atexit.register(close_port, port)
try:
log("Starting a remote python debugger session on %s:%s" % (addr,
port))
... | [
"def",
"set_trace",
"(",
"addr",
"=",
"DEFAULT_ADDR",
",",
"port",
"=",
"DEFAULT_PORT",
")",
":",
"atexit",
".",
"register",
"(",
"close_port",
",",
"port",
")",
"try",
":",
"log",
"(",
"\"Starting a remote python debugger session on %s:%s\"",
"%",
"(",
"addr",
... | Set a trace point using the remote debugger | [
"Set",
"a",
"trace",
"point",
"using",
"the",
"remote",
"debugger"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/fetch/python/debug.py#L41-L54 |
12,578 | juju/charm-helpers | charmhelpers/contrib/mellanox/infiniband.py | device_info | def device_info(device):
"""Returns a DeviceInfo object with the current device settings"""
status = subprocess.check_output([
'ibstat', device, '-s']).splitlines()
regexes = {
"CA type: (.*)": "device_type",
"Number of ports: (.*)": "num_ports",
"Firmware version: (.*)": "... | python | def device_info(device):
"""Returns a DeviceInfo object with the current device settings"""
status = subprocess.check_output([
'ibstat', device, '-s']).splitlines()
regexes = {
"CA type: (.*)": "device_type",
"Number of ports: (.*)": "num_ports",
"Firmware version: (.*)": "... | [
"def",
"device_info",
"(",
"device",
")",
":",
"status",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'ibstat'",
",",
"device",
",",
"'-s'",
"]",
")",
".",
"splitlines",
"(",
")",
"regexes",
"=",
"{",
"\"CA type: (.*)\"",
":",
"\"device_type\"",
",",... | Returns a DeviceInfo object with the current device settings | [
"Returns",
"a",
"DeviceInfo",
"object",
"with",
"the",
"current",
"device",
"settings"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/mellanox/infiniband.py#L111-L134 |
12,579 | juju/charm-helpers | charmhelpers/contrib/mellanox/infiniband.py | ipoib_interfaces | def ipoib_interfaces():
"""Return a list of IPOIB capable ethernet interfaces"""
interfaces = []
for interface in network_interfaces():
try:
driver = re.search('^driver: (.+)$', subprocess.check_output([
'ethtool', '-i',
interface]), re.M).group(1)
... | python | def ipoib_interfaces():
"""Return a list of IPOIB capable ethernet interfaces"""
interfaces = []
for interface in network_interfaces():
try:
driver = re.search('^driver: (.+)$', subprocess.check_output([
'ethtool', '-i',
interface]), re.M).group(1)
... | [
"def",
"ipoib_interfaces",
"(",
")",
":",
"interfaces",
"=",
"[",
"]",
"for",
"interface",
"in",
"network_interfaces",
"(",
")",
":",
"try",
":",
"driver",
"=",
"re",
".",
"search",
"(",
"'^driver: (.+)$'",
",",
"subprocess",
".",
"check_output",
"(",
"[",... | Return a list of IPOIB capable ethernet interfaces | [
"Return",
"a",
"list",
"of",
"IPOIB",
"capable",
"ethernet",
"interfaces"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/mellanox/infiniband.py#L137-L153 |
12,580 | juju/charm-helpers | charmhelpers/contrib/hardening/host/checks/login.py | get_audits | def get_audits():
"""Get OS hardening login.defs audits.
:returns: dictionary of audits
"""
audits = [TemplatedFile('/etc/login.defs', LoginContext(),
template_dir=TEMPLATES_DIR,
user='root', group='root', mode=0o0444)]
return audits | python | def get_audits():
"""Get OS hardening login.defs audits.
:returns: dictionary of audits
"""
audits = [TemplatedFile('/etc/login.defs', LoginContext(),
template_dir=TEMPLATES_DIR,
user='root', group='root', mode=0o0444)]
return audits | [
"def",
"get_audits",
"(",
")",
":",
"audits",
"=",
"[",
"TemplatedFile",
"(",
"'/etc/login.defs'",
",",
"LoginContext",
"(",
")",
",",
"template_dir",
"=",
"TEMPLATES_DIR",
",",
"user",
"=",
"'root'",
",",
"group",
"=",
"'root'",
",",
"mode",
"=",
"0o0444"... | Get OS hardening login.defs audits.
:returns: dictionary of audits | [
"Get",
"OS",
"hardening",
"login",
".",
"defs",
"audits",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/host/checks/login.py#L22-L30 |
12,581 | juju/charm-helpers | charmhelpers/contrib/hardening/utils.py | _get_defaults | def _get_defaults(modules):
"""Load the default config for the provided modules.
:param modules: stack modules config defaults to lookup.
:returns: modules default config dictionary.
"""
default = os.path.join(os.path.dirname(__file__),
'defaults/%s.yaml' % (modules))
... | python | def _get_defaults(modules):
"""Load the default config for the provided modules.
:param modules: stack modules config defaults to lookup.
:returns: modules default config dictionary.
"""
default = os.path.join(os.path.dirname(__file__),
'defaults/%s.yaml' % (modules))
... | [
"def",
"_get_defaults",
"(",
"modules",
")",
":",
"default",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'defaults/%s.yaml'",
"%",
"(",
"modules",
")",
")",
"return",
"yaml",
".",
"safe_load"... | Load the default config for the provided modules.
:param modules: stack modules config defaults to lookup.
:returns: modules default config dictionary. | [
"Load",
"the",
"default",
"config",
"for",
"the",
"provided",
"modules",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/utils.py#L37-L45 |
12,582 | juju/charm-helpers | charmhelpers/contrib/hardening/utils.py | _get_schema | def _get_schema(modules):
"""Load the config schema for the provided modules.
NOTE: this schema is intended to have 1-1 relationship with they keys in
the default config and is used a means to verify valid overrides provided
by the user.
:param modules: stack modules config schema to lookup.
:... | python | def _get_schema(modules):
"""Load the config schema for the provided modules.
NOTE: this schema is intended to have 1-1 relationship with they keys in
the default config and is used a means to verify valid overrides provided
by the user.
:param modules: stack modules config schema to lookup.
:... | [
"def",
"_get_schema",
"(",
"modules",
")",
":",
"schema",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'defaults/%s.yaml.schema'",
"%",
"(",
"modules",
")",
")",
"return",
"yaml",
".",
"safe_l... | Load the config schema for the provided modules.
NOTE: this schema is intended to have 1-1 relationship with they keys in
the default config and is used a means to verify valid overrides provided
by the user.
:param modules: stack modules config schema to lookup.
:returns: modules default schema d... | [
"Load",
"the",
"config",
"schema",
"for",
"the",
"provided",
"modules",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/utils.py#L48-L60 |
12,583 | juju/charm-helpers | charmhelpers/contrib/hardening/utils.py | _get_user_provided_overrides | def _get_user_provided_overrides(modules):
"""Load user-provided config overrides.
:param modules: stack modules to lookup in user overrides yaml file.
:returns: overrides dictionary.
"""
overrides = os.path.join(os.environ['JUJU_CHARM_DIR'],
'hardening.yaml')
if os... | python | def _get_user_provided_overrides(modules):
"""Load user-provided config overrides.
:param modules: stack modules to lookup in user overrides yaml file.
:returns: overrides dictionary.
"""
overrides = os.path.join(os.environ['JUJU_CHARM_DIR'],
'hardening.yaml')
if os... | [
"def",
"_get_user_provided_overrides",
"(",
"modules",
")",
":",
"overrides",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
"[",
"'JUJU_CHARM_DIR'",
"]",
",",
"'hardening.yaml'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"override... | Load user-provided config overrides.
:param modules: stack modules to lookup in user overrides yaml file.
:returns: overrides dictionary. | [
"Load",
"user",
"-",
"provided",
"config",
"overrides",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/utils.py#L63-L84 |
12,584 | juju/charm-helpers | charmhelpers/contrib/hardening/utils.py | _apply_overrides | def _apply_overrides(settings, overrides, schema):
"""Get overrides config overlayed onto modules defaults.
:param modules: require stack modules config.
:returns: dictionary of modules config with user overrides applied.
"""
if overrides:
for k, v in six.iteritems(overrides):
i... | python | def _apply_overrides(settings, overrides, schema):
"""Get overrides config overlayed onto modules defaults.
:param modules: require stack modules config.
:returns: dictionary of modules config with user overrides applied.
"""
if overrides:
for k, v in six.iteritems(overrides):
i... | [
"def",
"_apply_overrides",
"(",
"settings",
",",
"overrides",
",",
"schema",
")",
":",
"if",
"overrides",
":",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"overrides",
")",
":",
"if",
"k",
"in",
"schema",
":",
"if",
"schema",
"[",
"k",
... | Get overrides config overlayed onto modules defaults.
:param modules: require stack modules config.
:returns: dictionary of modules config with user overrides applied. | [
"Get",
"overrides",
"config",
"overlayed",
"onto",
"modules",
"defaults",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/utils.py#L87-L107 |
12,585 | juju/charm-helpers | charmhelpers/contrib/hardening/utils.py | ensure_permissions | def ensure_permissions(path, user, group, permissions, maxdepth=-1):
"""Ensure permissions for path.
If path is a file, apply to file and return. If path is a directory,
apply recursively (if required) to directory contents and return.
:param user: user name
:param group: group name
:param per... | python | def ensure_permissions(path, user, group, permissions, maxdepth=-1):
"""Ensure permissions for path.
If path is a file, apply to file and return. If path is a directory,
apply recursively (if required) to directory contents and return.
:param user: user name
:param group: group name
:param per... | [
"def",
"ensure_permissions",
"(",
"path",
",",
"user",
",",
"group",
",",
"permissions",
",",
"maxdepth",
"=",
"-",
"1",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"log",
"(",
"\"File '%s' does not exist - cannot set pe... | Ensure permissions for path.
If path is a file, apply to file and return. If path is a directory,
apply recursively (if required) to directory contents and return.
:param user: user name
:param group: group name
:param permissions: octal permissions
:param maxdepth: maximum recursion depth. A ... | [
"Ensure",
"permissions",
"for",
"path",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/utils.py#L122-L155 |
12,586 | juju/charm-helpers | charmhelpers/core/sysctl.py | create | def create(sysctl_dict, sysctl_file, ignore=False):
"""Creates a sysctl.conf file from a YAML associative array
:param sysctl_dict: a dict or YAML-formatted string of sysctl
options eg "{ 'kernel.max_pid': 1337 }"
:type sysctl_dict: str
:param sysctl_file: path to the sysctl fil... | python | def create(sysctl_dict, sysctl_file, ignore=False):
"""Creates a sysctl.conf file from a YAML associative array
:param sysctl_dict: a dict or YAML-formatted string of sysctl
options eg "{ 'kernel.max_pid': 1337 }"
:type sysctl_dict: str
:param sysctl_file: path to the sysctl fil... | [
"def",
"create",
"(",
"sysctl_dict",
",",
"sysctl_file",
",",
"ignore",
"=",
"False",
")",
":",
"if",
"type",
"(",
"sysctl_dict",
")",
"is",
"not",
"dict",
":",
"try",
":",
"sysctl_dict_parsed",
"=",
"yaml",
".",
"safe_load",
"(",
"sysctl_dict",
")",
"ex... | Creates a sysctl.conf file from a YAML associative array
:param sysctl_dict: a dict or YAML-formatted string of sysctl
options eg "{ 'kernel.max_pid': 1337 }"
:type sysctl_dict: str
:param sysctl_file: path to the sysctl file to be saved
:type sysctl_file: str or unicode
:pa... | [
"Creates",
"a",
"sysctl",
".",
"conf",
"file",
"from",
"a",
"YAML",
"associative",
"array"
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/sysctl.py#L31-L65 |
12,587 | juju/charm-helpers | charmhelpers/contrib/openstack/ip.py | canonical_url | def canonical_url(configs, endpoint_type=PUBLIC):
"""Returns the correct HTTP URL to this host given the state of HTTPS
configuration, hacluster and charm configuration.
:param configs: OSTemplateRenderer config templating object to inspect
for a complete https context.
:param endpo... | python | def canonical_url(configs, endpoint_type=PUBLIC):
"""Returns the correct HTTP URL to this host given the state of HTTPS
configuration, hacluster and charm configuration.
:param configs: OSTemplateRenderer config templating object to inspect
for a complete https context.
:param endpo... | [
"def",
"canonical_url",
"(",
"configs",
",",
"endpoint_type",
"=",
"PUBLIC",
")",
":",
"scheme",
"=",
"_get_scheme",
"(",
"configs",
")",
"address",
"=",
"resolve_address",
"(",
"endpoint_type",
")",
"if",
"is_ipv6",
"(",
"address",
")",
":",
"address",
"=",... | Returns the correct HTTP URL to this host given the state of HTTPS
configuration, hacluster and charm configuration.
:param configs: OSTemplateRenderer config templating object to inspect
for a complete https context.
:param endpoint_type: str endpoint type to resolve.
:param return... | [
"Returns",
"the",
"correct",
"HTTP",
"URL",
"to",
"this",
"host",
"given",
"the",
"state",
"of",
"HTTPS",
"configuration",
"hacluster",
"and",
"charm",
"configuration",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/ip.py#L64-L79 |
12,588 | juju/charm-helpers | charmhelpers/contrib/openstack/ip.py | _get_address_override | def _get_address_override(endpoint_type=PUBLIC):
"""Returns any address overrides that the user has defined based on the
endpoint type.
Note: this function allows for the service name to be inserted into the
address if the user specifies {service_name}.somehost.org.
:param endpoint_type: the type ... | python | def _get_address_override(endpoint_type=PUBLIC):
"""Returns any address overrides that the user has defined based on the
endpoint type.
Note: this function allows for the service name to be inserted into the
address if the user specifies {service_name}.somehost.org.
:param endpoint_type: the type ... | [
"def",
"_get_address_override",
"(",
"endpoint_type",
"=",
"PUBLIC",
")",
":",
"override_key",
"=",
"ADDRESS_MAP",
"[",
"endpoint_type",
"]",
"[",
"'override'",
"]",
"addr_override",
"=",
"config",
"(",
"override_key",
")",
"if",
"not",
"addr_override",
":",
"re... | Returns any address overrides that the user has defined based on the
endpoint type.
Note: this function allows for the service name to be inserted into the
address if the user specifies {service_name}.somehost.org.
:param endpoint_type: the type of endpoint to retrieve the override
... | [
"Returns",
"any",
"address",
"overrides",
"that",
"the",
"user",
"has",
"defined",
"based",
"on",
"the",
"endpoint",
"type",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/ip.py#L97-L114 |
12,589 | juju/charm-helpers | charmhelpers/contrib/openstack/ip.py | resolve_address | def resolve_address(endpoint_type=PUBLIC, override=True):
"""Return unit address depending on net config.
If unit is clustered with vip(s) and has net splits defined, return vip on
correct network. If clustered with no nets defined, return primary vip.
If not clustered, return unit address ensuring ad... | python | def resolve_address(endpoint_type=PUBLIC, override=True):
"""Return unit address depending on net config.
If unit is clustered with vip(s) and has net splits defined, return vip on
correct network. If clustered with no nets defined, return primary vip.
If not clustered, return unit address ensuring ad... | [
"def",
"resolve_address",
"(",
"endpoint_type",
"=",
"PUBLIC",
",",
"override",
"=",
"True",
")",
":",
"resolved_address",
"=",
"None",
"if",
"override",
":",
"resolved_address",
"=",
"_get_address_override",
"(",
"endpoint_type",
")",
"if",
"resolved_address",
":... | Return unit address depending on net config.
If unit is clustered with vip(s) and has net splits defined, return vip on
correct network. If clustered with no nets defined, return primary vip.
If not clustered, return unit address ensuring address is on configured net
split if one is configured, or a J... | [
"Return",
"unit",
"address",
"depending",
"on",
"net",
"config",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/ip.py#L117-L187 |
12,590 | juju/charm-helpers | charmhelpers/core/hugepage.py | hugepage_support | def hugepage_support(user, group='hugetlb', nr_hugepages=256,
max_map_count=65536, mnt_point='/run/hugepages/kvm',
pagesize='2MB', mount=True, set_shmmax=False):
"""Enable hugepages on system.
Args:
user (str) -- Username to allow access to hugepages to
group ... | python | def hugepage_support(user, group='hugetlb', nr_hugepages=256,
max_map_count=65536, mnt_point='/run/hugepages/kvm',
pagesize='2MB', mount=True, set_shmmax=False):
"""Enable hugepages on system.
Args:
user (str) -- Username to allow access to hugepages to
group ... | [
"def",
"hugepage_support",
"(",
"user",
",",
"group",
"=",
"'hugetlb'",
",",
"nr_hugepages",
"=",
"256",
",",
"max_map_count",
"=",
"65536",
",",
"mnt_point",
"=",
"'/run/hugepages/kvm'",
",",
"pagesize",
"=",
"'2MB'",
",",
"mount",
"=",
"True",
",",
"set_sh... | Enable hugepages on system.
Args:
user (str) -- Username to allow access to hugepages to
group (str) -- Group name to own hugepages
nr_hugepages (int) -- Number of pages to reserve
max_map_count (int) -- Number of Virtual Memory Areas a process can own
mnt_point (str) -- Directory to mount hug... | [
"Enable",
"hugepages",
"on",
"system",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/hugepage.py#L30-L69 |
12,591 | juju/charm-helpers | charmhelpers/contrib/hardening/audits/apache.py | DisabledModuleAudit.ensure_compliance | def ensure_compliance(self):
"""Ensures that the modules are not loaded."""
if not self.modules:
return
try:
loaded_modules = self._get_loaded_modules()
non_compliant_modules = []
for module in self.modules:
if module in loaded_mod... | python | def ensure_compliance(self):
"""Ensures that the modules are not loaded."""
if not self.modules:
return
try:
loaded_modules = self._get_loaded_modules()
non_compliant_modules = []
for module in self.modules:
if module in loaded_mod... | [
"def",
"ensure_compliance",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"modules",
":",
"return",
"try",
":",
"loaded_modules",
"=",
"self",
".",
"_get_loaded_modules",
"(",
")",
"non_compliant_modules",
"=",
"[",
"]",
"for",
"module",
"in",
"self",
"... | Ensures that the modules are not loaded. | [
"Ensures",
"that",
"the",
"modules",
"are",
"not",
"loaded",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/audits/apache.py#L43-L66 |
12,592 | juju/charm-helpers | charmhelpers/contrib/hardening/audits/apache.py | DisabledModuleAudit._get_loaded_modules | def _get_loaded_modules():
"""Returns the modules which are enabled in Apache."""
output = subprocess.check_output(['apache2ctl', '-M'])
if six.PY3:
output = output.decode('utf-8')
modules = []
for line in output.splitlines():
# Each line of the enabled mo... | python | def _get_loaded_modules():
"""Returns the modules which are enabled in Apache."""
output = subprocess.check_output(['apache2ctl', '-M'])
if six.PY3:
output = output.decode('utf-8')
modules = []
for line in output.splitlines():
# Each line of the enabled mo... | [
"def",
"_get_loaded_modules",
"(",
")",
":",
"output",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'apache2ctl'",
",",
"'-M'",
"]",
")",
"if",
"six",
".",
"PY3",
":",
"output",
"=",
"output",
".",
"decode",
"(",
"'utf-8'",
")",
"modules",
"=",
"... | Returns the modules which are enabled in Apache. | [
"Returns",
"the",
"modules",
"which",
"are",
"enabled",
"in",
"Apache",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/audits/apache.py#L69-L83 |
12,593 | juju/charm-helpers | charmhelpers/contrib/hardening/audits/apache.py | DisabledModuleAudit._disable_module | def _disable_module(module):
"""Disables the specified module in Apache."""
try:
subprocess.check_call(['a2dismod', module])
except subprocess.CalledProcessError as e:
# Note: catch error here to allow the attempt of disabling
# multiple modules in one go rath... | python | def _disable_module(module):
"""Disables the specified module in Apache."""
try:
subprocess.check_call(['a2dismod', module])
except subprocess.CalledProcessError as e:
# Note: catch error here to allow the attempt of disabling
# multiple modules in one go rath... | [
"def",
"_disable_module",
"(",
"module",
")",
":",
"try",
":",
"subprocess",
".",
"check_call",
"(",
"[",
"'a2dismod'",
",",
"module",
"]",
")",
"except",
"subprocess",
".",
"CalledProcessError",
"as",
"e",
":",
"# Note: catch error here to allow the attempt of disa... | Disables the specified module in Apache. | [
"Disables",
"the",
"specified",
"module",
"in",
"Apache",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/audits/apache.py#L86-L95 |
12,594 | juju/charm-helpers | charmhelpers/contrib/hardening/templating.py | get_template_path | def get_template_path(template_dir, path):
"""Returns the template file which would be used to render the path.
The path to the template file is returned.
:param template_dir: the directory the templates are located in
:param path: the file path to be written to.
:returns: path to the template file... | python | def get_template_path(template_dir, path):
"""Returns the template file which would be used to render the path.
The path to the template file is returned.
:param template_dir: the directory the templates are located in
:param path: the file path to be written to.
:returns: path to the template file... | [
"def",
"get_template_path",
"(",
"template_dir",
",",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"template_dir",
",",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")"
] | Returns the template file which would be used to render the path.
The path to the template file is returned.
:param template_dir: the directory the templates are located in
:param path: the file path to be written to.
:returns: path to the template file | [
"Returns",
"the",
"template",
"file",
"which",
"would",
"be",
"used",
"to",
"render",
"the",
"path",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/templating.py#L44-L52 |
12,595 | juju/charm-helpers | charmhelpers/contrib/hardening/templating.py | render_and_write | def render_and_write(template_dir, path, context):
"""Renders the specified template into the file.
:param template_dir: the directory to load the template from
:param path: the path to write the templated contents to
:param context: the parameters to pass to the rendering engine
"""
env = Envi... | python | def render_and_write(template_dir, path, context):
"""Renders the specified template into the file.
:param template_dir: the directory to load the template from
:param path: the path to write the templated contents to
:param context: the parameters to pass to the rendering engine
"""
env = Envi... | [
"def",
"render_and_write",
"(",
"template_dir",
",",
"path",
",",
"context",
")",
":",
"env",
"=",
"Environment",
"(",
"loader",
"=",
"FileSystemLoader",
"(",
"template_dir",
")",
")",
"template_file",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"path",
... | Renders the specified template into the file.
:param template_dir: the directory to load the template from
:param path: the path to write the templated contents to
:param context: the parameters to pass to the rendering engine | [
"Renders",
"the",
"specified",
"template",
"into",
"the",
"file",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/templating.py#L55-L73 |
12,596 | juju/charm-helpers | charmhelpers/contrib/hardening/host/checks/apt.py | get_audits | def get_audits():
"""Get OS hardening apt audits.
:returns: dictionary of audits
"""
audits = [AptConfig([{'key': 'APT::Get::AllowUnauthenticated',
'expected': 'false'}])]
settings = get_settings('os')
clean_packages = settings['security']['packages_clean']
if cl... | python | def get_audits():
"""Get OS hardening apt audits.
:returns: dictionary of audits
"""
audits = [AptConfig([{'key': 'APT::Get::AllowUnauthenticated',
'expected': 'false'}])]
settings = get_settings('os')
clean_packages = settings['security']['packages_clean']
if cl... | [
"def",
"get_audits",
"(",
")",
":",
"audits",
"=",
"[",
"AptConfig",
"(",
"[",
"{",
"'key'",
":",
"'APT::Get::AllowUnauthenticated'",
",",
"'expected'",
":",
"'false'",
"}",
"]",
")",
"]",
"settings",
"=",
"get_settings",
"(",
"'os'",
")",
"clean_packages",
... | Get OS hardening apt audits.
:returns: dictionary of audits | [
"Get",
"OS",
"hardening",
"apt",
"audits",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/host/checks/apt.py#L22-L37 |
12,597 | juju/charm-helpers | charmhelpers/contrib/hardening/host/checks/pam.py | get_audits | def get_audits():
"""Get OS hardening PAM authentication audits.
:returns: dictionary of audits
"""
audits = []
settings = utils.get_settings('os')
if settings['auth']['pam_passwdqc_enable']:
audits.append(PasswdqcPAM('/etc/passwdqc.conf'))
if settings['auth']['retries']:
... | python | def get_audits():
"""Get OS hardening PAM authentication audits.
:returns: dictionary of audits
"""
audits = []
settings = utils.get_settings('os')
if settings['auth']['pam_passwdqc_enable']:
audits.append(PasswdqcPAM('/etc/passwdqc.conf'))
if settings['auth']['retries']:
... | [
"def",
"get_audits",
"(",
")",
":",
"audits",
"=",
"[",
"]",
"settings",
"=",
"utils",
".",
"get_settings",
"(",
"'os'",
")",
"if",
"settings",
"[",
"'auth'",
"]",
"[",
"'pam_passwdqc_enable'",
"]",
":",
"audits",
".",
"append",
"(",
"PasswdqcPAM",
"(",
... | Get OS hardening PAM authentication audits.
:returns: dictionary of audits | [
"Get",
"OS",
"hardening",
"PAM",
"authentication",
"audits",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/hardening/host/checks/pam.py#L38-L55 |
12,598 | juju/charm-helpers | charmhelpers/contrib/ansible/__init__.py | install_ansible_support | def install_ansible_support(from_ppa=True, ppa_location='ppa:rquillo/ansible'):
"""Installs the ansible package.
By default it is installed from the `PPA`_ linked from
the ansible `website`_ or from a ppa specified by a charm config..
.. _PPA: https://launchpad.net/~rquillo/+archive/ansible
.. _we... | python | def install_ansible_support(from_ppa=True, ppa_location='ppa:rquillo/ansible'):
"""Installs the ansible package.
By default it is installed from the `PPA`_ linked from
the ansible `website`_ or from a ppa specified by a charm config..
.. _PPA: https://launchpad.net/~rquillo/+archive/ansible
.. _we... | [
"def",
"install_ansible_support",
"(",
"from_ppa",
"=",
"True",
",",
"ppa_location",
"=",
"'ppa:rquillo/ansible'",
")",
":",
"if",
"from_ppa",
":",
"charmhelpers",
".",
"fetch",
".",
"add_source",
"(",
"ppa_location",
")",
"charmhelpers",
".",
"fetch",
".",
"apt... | Installs the ansible package.
By default it is installed from the `PPA`_ linked from
the ansible `website`_ or from a ppa specified by a charm config..
.. _PPA: https://launchpad.net/~rquillo/+archive/ansible
.. _website: http://docs.ansible.com/intro_installation.html#latest-releases-via-apt-ubuntu
... | [
"Installs",
"the",
"ansible",
"package",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/ansible/__init__.py#L120-L137 |
12,599 | juju/charm-helpers | charmhelpers/contrib/ansible/__init__.py | AnsibleHooks.execute | def execute(self, args):
"""Execute the hook followed by the playbook using the hook as tag."""
hook_name = os.path.basename(args[0])
extra_vars = None
if hook_name in self._actions:
extra_vars = self._actions[hook_name](args[1:])
else:
super(AnsibleHooks,... | python | def execute(self, args):
"""Execute the hook followed by the playbook using the hook as tag."""
hook_name = os.path.basename(args[0])
extra_vars = None
if hook_name in self._actions:
extra_vars = self._actions[hook_name](args[1:])
else:
super(AnsibleHooks,... | [
"def",
"execute",
"(",
"self",
",",
"args",
")",
":",
"hook_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"args",
"[",
"0",
"]",
")",
"extra_vars",
"=",
"None",
"if",
"hook_name",
"in",
"self",
".",
"_actions",
":",
"extra_vars",
"=",
"self",
... | Execute the hook followed by the playbook using the hook as tag. | [
"Execute",
"the",
"hook",
"followed",
"by",
"the",
"playbook",
"using",
"the",
"hook",
"as",
"tag",
"."
] | aa785c40c3b7a8c69dbfbc7921d6b9f30142e171 | https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/ansible/__init__.py#L219-L229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.