INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
.. versionadded:: 2017. 7. 0 | def add_repo_key(path=None, text=None, keyserver=None, keyid=None, saltenv='base'):
'''
.. versionadded:: 2017.7.0
Add a repo key using ``apt-key add``.
:param str path: The path of the key file to import.
:param str text: The key data to import, in string form.
:param str keyserver: The serve... |
.. versionadded:: 2015. 8. 0 | def del_repo_key(name=None, **kwargs):
'''
.. versionadded:: 2015.8.0
Remove a repo key using ``apt-key del``
name
Repo from which to remove the key. Unnecessary if ``keyid`` is passed.
keyid
The KeyID of the GPG key to remove
keyid_ppa : False
If set to ``True``, the... |
Modify one or more values for a repo. If the repo does not exist it will be created so long as the definition is well formed. For Ubuntu the ppa: <project >/ repo format is acceptable. ppa: format can only be used to create a new repository. | def mod_repo(repo, saltenv='base', **kwargs):
'''
Modify one or more values for a repo. If the repo does not exist, it will
be created, so long as the definition is well formed. For Ubuntu the
``ppa:<project>/repo`` format is acceptable. ``ppa:`` format can only be
used to create a new repository.... |
Take a repository definition and expand it to the full pkg repository dict that can be used for comparison. This is a helper function to make the Debian/ Ubuntu apt sources sane for comparison in the pkgrepo states. | def expand_repo_def(**kwargs):
'''
Take a repository definition and expand it to the full pkg repository dict
that can be used for comparison. This is a helper function to make
the Debian/Ubuntu apt sources sane for comparison in the pkgrepo states.
This is designed to be called from pkgrepo state... |
Parses the format from dpkg -- get - selections and return a format that pkg. get_selections and pkg. set_selections work with. | def _parse_selections(dpkgselection):
'''
Parses the format from ``dpkg --get-selections`` and return a format that
pkg.get_selections and pkg.set_selections work with.
'''
ret = {}
if isinstance(dpkgselection, six.string_types):
dpkgselection = dpkgselection.split('\n')
for line in ... |
View package state from the dpkg database. | def get_selections(pattern=None, state=None):
'''
View package state from the dpkg database.
Returns a dict of dicts containing the state, and package names:
.. code-block:: python
{'<host>':
{'<state>': ['pkg1',
...
]
}... |
Change package state in the dpkg database. | def set_selections(path=None, selection=None, clear=False, saltenv='base'):
'''
Change package state in the dpkg database.
The state can be any one of, documented in ``dpkg(1)``:
- install
- hold
- deinstall
- purge
This command is commonly used to mark specific packages to be held fr... |
Installs missing dependencies and marks them as auto installed so they are removed when no more manually installed packages depend on them. | def _resolve_deps(name, pkgs, **kwargs):
'''
Installs missing dependencies and marks them as auto installed so they
are removed when no more manually installed packages depend on them.
.. versionadded:: 2014.7.0
:depends: - python-apt module
'''
missing_deps = []
for pkg_file in pkgs... |
.. versionadded:: 2019. 2. 0 | def show(*names, **kwargs):
'''
.. versionadded:: 2019.2.0
Runs an ``apt-cache show`` on the passed package names, and returns the
results in a nested dictionary. The top level of the return data will be
the package name, with each package name mapping to a dictionary of version
numbers to any ... |
Return the information of the named package ( s ) installed on the system. | def info_installed(*names, **kwargs):
'''
Return the information of the named package(s) installed on the system.
.. versionadded:: 2015.8.1
names
The names of the packages for which to return information.
failhard
Whether to throw an exception if none of the packages are installe... |
Returns the http_proxy_url if proxy_username proxy_password proxy_host and proxy_port config values are set. | def _get_http_proxy_url():
'''
Returns the http_proxy_url if proxy_username, proxy_password, proxy_host, and proxy_port
config values are set.
Returns a string.
'''
http_proxy_url = ''
host = __salt__['config.option']('proxy_host')
port = __salt__['config.option']('proxy_port')
user... |
If Zabbix template is to be updated then list of assigned hosts must be provided in all or nothing manner to prevent some externally assigned hosts to be detached. | def _diff_and_merge_host_list(defined, existing):
'''
If Zabbix template is to be updated then list of assigned hosts must be provided in all or nothing manner to prevent
some externally assigned hosts to be detached.
:param defined: list of hosts defined in sls
:param existing: list of hosts taken... |
Make a list of given component type not inherited from other templates because Zabbix API returns only list of all and list of inherited component items so we have to do a difference list. | def _get_existing_template_c_list(component, parent_id, **kwargs):
'''
Make a list of given component type not inherited from other templates because Zabbix API returns only list of all
and list of inherited component items so we have to do a difference list.
:param component: Template component (appli... |
For creation or update of object that have attribute which contains a list Zabbix awaits plain list of IDs while querying Zabbix for same object returns list of dicts | def _adjust_object_lists(obj):
'''
For creation or update of object that have attribute which contains a list Zabbix awaits plain list of IDs while
querying Zabbix for same object returns list of dicts
:param obj: Zabbix object parameters
'''
for subcomp in TEMPLATE_COMPONENT_DEF:
if su... |
Takes particular component list compares it with existing call appropriate API methods - create update delete. | def _manage_component(component, parent_id, defined, existing, template_id=None, **kwargs):
'''
Takes particular component list, compares it with existing, call appropriate API methods - create, update, delete.
:param component: component name
:param parent_id: ID of parent entity under which component... |
Check if Zabbix Template already exists. | def is_present(name, **kwargs):
'''
Check if Zabbix Template already exists.
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix password (can also be set in opts... |
Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation. | def present(name, params, static_host_list=True, **kwargs):
'''
Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation.
Zabbix API version: >3.0
:param name: Zabbix Template name
:param params: Additional parameters according to Zabbix API... |
Makes the Zabbix Template to be absent ( either does not exist or delete it ). | def absent(name, **kwargs):
'''
Makes the Zabbix Template to be absent (either does not exist or delete it).
:param name: Zabbix Template name
:param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)
:param _connection_password: Optional - zabbix p... |
Change the gid for a named group | def chgid(name, gid):
'''
Change the gid for a named group
CLI Example:
.. code-block:: bash
salt '*' group.chgid foo 4376
'''
pre_gid = __salt__['file.group_to_gid'](name)
if gid == pre_gid:
return True
cmd = 'groupmod -g {0} {1}'.format(gid, name)
__salt__['cmd.r... |
Generate and return an private_key. If a dns_name is passed in the private_key will be cached under that name. The type of key and the parameters used to generate the key are based on the default certificate use policy associated with the specified zone. | def gen_key(minion_id, dns_name=None, zone='default', password=None):
'''
Generate and return an private_key. If a ``dns_name`` is passed in, the
private_key will be cached under that name. The type of key and the
parameters used to generate the key are based on the default certificate
use policy as... |
Generate a csr using the host s private_key. Analogous to: | def gen_csr(
minion_id,
dns_name,
zone='default',
country=None,
state=None,
loc=None,
org=None,
org_unit=None,
password=None,
):
'''
Generate a csr using the host's private_key.
Analogous to:
.. code-block:: bash
VCert... |
Request a new certificate | def request(
minion_id,
dns_name=None,
zone='default',
request_id=None,
country='US',
state='California',
loc='Palo Alto',
org='Beta Organization',
org_unit='Beta Group',
password=None,
zone_id=None,
):
'''
Request a new... |
Register a new user account | def register(email):
'''
Register a new user account
CLI Example:
.. code-block:: bash
salt-run venafi.register email@example.com
'''
data = __utils__['http.query'](
'{0}/useraccounts'.format(_base_url()),
method='POST',
data=salt.utils.json.dumps({
... |
Show company information especially the company id | def show_company(domain):
'''
Show company information, especially the company id
CLI Example:
.. code-block:: bash
salt-run venafi.show_company example.com
'''
data = __utils__['http.query'](
'{0}/companies/domain/{1}'.format(_base_url(), domain),
status=True,
... |
Show certificate requests for this API key | def show_cert(id_):
'''
Show certificate requests for this API key
CLI Example:
.. code-block:: bash
salt-run venafi.show_cert 01234567-89ab-cdef-0123-456789abcdef
'''
data = __utils__['http.query'](
'{0}/certificaterequests/{1}/certificate'.format(_base_url(), id_),
p... |
List domains that have been cached | def list_domain_cache():
'''
List domains that have been cached
CLI Example:
.. code-block:: bash
salt-run venafi.list_domain_cache
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
return cache.list('venafi/domains') |
Delete cached domains from the master | def del_cached_domain(domains):
'''
Delete cached domains from the master
CLI Example:
.. code-block:: bash
salt-run venafi.del_cached_domain domain1.example.com,domain2.example.com
'''
cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
if isinstance(domains, six.string_types)... |
Ensure a user is present with the specified groups | def user_present(name, password=None, roles=None, encrypted=False, crypt_salt=None, algorithm='sha256'):
'''
Ensure a user is present with the specified groups
name
Name of user
password
Encrypted or Plain Text password for user
roles
List of roles the user should be assig... |
Ensure a user is not present | def user_absent(name):
'''
Ensure a user is not present
name
username to remove if it exists
Examples:
.. code-block:: yaml
delete:
onyx.user_absent:
- name: daniel
'''
ret = {'name': name,
'result': False,
'changes': {},
... |
Ensure a specific configuration line exists in the running config | def config_present(name):
'''
Ensure a specific configuration line exists in the running config
name
config line to set
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_present:
- names:
- snmp-server community randoSNMPstringHERE gro... |
Ensure a specific configuration line does not exist in the running config | def config_absent(name):
'''
Ensure a specific configuration line does not exist in the running config
name
config line to remove
Examples:
.. code-block:: yaml
add snmp group:
onyx.config_absent:
- names:
- snmp-server community randoSNMPstrin... |
Replace all instances of a string or full line in the running config | def replace(name, repl, full_match=False):
'''
Replace all instances of a string or full line in the running config
name
String to replace
repl
The replacement text
full_match
Whether `name` will match the full line or only a subset of the line.
Defaults to False. ... |
Checks existance of the named login. If not present creates the login with the specified roles and options. | def present(name, password=None, domain=None, server_roles=None, options=None, **kwargs):
'''
Checks existance of the named login.
If not present, creates the login with the specified roles and options.
name
The name of the login to manage
password
Creates a SQL Server authenticatio... |
Re - interpret the state returned by salt. state. run using our protocol. | def _reinterpreted_state(state):
'''
Re-interpret the state returned by salt.state.run using our protocol.
'''
ret = state['changes']
state['changes'] = {}
state['comment'] = ''
out = ret.get('stdout')
if not out:
if ret.get('stderr'):
state['comment'] = ret['stderr'... |
Execute the onlyif and unless logic. Return a result dict if: * onlyif failed ( onlyif ! = 0 ) * unless succeeded ( unless == 0 ) else return True | def mod_run_check(cmd_kwargs, onlyif, unless, creates):
'''
Execute the onlyif and unless logic.
Return a result dict if:
* onlyif failed (onlyif != 0)
* unless succeeded (unless == 0)
else return True
'''
# never use VT for onlyif/unless executions because this will lead
# to quote ... |
Run the given command only if the watch statement calls it. | def wait(name,
onlyif=None,
unless=None,
creates=None,
cwd=None,
root=None,
runas=None,
shell=None,
env=(),
stateful=False,
umask=None,
output_loglevel='debug',
hide_output=False,
use_vt=False,
... |
Download a script from a remote source and execute it only if a watch statement calls it. | def wait_script(name,
source=None,
template=None,
onlyif=None,
unless=None,
cwd=None,
runas=None,
shell=None,
env=None,
stateful=False,
umask=None,
... |
Run a command if certain circumstances are met. Use cmd. wait if you want to use the watch requisite. | def run(name,
onlyif=None,
unless=None,
creates=None,
cwd=None,
root=None,
runas=None,
shell=None,
env=None,
prepend_path=None,
stateful=False,
umask=None,
output_loglevel='debug',
hide_output=False,
timeout=... |
Download a script and execute it with specified arguments. | def script(name,
source=None,
template=None,
onlyif=None,
unless=None,
creates=None,
cwd=None,
runas=None,
shell=None,
env=None,
stateful=False,
umask=None,
timeout=None,
use_vt... |
Invoke a pre - defined Python function with arguments specified in the state declaration. This function is mainly used by the: mod: salt. renderers. pydsl renderer. | def call(name,
func,
args=(),
kws=None,
onlyif=None,
unless=None,
creates=None,
output_loglevel='debug',
hide_output=False,
use_vt=False,
**kwargs):
'''
Invoke a pre-defined Python function with arguments specified in the ... |
Execute a cmd function based on a watch call | def mod_watch(name, **kwargs):
'''
Execute a cmd function based on a watch call
.. note::
This state exists to support special handling of the ``watch``
:ref:`requisite <requisites>`. It should not be called directly.
Parameters for this function should be set by the state being tr... |
Check version of novaclient | def check_nova():
'''
Check version of novaclient
'''
if HAS_NOVA:
novaclient_ver = _LooseVersion(novaclient.__version__)
min_ver = _LooseVersion(NOVACLIENT_MINVER)
if min_ver <= novaclient_ver:
return HAS_NOVA
log.debug('Newer novaclient version required. Mi... |
Exctract API version from provided URL | def _get_version_from_url(self, url):
'''
Exctract API version from provided URL
'''
regex = re.compile(r"^https?:\/\/.*\/(v[0-9])(\.[0-9])?(\/)?$")
try:
ver = regex.match(url)
if ver.group(1):
retver = ver.group(1)
if ver.g... |
Keystone API version discovery | def _discover_ks_version(self, url):
'''
Keystone API version discovery
'''
result = salt.utils.http.query(url, backend='requests', status=True, decode=True, decode_type='json')
versions = json.loads(result['body'])
try:
links = [ver['links'] for ver in versio... |
Make output look like libcloud output for consistency | def server_show_libcloud(self, uuid):
'''
Make output look like libcloud output for consistency
'''
server_info = self.server_show(uuid)
server = next(six.itervalues(server_info))
server_name = next(six.iterkeys(server_info))
if not hasattr(self, 'password'):
... |
Boot a cloud server. | def boot(self, name, flavor_id=0, image_id=0, timeout=300, **kwargs):
'''
Boot a cloud server.
'''
nt_ks = self.compute_conn
kwargs['name'] = name
kwargs['flavor'] = flavor_id
kwargs['image'] = image_id or None
ephemeral = kwargs.pop('ephemeral', [])
... |
Change server ( uuid s ) root password | def root_password(self, server_id, password):
'''
Change server(uuid's) root password
'''
nt_ks = self.compute_conn
nt_ks.servers.change_password(server_id, password) |
Find a server by its name | def server_by_name(self, name):
'''
Find a server by its name
'''
return self.server_show_libcloud(
self.server_list().get(name, {}).get('id', '')
) |
Organize information about a volume from the volume_id | def _volume_get(self, volume_id):
'''
Organize information about a volume from the volume_id
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volume = nt_ks.volumes.get(volume_id)
respo... |
List all block volumes | def volume_list(self, search_opts=None):
'''
List all block volumes
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = nt_ks.volumes.list(search_opts=search_opts)
response = {}
... |
Show one volume | def volume_show(self, name):
'''
Show one volume
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
volumes = self.volume_list(
search_opts={'display_name': name},
)
v... |
Create a block device | def volume_create(self, name, size=100, snapshot=None, voltype=None,
availability_zone=None):
'''
Create a block device
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
re... |
Delete a block device | def volume_delete(self, name):
'''
Delete a block device
'''
if self.volume_conn is None:
raise SaltCloudSystemExit('No cinder endpoint available')
nt_ks = self.volume_conn
try:
volume = self.volume_show(name)
except KeyError as exc:
... |
Detach a block device | def volume_detach(self,
name,
timeout=300):
'''
Detach a block device
'''
try:
volume = self.volume_show(name)
except KeyError as exc:
raise SaltCloudSystemExit('Unable to find {0} volume: {1}'.format(name, exc))... |
Attach a block device | def volume_attach(self,
name,
server_name,
device='/dev/xvdb',
timeout=300):
'''
Attach a block device
'''
try:
volume = self.volume_show(name)
except KeyError as exc:
... |
Suspend a server | def suspend(self, instance_id):
'''
Suspend a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.suspend(instance_id)
return True |
Resume a server | def resume(self, instance_id):
'''
Resume a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.resume(instance_id)
return True |
Lock an instance | def lock(self, instance_id):
'''
Lock an instance
'''
nt_ks = self.compute_conn
response = nt_ks.servers.lock(instance_id)
return True |
Delete a server | def delete(self, instance_id):
'''
Delete a server
'''
nt_ks = self.compute_conn
response = nt_ks.servers.delete(instance_id)
return True |
Return a list of available flavors ( nova flavor - list ) | def flavor_list(self, **kwargs):
'''
Return a list of available flavors (nova flavor-list)
'''
nt_ks = self.compute_conn
ret = {}
for flavor in nt_ks.flavors.list(**kwargs):
links = {}
for link in flavor.links:
links[link['rel']] = ... |
Create a flavor | def flavor_create(self,
name, # pylint: disable=C0103
flavor_id=0, # pylint: disable=C0103
ram=0,
disk=0,
vcpus=1,
is_public=True):
'''
Create a flavor
... |
Delete a flavor | def flavor_delete(self, flavor_id): # pylint: disable=C0103
'''
Delete a flavor
'''
nt_ks = self.compute_conn
nt_ks.flavors.delete(flavor_id)
return 'Flavor deleted: {0}'.format(flavor_id) |
Return a list of project IDs assigned to flavor ID | def flavor_access_list(self, **kwargs):
'''
Return a list of project IDs assigned to flavor ID
'''
flavor_id = kwargs.get('flavor_id')
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.list(flavor=flavor_id, **kwargs)
fo... |
Add a project to the flavor access list | def flavor_access_add(self, flavor_id, project_id):
'''
Add a project to the flavor access list
'''
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.add_tenant_access(flavor_id, project_id)
for project in flavor_accesses:
... |
Remove a project from the flavor access list | def flavor_access_remove(self, flavor_id, project_id):
'''
Remove a project from the flavor access list
'''
nt_ks = self.compute_conn
ret = {flavor_id: []}
flavor_accesses = nt_ks.flavor_access.remove_tenant_access(flavor_id, project_id)
for project in flavor_acce... |
List keypairs | def keypair_list(self):
'''
List keypairs
'''
nt_ks = self.compute_conn
ret = {}
for keypair in nt_ks.keypairs.list():
ret[keypair.name] = {
'name': keypair.name,
'fingerprint': keypair.fingerprint,
'public_key':... |
Add a keypair | def keypair_add(self, name, pubfile=None, pubkey=None):
'''
Add a keypair
'''
nt_ks = self.compute_conn
if pubfile:
with salt.utils.files.fopen(pubfile, 'r') as fp_:
pubkey = salt.utils.stringutils.to_unicode(fp_.read())
if not pubkey:
... |
Delete a keypair | def keypair_delete(self, name):
'''
Delete a keypair
'''
nt_ks = self.compute_conn
nt_ks.keypairs.delete(name)
return 'Keypair deleted: {0}'.format(name) |
Show image details and metadata | def image_show(self, image_id):
'''
Show image details and metadata
'''
nt_ks = self.compute_conn
image = nt_ks.images.get(image_id)
links = {}
for link in image.links:
links[link['rel']] = link['href']
ret = {
'name': image.name,
... |
List server images | def image_list(self, name=None):
'''
List server images
'''
nt_ks = self.compute_conn
ret = {}
for image in nt_ks.images.list():
links = {}
for link in image.links:
links[link['rel']] = link['href']
ret[image.name] = {
... |
Set image metadata | def image_meta_set(self,
image_id=None,
name=None,
**kwargs): # pylint: disable=C0103
'''
Set image metadata
'''
nt_ks = self.compute_conn
if name:
for image in nt_ks.images.list():
... |
Delete image metadata | def image_meta_delete(self,
image_id=None, # pylint: disable=C0103
name=None,
keys=None):
'''
Delete image metadata
'''
nt_ks = self.compute_conn
if name:
for image in nt_ks.images.list(... |
List servers | def server_list(self):
'''
List servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list():
try:
ret[item.name] = {
'id': item.id,
'name': item.name,
'state': item... |
List minimal information about servers | def server_list_min(self):
'''
List minimal information about servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list(detailed=False):
try:
ret[item.name] = {
'id': item.id,
'state':... |
Detailed list of servers | def server_list_detailed(self):
'''
Detailed list of servers
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.servers.list():
try:
ret[item.name] = {
'OS-EXT-SRV-ATTR': {},
'OS-EXT-STS': {},
... |
Show details of one server | def server_show(self, server_id):
'''
Show details of one server
'''
ret = {}
try:
servers = self.server_list_detailed()
except AttributeError:
raise SaltCloudSystemExit('Corrupt server in server_list_detailed. Remove corrupt servers.')
for... |
Create a security group | def secgroup_create(self, name, description):
'''
Create a security group
'''
nt_ks = self.compute_conn
nt_ks.security_groups.create(name, description)
ret = {'name': name, 'description': description}
return ret |
Delete a security group | def secgroup_delete(self, name):
'''
Delete a security group
'''
nt_ks = self.compute_conn
for item in nt_ks.security_groups.list():
if item.name == name:
nt_ks.security_groups.delete(item.id)
return {name: 'Deleted security group: {0}'... |
List security groups | def secgroup_list(self):
'''
List security groups
'''
nt_ks = self.compute_conn
ret = {}
for item in nt_ks.security_groups.list():
ret[item.name] = {
'name': item.name,
'description': item.description,
'id': item... |
List items | def _item_list(self):
'''
List items
'''
nt_ks = self.compute_conn
ret = []
for item in nt_ks.items.list():
ret.append(item.__dict__)
return ret |
Parse the returned network list | def _network_show(self, name, network_lst):
'''
Parse the returned network list
'''
for net in network_lst:
if net.label == name:
return net.__dict__
return {} |
Show network information | def network_show(self, name):
'''
Show network information
'''
nt_ks = self.compute_conn
net_list = nt_ks.networks.list()
return self._network_show(name, net_list) |
List extra private networks | def network_list(self):
'''
List extra private networks
'''
nt_ks = self.compute_conn
return [network.__dict__ for network in nt_ks.networks.list()] |
Sanatize novaclient network parameters | def _sanatize_network_params(self, kwargs):
'''
Sanatize novaclient network parameters
'''
params = [
'label', 'bridge', 'bridge_interface', 'cidr', 'cidr_v6', 'dns1',
'dns2', 'fixed_cidr', 'gateway', 'gateway_v6', 'multi_host',
'priority', 'project_id... |
Create extra private network | def network_create(self, name, **kwargs):
'''
Create extra private network
'''
nt_ks = self.compute_conn
kwargs['label'] = name
kwargs = self._sanatize_network_params(kwargs)
net = nt_ks.networks.create(**kwargs)
return net.__dict__ |
Get virtual interfaces on slice | def virtual_interface_list(self, name):
'''
Get virtual interfaces on slice
'''
nt_ks = self.compute_conn
nets = nt_ks.virtual_interfaces.list(self._server_uuid_from_name(name))
return [network.__dict__ for network in nets] |
Add an interfaces to a slice | def virtual_interface_create(self, name, net_name):
'''
Add an interfaces to a slice
'''
nt_ks = self.compute_conn
serverid = self._server_uuid_from_name(name)
networkid = self.network_show(net_name).get('id', None)
if networkid is None:
return {net_na... |
List all floating IP pools | def floating_ip_pool_list(self):
'''
List all floating IP pools
.. versionadded:: 2016.3.0
'''
nt_ks = self.compute_conn
pools = nt_ks.floating_ip_pools.list()
response = {}
for pool in pools:
response[pool.name] = {
'name': po... |
List floating IPs | def floating_ip_list(self):
'''
List floating IPs
.. versionadded:: 2016.3.0
'''
nt_ks = self.compute_conn
floating_ips = nt_ks.floating_ips.list()
response = {}
for floating_ip in floating_ips:
response[floating_ip.ip] = {
'ip... |
Allocate a floating IP | def floating_ip_create(self, pool=None):
'''
Allocate a floating IP
.. versionadded:: 2016.3.0
'''
nt_ks = self.compute_conn
floating_ip = nt_ks.floating_ips.create(pool)
response = {
'ip': floating_ip.ip,
'fixed_ip': floating_ip.fixed_ip,... |
De - allocate a floating IP | def floating_ip_delete(self, floating_ip):
'''
De-allocate a floating IP
.. versionadded:: 2016.3.0
'''
ip = self.floating_ip_show(floating_ip)
nt_ks = self.compute_conn
return nt_ks.floating_ips.delete(ip) |
Associate floating IP address to server | def floating_ip_associate(self, server_name, floating_ip):
'''
Associate floating IP address to server
.. versionadded:: 2016.3.0
'''
nt_ks = self.compute_conn
server_ = self.server_by_name(server_name)
server = nt_ks.servers.get(server_.__dict__['id'])
s... |
Disassociate a floating IP from server | def floating_ip_disassociate(self, server_name, floating_ip):
'''
Disassociate a floating IP from server
.. versionadded:: 2016.3.0
'''
nt_ks = self.compute_conn
server_ = self.server_by_name(server_name)
server = nt_ks.servers.get(server_.__dict__['id'])
... |
Report versions of library dependencies. | def dependency_information(include_salt_cloud=False):
'''
Report versions of library dependencies.
'''
libs = [
('Python', None, sys.version.rsplit('\n')[0].strip()),
('Jinja2', 'jinja2', '__version__'),
('M2Crypto', 'M2Crypto', 'version'),
('msgpack-python', 'msgpack', '... |
Report system versions. | def system_information():
'''
Report system versions.
'''
def system_version():
'''
Return host system version.
'''
lin_ver = linux_distribution()
mac_ver = platform.mac_ver()
win_ver = platform.win32_ver()
if lin_ver[0]:
return ' '.jo... |
Report the versions of dependent software. | def versions_information(include_salt_cloud=False):
'''
Report the versions of dependent software.
'''
salt_info = list(salt_information())
lib_info = list(dependency_information(include_salt_cloud))
sys_info = list(system_information())
return {'Salt Version': dict(salt_info),
... |
Yield each version properly formatted for console output. | def versions_report(include_salt_cloud=False):
'''
Yield each version properly formatted for console output.
'''
ver_info = versions_information(include_salt_cloud)
lib_pad = max(len(name) for name in ver_info['Dependency Versions'])
sys_pad = max(len(name) for name in ver_info['System Versions... |
An msi installer uninstalls/ replaces a lower internal version of itself. internal version is ivMAJOR. ivMINOR. ivBUILD with max values 255. 255. 65535. Using the build nr allows continuous integration of the installer. Display version is indipendent and free format: Year. Month. Bugfix as in Salt 2016. 11. 3. Calculat... | def msi_conformant_version():
'''
An msi installer uninstalls/replaces a lower "internal version" of itself.
"internal version" is ivMAJOR.ivMINOR.ivBUILD with max values 255.255.65535.
Using the build nr allows continuous integration of the installer.
"Display version" is indipendent and free forma... |
Refresh the winrepo. p file of the repository ( salt - run winrepo. genrepo ) | def genrepo(name, force=False, allow_empty=False):
'''
Refresh the winrepo.p file of the repository (salt-run winrepo.genrepo)
If ``force`` is ``True`` no checks will be made and the repository will be
generated if ``allow_empty`` is ``True`` then the state will not return an
error if there are 0 p... |
Process the configured beacons | def process(self, config, grains):
'''
Process the configured beacons
The config must be a list and looks like this in yaml
.. code_block:: yaml
beacons:
inotify:
- files:
- /etc/fstab: {}
- /var/cache/fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.