repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/modules/disk.py
blkid
python
def blkid(device=None, token=None): ''' Return block device attributes: UUID, LABEL, etc. This function only works on systems where blkid is available. device Device name from the system token Any valid token used for the search CLI Example: .. code-block:: bash ...
Return block device attributes: UUID, LABEL, etc. This function only works on systems where blkid is available. device Device name from the system token Any valid token used for the search CLI Example: .. code-block:: bash salt '*' disk.blkid salt '*' disk.blkid ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L271-L315
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
tune
python
def tune(device, **kwargs): ''' Set attributes for the specified device CLI Example: .. code-block:: bash salt '*' disk.tune /dev/sda1 read-ahead=1024 read-write=True Valid options are: ``read-ahead``, ``filesystem-read-ahead``, ``read-only``, ``read-write``. See the ``blockdev(...
Set attributes for the specified device CLI Example: .. code-block:: bash salt '*' disk.tune /dev/sda1 read-ahead=1024 read-write=True Valid options are: ``read-ahead``, ``filesystem-read-ahead``, ``read-only``, ``read-write``. See the ``blockdev(8)`` manpage for a more complete descrip...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L318-L354
[ "def dump(device, args=None):\n '''\n Return all contents of dumpe2fs for a specified device\n\n CLI Example:\n .. code-block:: bash\n\n salt '*' disk.dump /dev/sda1\n '''\n cmd = 'blockdev --getro --getsz --getss --getpbsz --getiomin --getioopt --getalignoff ' \\\n '--getmaxsect -...
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
wipe
python
def wipe(device): ''' Remove the filesystem information CLI Example: .. code-block:: bash salt '*' disk.wipe /dev/sda1 ''' cmd = 'wipefs -a {0}'.format(device) try: out = __salt__['cmd.run_all'](cmd, python_shell=False) except subprocess.CalledProcessError as err: ...
Remove the filesystem information CLI Example: .. code-block:: bash salt '*' disk.wipe /dev/sda1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L357-L377
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
dump
python
def dump(device, args=None): ''' Return all contents of dumpe2fs for a specified device CLI Example: .. code-block:: bash salt '*' disk.dump /dev/sda1 ''' cmd = 'blockdev --getro --getsz --getss --getpbsz --getiomin --getioopt --getalignoff ' \ '--getmaxsect --getsize --getsi...
Return all contents of dumpe2fs for a specified device CLI Example: .. code-block:: bash salt '*' disk.dump /dev/sda1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L380-L408
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
resize2fs
python
def resize2fs(device): ''' Resizes the filesystem. CLI Example: .. code-block:: bash salt '*' disk.resize2fs /dev/sda1 ''' cmd = 'resize2fs {0}'.format(device) try: out = __salt__['cmd.run_all'](cmd, python_shell=False) except subprocess.CalledProcessError as err: ...
Resizes the filesystem. CLI Example: .. code-block:: bash salt '*' disk.resize2fs /dev/sda1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L411-L426
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
format_
python
def format_(device, fs_type='ext4', inode_size=None, lazy_itable_init=None, fat=None, force=False): ''' Format a filesystem onto a device .. versionadded:: 2016.11.0 device The device in which to create the new filesystem fs_type...
Format a filesystem onto a device .. versionadded:: 2016.11.0 device The device in which to create the new filesystem fs_type The type of filesystem to create inode_size Size of the inodes This option is only enabled for ext and xfs filesystems lazy_itable_init ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L431-L502
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
fstype
python
def fstype(device): ''' Return the filesystem name of the specified device .. versionadded:: 2016.11.0 device The name of the device CLI Example: .. code-block:: bash salt '*' disk.fstype /dev/sdX1 ''' if salt.utils.path.which('lsblk'): lsblk_out = __salt__['...
Return the filesystem name of the specified device .. versionadded:: 2016.11.0 device The name of the device CLI Example: .. code-block:: bash salt '*' disk.fstype /dev/sdX1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L506-L544
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
_hdparm
python
def _hdparm(args, failhard=True): ''' Execute hdparm Fail hard when required return output when possible ''' cmd = 'hdparm {0}'.format(args) result = __salt__['cmd.run_all'](cmd) if result['retcode'] != 0: msg = '{0}: {1}'.format(cmd, result['stderr']) if failhard: ...
Execute hdparm Fail hard when required return output when possible
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L548-L563
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
hdparms
python
def hdparms(disks, args=None): ''' Retrieve all info's for all disks parse 'em into a nice dict (which, considering hdparms output, is quite a hassle) .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' disk.hdparms /dev/sda ''' all_parms = 'aAbBcCdgHiJkM...
Retrieve all info's for all disks parse 'em into a nice dict (which, considering hdparms output, is quite a hassle) .. versionadded:: 2016.3.0 CLI Example: .. code-block:: bash salt '*' disk.hdparms /dev/sda
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L567-L640
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
hpa
python
def hpa(disks, size=None): ''' Get/set Host Protected Area settings T13 INCITS 346-2001 (1367D) defines the BEER (Boot Engineering Extension Record) and PARTIES (Protected Area Run Time Interface Extension Services), allowing for a Host Protected Area on a disk. It's often used by OEMS to hide...
Get/set Host Protected Area settings T13 INCITS 346-2001 (1367D) defines the BEER (Boot Engineering Extension Record) and PARTIES (Protected Area Run Time Interface Extension Services), allowing for a Host Protected Area on a disk. It's often used by OEMS to hide parts of a disk, and for overprovision...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L644-L696
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
smart_attributes
python
def smart_attributes(dev, attributes=None, values=None): ''' Fetch SMART attributes Providing attributes will deliver only requested attributes Providing values will deliver only requested values for attributes Default is the Backblaze recommended set (https://www.backblaze.com/blog/hard-drive-...
Fetch SMART attributes Providing attributes will deliver only requested attributes Providing values will deliver only requested values for attributes Default is the Backblaze recommended set (https://www.backblaze.com/blog/hard-drive-smart-stats/): (5,187,188,197,198) .. versionadded:: 2016.3....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L699-L769
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
iostat
python
def iostat(interval=1, count=5, disks=None): ''' Gather and return (averaged) IO stats. .. versionadded:: 2016.3.0 .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' disk.iostat 1 5 disks=sda ''' if salt.utils.platform.is_l...
Gather and return (averaged) IO stats. .. versionadded:: 2016.3.0 .. versionchanged:: 2016.11.4 Added support for AIX CLI Example: .. code-block:: bash salt '*' disk.iostat 1 5 disks=sda
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L773-L793
[ "def _iostat_linux(interval, count, disks):\n if disks is None:\n iostat_cmd = 'iostat -x {0} {1} '.format(interval, count)\n elif isinstance(disks, six.string_types):\n iostat_cmd = 'iostat -xd {0} {1} {2}'.format(interval, count, disks)\n else:\n iostat_cmd = 'iostat -xd {0} {1} {2}'...
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
_iostats_dict
python
def _iostats_dict(header, stats): ''' Transpose collected data, average it, stomp it in dict using header Use Decimals so we can properly calc & round, convert to float 'caus' we can't transmit Decimals over 0mq ''' stats = [float((sum(stat) / len(stat)).quantize(decimal.Decimal('.01'))) for stat i...
Transpose collected data, average it, stomp it in dict using header Use Decimals so we can properly calc & round, convert to float 'caus' we can't transmit Decimals over 0mq
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L796-L804
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
_iostat_fbsd
python
def _iostat_fbsd(interval, count, disks): ''' Tested on FreeBSD, quite likely other BSD's only need small changes in cmd syntax ''' if disks is None: iostat_cmd = 'iostat -xC -w {0} -c {1} '.format(interval, count) elif isinstance(disks, six.string_types): iostat_cmd = 'iostat -x -w ...
Tested on FreeBSD, quite likely other BSD's only need small changes in cmd syntax
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L807-L860
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/modules/disk.py
_iostat_aix
python
def _iostat_aix(interval, count, disks): ''' AIX support to gather and return (averaged) IO stats. ''' log.debug('DGM disk iostat entry') if disks is None: iostat_cmd = 'iostat -dD {0} {1} '.format(interval, count) elif isinstance(disks, six.string_types): iostat_cmd = 'iostat -...
AIX support to gather and return (averaged) IO stats.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/disk.py#L906-L1003
null
# -*- coding: utf-8 -*- ''' Module for managing disks and blockdevices ''' from __future__ import absolute_import, print_function, unicode_literals # Import python libs import logging import os import subprocess import re import collections import decimal # Import 3rd-party libs from salt.ext import six from salt.ext...
saltstack/salt
salt/beacons/http_status.py
validate
python
def validate(config): ''' Validate the beacon configuration ''' valid = True messages = [] if not isinstance(config, list): valid = False messages.append('[-] Configuration for %s beacon must be a list', config) else: _config = {} list(map(_config.update, con...
Validate the beacon configuration
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/http_status.py#L45-L85
null
# -*- coding: utf-8 -*- ''' Beacon to manage and report the status of a server status endpoint. Fire an event when specified values don't match returned response. ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging import operator import re import requests import itertools...
saltstack/salt
salt/beacons/http_status.py
beacon
python
def beacon(config): ''' Check on different service status reported by the django-server-status library. .. code-block:: yaml beacons: http_status: - sites: example-site-1: url: "https://example.com/status" timeout: 30 ...
Check on different service status reported by the django-server-status library. .. code-block:: yaml beacons: http_status: - sites: example-site-1: url: "https://example.com/status" timeout: 30 content-type: js...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/http_status.py#L88-L158
null
# -*- coding: utf-8 -*- ''' Beacon to manage and report the status of a server status endpoint. Fire an event when specified values don't match returned response. ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging import operator import re import requests import itertools...
saltstack/salt
salt/modules/http.py
query
python
def query(url, **kwargs): ''' Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: .. autofunction:: salt.utils.http.query CLI Example: .. code-block:: bash salt '*' http.que...
Query a resource, and decode the return data Passes through all the parameters described in the :py:func:`utils.http.query function <salt.utils.http.query>`: .. autofunction:: salt.utils.http.query CLI Example: .. code-block:: bash salt '*' http.query http://somelink.com/ salt '...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/http.py#L17-L44
null
# -*- coding: utf-8 -*- ''' Module for making various web calls. Primarily designed for webhooks and the like, but also useful for basic http testing. .. versionadded:: 2015.5.0 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import time # Import Salt libs import sal...
saltstack/salt
salt/modules/http.py
wait_for_successful_query
python
def wait_for_successful_query(url, wait_for=300, **kwargs): ''' Query a resource until a successful response, and decode the return data CLI Example: .. code-block:: bash salt '*' http.wait_for_successful_query http://somelink.com/ wait_for=160 ''' starttime = time.time() while ...
Query a resource until a successful response, and decode the return data CLI Example: .. code-block:: bash salt '*' http.wait_for_successful_query http://somelink.com/ wait_for=160
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/http.py#L47-L75
[ "def query(url, **kwargs):\n '''\n Query a resource, and decode the return data\n\n Passes through all the parameters described in the\n :py:func:`utils.http.query function <salt.utils.http.query>`:\n\n .. autofunction:: salt.utils.http.query\n\n CLI Example:\n\n .. code-block:: bash\n\n ...
# -*- coding: utf-8 -*- ''' Module for making various web calls. Primarily designed for webhooks and the like, but also useful for basic http testing. .. versionadded:: 2015.5.0 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import time # Import Salt libs import sal...
saltstack/salt
salt/modules/http.py
update_ca_bundle
python
def update_ca_bundle(target=None, source=None, merge_files=None): ''' Update the local CA bundle file from a URL .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' http.update_ca_bundle salt '*' http.update_ca_bundle target=/path/to/cacerts.pem salt '*'...
Update the local CA bundle file from a URL .. versionadded:: 2015.5.0 CLI Example: .. code-block:: bash salt '*' http.update_ca_bundle salt '*' http.update_ca_bundle target=/path/to/cacerts.pem salt '*' http.update_ca_bundle source=https://example.com/cacerts.pem If the ``ta...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/http.py#L78-L119
[ "def update_ca_bundle(\n target=None,\n source=None,\n opts=None,\n merge_files=None,\n ):\n '''\n Attempt to update the CA bundle file from a URL\n\n If not specified, the local location on disk (``target``) will be\n auto-detected, if possible. If it is not found, th...
# -*- coding: utf-8 -*- ''' Module for making various web calls. Primarily designed for webhooks and the like, but also useful for basic http testing. .. versionadded:: 2015.5.0 ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import time # Import Salt libs import sal...
saltstack/salt
salt/modules/boto_secgroup.py
exists
python
def exists(name=None, region=None, key=None, keyid=None, profile=None, vpc_id=None, vpc_name=None, group_id=None): ''' Check to see if a security group exists. CLI example:: salt myminion boto_secgroup.exists mysecgroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, p...
Check to see if a security group exists. CLI example:: salt myminion boto_secgroup.exists mysecgroup
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L91-L108
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
_split_rules
python
def _split_rules(rules): ''' Split rules with combined grants into individual rules. Amazon returns a set of rules with the same protocol, from and to ports together as a single rule with a set of grants. Authorizing and revoking rules, however, is done as a split set of rules. This function splits...
Split rules with combined grants into individual rules. Amazon returns a set of rules with the same protocol, from and to ports together as a single rule with a set of grants. Authorizing and revoking rules, however, is done as a split set of rules. This function splits the rules up.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L118-L140
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
_get_group
python
def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None, region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613 ''' Get a group object given a name, name and vpc_id/vpc_name or group_id. Return a boto.ec2.securitygroup.SecurityGroup object if the gro...
Get a group object given a name, name and vpc_id/vpc_name or group_id. Return a boto.ec2.securitygroup.SecurityGroup object if the group is found, else return None.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L143-L200
[ "def _vpc_name_to_id(vpc_id=None, vpc_name=None, region=None, key=None, keyid=None,\n profile=None):\n data = __salt__['boto_vpc.get_id'](name=vpc_name, region=region,\n key=key, keyid=keyid, profile=profile)\n return data.get('id')\n" ]
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
get_all_security_groups
python
def get_all_security_groups(groupnames=None, group_ids=None, filters=None, region=None, key=None, keyid=None, profile=None): ''' Return a list of all Security Groups matching the given criteria and filters. Note that the 'groupnames' argument only functions correctly for EC2 Cla...
Return a list of all Security Groups matching the given criteria and filters. Note that the 'groupnames' argument only functions correctly for EC2 Classic and default VPC Security Groups. To find groups by name in other VPCs you'll want to use the 'group-name' filter instead. Valid keys for the filte...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L239-L298
[ "def _parse_rules(sg, rules):\n _rules = []\n for rule in rules:\n log.debug('examining rule %s for group %s', rule, sg.id)\n attrs = ['ip_protocol', 'from_port', 'to_port', 'grants']\n _rule = odict.OrderedDict()\n for attr in attrs:\n val = getattr(rule, attr)\n ...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
get_group_id
python
def get_group_id(name, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Get a Group ID given a Group Name or Group Name and VPC ID CLI example:: salt myminion boto_secgroup.get_group_id mysecgroup ''' conn = _get_conn(region=region, key=key...
Get a Group ID given a Group Name or Group Name and VPC ID CLI example:: salt myminion boto_secgroup.get_group_id mysecgroup
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L301-L316
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
convert_to_group_ids
python
def convert_to_group_ids(groups, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Given a list of security groups and a vpc_id, convert_to_group_ids will convert all list items in the given list to security group ids. CLI example:: salt...
Given a list of security groups and a vpc_id, convert_to_group_ids will convert all list items in the given list to security group ids. CLI example:: salt myminion boto_secgroup.convert_to_group_ids mysecgroup vpc-89yhh7h
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L319-L342
[ "def get_group_id(name, vpc_id=None, vpc_name=None, region=None, key=None,\n keyid=None, profile=None):\n '''\n Get a Group ID given a Group Name or Group Name and VPC ID\n\n CLI example::\n\n salt myminion boto_secgroup.get_group_id mysecgroup\n '''\n conn = _get_conn(region=r...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
get_config
python
def get_config(name=None, group_id=None, region=None, key=None, keyid=None, profile=None, vpc_id=None, vpc_name=None): ''' Get the configuration for a security group. CLI example:: salt myminion boto_secgroup.get_config mysecgroup ''' conn = _get_conn(region=region, key=key,...
Get the configuration for a security group. CLI example:: salt myminion boto_secgroup.get_config mysecgroup
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L345-L374
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
create
python
def create(name, description, vpc_id=None, vpc_name=None, region=None, key=None, keyid=None, profile=None): ''' Create a security group. CLI example:: salt myminion boto_secgroup.create mysecgroup 'My Security Group' ''' conn = _get_conn(region=region, key=key, keyid=keyid, prof...
Create a security group. CLI example:: salt myminion boto_secgroup.create mysecgroup 'My Security Group'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L377-L403
[ "def _vpc_name_to_id(vpc_id=None, vpc_name=None, region=None, key=None, keyid=None,\n profile=None):\n data = __salt__['boto_vpc.get_id'](name=vpc_name, region=region,\n key=key, keyid=keyid, profile=profile)\n return data.get('id')\n" ]
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
delete
python
def delete(name=None, group_id=None, region=None, key=None, keyid=None, profile=None, vpc_id=None, vpc_name=None): ''' Delete a security group. CLI example:: salt myminion boto_secgroup.delete mysecgroup ''' conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) ...
Delete a security group. CLI example:: salt myminion boto_secgroup.delete mysecgroup
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L406-L431
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
authorize
python
def authorize(name=None, source_group_name=None, source_group_owner_id=None, ip_protocol=None, from_port=None, to_port=None, cidr_ip=None, group_id=None, source_group_group_id=None, region=None, key=None, keyid=None, profile=None, vpc_id=None, vpc_name=None, egres...
Add a new rule to an existing security group. CLI example:: salt myminion boto_secgroup.authorize mysecgroup ip_protocol=tcp from_port=80 to_port=80 cidr_ip='['10.0.0.0/8', '192.168.0.0/24']'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L434-L486
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
_find_vpcs
python
def _find_vpcs(vpc_id=None, vpc_name=None, cidr=None, tags=None, region=None, key=None, keyid=None, profile=None): ''' Given VPC properties, find and return matching VPC ids. Borrowed from boto_vpc; these could be refactored into a common library ''' if all((vpc_id, vpc_name)): ...
Given VPC properties, find and return matching VPC ids. Borrowed from boto_vpc; these could be refactored into a common library
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L542-L580
null
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
set_tags
python
def set_tags(tags, name=None, group_id=None, vpc_name=None, vpc_id=None, region=None, key=None, keyid=None, profile=None): ''' sets tags on a security group .. versionadded:: 2016.3.0 tags a...
sets tags on a security group .. versionadded:: 2016.3.0 tags a dict of key:value pair of tags to set on the security group name the name of the security group group_id the group id of the security group (in lie of a name/vpc combo) vpc_name the name of the vpc t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L583-L644
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/boto_secgroup.py
delete_tags
python
def delete_tags(tags, name=None, group_id=None, vpc_name=None, vpc_id=None, region=None, key=None, keyid=None, profile=None): ''' deletes tags from a security group .. versionadde...
deletes tags from a security group .. versionadded:: 2016.3.0 tags a list of tags to remove name the name of the security group group_id the group id of the security group (in lie of a name/vpc combo) vpc_name the name of the vpc to search the named group for ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_secgroup.py#L647-L710
[ "def _get_group(conn=None, name=None, vpc_id=None, vpc_name=None, group_id=None,\n region=None, key=None, keyid=None, profile=None): # pylint: disable=W0613\n '''\n Get a group object given a name, name and vpc_id/vpc_name or group_id. Return\n a boto.ec2.securitygroup.SecurityGroup object i...
# -*- coding: utf-8 -*- ''' Connection module for Amazon Security Groups .. versionadded:: 2014.7.0 :configuration: This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API a...
saltstack/salt
salt/modules/zypperpkg.py
list_upgrades
python
def list_upgrades(refresh=True, root=None, **kwargs): ''' List all available package upgrades on this system refresh force a refresh if set to True (default). If set to False it depends on zypper if a refresh is executed. root operate on a different root directory. ...
List all available package upgrades on this system refresh force a refresh if set to True (default). If set to False it depends on zypper if a refresh is executed. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.list...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L455-L487
[ "def refresh_db(root=None):\n '''\n Force a repository refresh by calling ``zypper refresh --force``, return a dict::\n\n {'<database name>': Bool}\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.refresh_db\n '''\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
info_available
python
def info_available(*names, **kwargs): ''' Return the information of the named package available for the system. refresh force a refresh if set to True (default). If set to False it depends on zypper if a refresh is executed or not. root operate on a different root direc...
Return the information of the named package available for the system. refresh force a refresh if set to True (default). If set to False it depends on zypper if a refresh is executed or not. root operate on a different root directory. CLI example: .. code-block:: bash ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L554-L613
[ "def refresh_db(root=None):\n '''\n Force a repository refresh by calling ``zypper refresh --force``, return a dict::\n\n {'<database name>': Bool}\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.refresh_db\n '''\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
version_cmp
python
def version_cmp(ver1, ver2, ignore_epoch=False, **kwargs): ''' .. versionadded:: 2015.5.4 Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ...
.. versionadded:: 2015.5.4 Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if ver1 == ver2, and 1 if ver1 > ver2. Return None if there was a problem making the comparison. ignore_epoch : False Set to ``True`` to ignore the epoch when comparing versions .. versio...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L707-L726
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_pkgs
python
def list_pkgs(versions_as_list=False, root=None, includes=None, **kwargs): ''' List the packages currently installed as a dict. By default, the dict contains versions as a comma separated string:: {'<package_name>': '<version>[,<version>...]'} versions_as_list: If set to true, the vers...
List the packages currently installed as a dict. By default, the dict contains versions as a comma separated string:: {'<package_name>': '<version>[,<version>...]'} versions_as_list: If set to true, the versions are provided as a list {'<package_name>': ['<version>', '<version>']} ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L729-L858
[ "def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_repo_pkgs
python
def list_repo_pkgs(*args, **kwargs): ''' .. versionadded:: 2017.7.5,2018.3.1 Returns all available packages. Optionally, package names (and name globs) can be passed and the results will be filtered to packages matching those names. This is recommended as it speeds up the function considerably. ...
.. versionadded:: 2017.7.5,2018.3.1 Returns all available packages. Optionally, package names (and name globs) can be passed and the results will be filtered to packages matching those names. This is recommended as it speeds up the function considerably. This function can be helpful in discovering the...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L861-L979
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_get_configured_repos
python
def _get_configured_repos(root=None): ''' Get all the info about repositories from the configurations. ''' repos = os.path.join(root, os.path.relpath(REPOS, os.path.sep)) if root else REPOS repos_cfg = configparser.ConfigParser() if os.path.exists(repos): repos_cfg.read([repos + '/' + f...
Get all the info about repositories from the configurations.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L982-L994
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_get_repo_info
python
def _get_repo_info(alias, repos_cfg=None, root=None): ''' Get one repo meta-data. ''' try: meta = dict((repos_cfg or _get_configured_repos(root=root)).items(alias)) meta['alias'] = alias for key, val in six.iteritems(meta): if val in ['0', '1']: meta[k...
Get one repo meta-data.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L997-L1011
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _get_configured_repos(root=None):\n '''\n Get all the info about repositories from the configurations.\n '''\n\n repos = os.path.join(root, os.path.relpath(REPOS, os.path.sep)) if root else REPOS\n repos_cfg = configparser.ConfigParser...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_repos
python
def list_repos(root=None, **kwargs): ''' Lists all repos. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.list_repos ''' repos_cfg = _get_configured_repos(root=root) all_repos = {} for alias in repos_cfg.sections(): ...
Lists all repos. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.list_repos
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1030-L1048
[ "def _get_configured_repos(root=None):\n '''\n Get all the info about repositories from the configurations.\n '''\n\n repos = os.path.join(root, os.path.relpath(REPOS, os.path.sep)) if root else REPOS\n repos_cfg = configparser.ConfigParser()\n if os.path.exists(repos):\n repos_cfg.read([re...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
del_repo
python
def del_repo(repo, root=None): ''' Delete a repo. root operate on a different root directory. CLI Examples: .. code-block:: bash salt '*' pkg.del_repo alias ''' repos_cfg = _get_configured_repos(root=root) for alias in repos_cfg.sections(): if alias == repo: ...
Delete a repo. root operate on a different root directory. CLI Examples: .. code-block:: bash salt '*' pkg.del_repo alias
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1051-L1075
[ "def _get_configured_repos(root=None):\n '''\n Get all the info about repositories from the configurations.\n '''\n\n repos = os.path.join(root, os.path.relpath(REPOS, os.path.sep)) if root else REPOS\n repos_cfg = configparser.ConfigParser()\n if os.path.exists(repos):\n repos_cfg.read([re...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
mod_repo
python
def mod_repo(repo, **kwargs): ''' Modify one or more values for a repo. If the repo does not exist, it will be created, so long as the following values are specified: repo or alias alias by which Zypper refers to the repo url, mirrorlist or baseurl the URL for Zypper to reference ...
Modify one or more values for a repo. If the repo does not exist, it will be created, so long as the following values are specified: repo or alias alias by which Zypper refers to the repo url, mirrorlist or baseurl the URL for Zypper to reference enabled Enable or disable (Tru...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1078-L1233
[ "def get_repo(repo, root=None, **kwargs): # pylint: disable=unused-argument\n '''\n Display a repo.\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.get_repo alias\n '''\n return _get_repo_info(repo, root=root)\n", "de...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
refresh_db
python
def refresh_db(root=None): ''' Force a repository refresh by calling ``zypper refresh --force``, return a dict:: {'<database name>': Bool} root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.refresh_db ''' # Remove rtag file...
Force a repository refresh by calling ``zypper refresh --force``, return a dict:: {'<database name>': Bool} root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.refresh_db
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1236-L1270
[ "def clear_rtag(opts):\n '''\n Remove the rtag file\n '''\n try:\n os.remove(rtag(opts))\n except OSError as exc:\n if exc.errno != errno.ENOENT:\n # Using __str__() here to get the fully-formatted error message\n # (error number, error message, path)\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_find_types
python
def _find_types(pkgs): '''Form a package names list, find prefixes of packages types.''' return sorted({pkg.split(':', 1)[0] for pkg in pkgs if len(pkg.split(':', 1)) == 2})
Form a package names list, find prefixes of packages types.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1273-L1276
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
install
python
def install(name=None, refresh=False, fromrepo=None, pkgs=None, sources=None, downloadonly=None, skip_verify=False, version=None, ignore_repo_failure=False, no_recommends=False, root=None, ...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any zypper commands spawned by Sa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1279-L1528
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def split_comparison(version):\n match = re.match(r'^(<=>|!=|>=|<=|>>|<<|<>|>|<|=)?\\s?([^<>=]+)$', version)\n if match:\n comparison = match.group(1) or ''\n version = match.group(2)\n else:\n comparison = ''\n return co...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
upgrade
python
def upgrade(refresh=True, dryrun=False, dist_upgrade=False, fromrepo=None, novendorchange=False, skip_verify=False, no_recommends=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any zypper commands spawned by Sa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1531-L1656
[ "def list_pkgs(versions_as_list=False, root=None, includes=None, **kwargs):\n '''\n List the packages currently installed as a dict. By default, the dict\n contains versions as a comma separated string::\n\n {'<package_name>': '<version>[,<version>...]'}\n\n versions_as_list:\n If set to t...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_uninstall
python
def _uninstall(name=None, pkgs=None, root=None): ''' Remove and purge do identical things but with different Zypper commands, this function performs the common logic. ''' try: pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0] except MinionError as exc: raise Comm...
Remove and purge do identical things but with different Zypper commands, this function performs the common logic.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1659-L1699
[ "def list_pkgs(versions_as_list=False, root=None, includes=None, **kwargs):\n '''\n List the packages currently installed as a dict. By default, the dict\n contains versions as a comma separated string::\n\n {'<package_name>': '<version>[,<version>...]'}\n\n versions_as_list:\n If set to t...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
remove
python
def remove(name=None, pkgs=None, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemo...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any zypper commands spawned by Sa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1728-L1772
[ "def _uninstall(name=None, pkgs=None, root=None):\n '''\n Remove and purge do identical things but with different Zypper commands,\n this function performs the common logic.\n '''\n try:\n pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]\n except MinionError as exc:\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
purge
python
def purge(name=None, pkgs=None, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon...
.. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing any zypper commands spawned by Sa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1775-L1820
[ "def _uninstall(name=None, pkgs=None, root=None):\n '''\n Remove and purge do identical things but with different Zypper commands,\n this function performs the common logic.\n '''\n try:\n pkg_params = __salt__['pkg_resource.parse_targets'](name, pkgs)[0]\n except MinionError as exc:\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_locks
python
def list_locks(root=None): ''' List current package locks. root operate on a different root directory. Return a dict containing the locked package with attributes:: {'<package>': {'case_sensitive': '<case_sensitive>', 'match_type': '<match_type>' ...
List current package locks. root operate on a different root directory. Return a dict containing the locked package with attributes:: {'<package>': {'case_sensitive': '<case_sensitive>', 'match_type': '<match_type>' 'type': '<type>'}} CLI Exa...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1823-L1859
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
clean_locks
python
def clean_locks(root=None): ''' Remove unused locks that do not currently (with regard to repositories used) lock any package. root Operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.clean_locks ''' LCK = "removed" out = {LCK: 0}...
Remove unused locks that do not currently (with regard to repositories used) lock any package. root Operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.clean_locks
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1862-L1888
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
unhold
python
def unhold(name=None, pkgs=None, **kwargs): ''' Remove specified package lock. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.remove_lock <package name> salt '*' pkg.remove_lock <package1>,<package2>,<package3> salt '*' ...
Remove specified package lock. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.remove_lock <package name> salt '*' pkg.remove_lock <package1>,<package2>,<package3> salt '*' pkg.remove_lock pkgs='["foo", "bar"]'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1891-L1932
[ "def list_locks(root=None):\n '''\n List current package locks.\n\n root\n operate on a different root directory.\n\n Return a dict containing the locked package with attributes::\n\n {'<package>': {'case_sensitive': '<case_sensitive>',\n 'match_type': '<match_type>'\...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
remove_lock
python
def remove_lock(packages, root=None, **kwargs): # pylint: disable=unused-argument ''' Remove specified package lock. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.remove_lock <package name> salt '*' pkg.remove_lock <package1>,...
Remove specified package lock. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.remove_lock <package name> salt '*' pkg.remove_lock <package1>,<package2>,<package3> salt '*' pkg.remove_lock pkgs='["foo", "bar"]'
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1935-L1968
[ "def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
hold
python
def hold(name=None, pkgs=None, **kwargs): ''' Add a package lock. Specify packages to lock by exact name. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.add_lock <package name> salt '*' pkg.add_lock <package1>,<package2>,<packag...
Add a package lock. Specify packages to lock by exact name. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.add_lock <package name> salt '*' pkg.add_lock <package1>,<package2>,<package3> salt '*' pkg.add_lock pkgs='["foo", "bar"]...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L1971-L2016
[ "def list_locks(root=None):\n '''\n List current package locks.\n\n root\n operate on a different root directory.\n\n Return a dict containing the locked package with attributes::\n\n {'<package>': {'case_sensitive': '<case_sensitive>',\n 'match_type': '<match_type>'\...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
add_lock
python
def add_lock(packages, root=None, **kwargs): # pylint: disable=unused-argument ''' Add a package lock. Specify packages to lock by exact name. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.add_lock <package name> salt '*' pkg....
Add a package lock. Specify packages to lock by exact name. root operate on a different root directory. CLI Example: .. code-block:: bash salt '*' pkg.add_lock <package name> salt '*' pkg.add_lock <package1>,<package2>,<package3> salt '*' pkg.add_lock pkgs='["foo", "bar"]...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2019-L2049
[ "def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_get_patterns
python
def _get_patterns(installed_only=None, root=None): ''' List all known patterns in repos. ''' patterns = {} for element in __zypper__(root=root).nolock.xml.call('se', '-t', 'pattern').getElementsByTagName('solvable'): installed = element.getAttribute('status') == 'installed' if (insta...
List all known patterns in repos.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2185-L2198
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_patterns
python
def list_patterns(refresh=False, root=None): ''' List all known patterns from available repos. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate on a different root directory. CLI Examples:...
List all known patterns from available repos. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate on a different root directory. CLI Examples: .. code-block:: bash salt '*' pkg.list_pat...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2201-L2222
[ "def refresh_db(root=None):\n '''\n Force a repository refresh by calling ``zypper refresh --force``, return a dict::\n\n {'<database name>': Bool}\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.refresh_db\n '''\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
search
python
def search(criteria, refresh=False, **kwargs): ''' List known packages, available to the system. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. match (str) One of `exact`, `words`, `substrings`. Search fo...
List known packages, available to the system. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. match (str) One of `exact`, `words`, `substrings`. Search for an `exact` match or for the whole `words` only. D...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2241-L2345
[ "def refresh_db(root=None):\n '''\n Force a repository refresh by calling ``zypper refresh --force``, return a dict::\n\n {'<database name>': Bool}\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.refresh_db\n '''\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_get_first_aggregate_text
python
def _get_first_aggregate_text(node_list): ''' Extract text from the first occurred DOM aggregate. ''' if not node_list: return '' out = [] for node in node_list[0].childNodes: if node.nodeType == dom.Document.TEXT_NODE: out.append(node.nodeValue) return '\n'.join...
Extract text from the first occurred DOM aggregate.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2348-L2359
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_products
python
def list_products(all=False, refresh=False, root=None): ''' List all available or installed SUSE products. all List all products available or only installed. Default is False. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is...
List all available or installed SUSE products. all List all products available or only installed. Default is False. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate on a different root dir...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2362-L2431
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
download
python
def download(*packages, **kwargs): ''' Download packages to the local disk. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate on a different root directory. CLI example: .. code-block:...
Download packages to the local disk. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate on a different root directory. CLI example: .. code-block:: bash salt '*' pkg.download httpd ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2434-L2485
[ "def refresh_db(root=None):\n '''\n Force a repository refresh by calling ``zypper refresh --force``, return a dict::\n\n {'<database name>': Bool}\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.refresh_db\n '''\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_get_patches
python
def _get_patches(installed_only=False, root=None): ''' List all known patches in repos. ''' patches = {} for element in __zypper__(root=root).nolock.xml.call('se', '-t', 'patch').getElementsByTagName('solvable'): installed = element.getAttribute('status') == 'installed' if (installed...
List all known patches in repos.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2563-L2576
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_patches
python
def list_patches(refresh=False, root=None, **kwargs): ''' .. versionadded:: 2017.7.0 List all known advisory patches from available repos. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate ...
.. versionadded:: 2017.7.0 List all known advisory patches from available repos. refresh force a refresh if set to True. If set to False (default) it depends on zypper if a refresh is executed. root operate on a different root directory. CLI Examples: .. code-blo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2579-L2602
[ "def refresh_db(root=None):\n '''\n Force a repository refresh by calling ``zypper refresh --force``, return a dict::\n\n {'<database name>': Bool}\n\n root\n operate on a different root directory.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' pkg.refresh_db\n '''\n ...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
list_provides
python
def list_provides(root=None, **kwargs): ''' .. versionadded:: 2018.3.0 List package provides of installed packages as a dict. {'<provided_name>': ['<package_name>', '<package_name>', ...]} root operate on a different root directory. CLI Examples: .. code-block:: bash sal...
.. versionadded:: 2018.3.0 List package provides of installed packages as a dict. {'<provided_name>': ['<package_name>', '<package_name>', ...]} root operate on a different root directory. CLI Examples: .. code-block:: bash salt '*' pkg.list_provides
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2623-L2657
null
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
resolve_capabilities
python
def resolve_capabilities(pkgs, refresh=False, root=None, **kwargs): ''' .. versionadded:: 2018.3.0 Convert name provides in ``pkgs`` into real package names if ``resolve_capabilities`` parameter is set to True. In case of ``resolve_capabilities`` is set to False the package list is returned unc...
.. versionadded:: 2018.3.0 Convert name provides in ``pkgs`` into real package names if ``resolve_capabilities`` parameter is set to True. In case of ``resolve_capabilities`` is set to False the package list is returned unchanged. refresh force a refresh if set to True. If set to F...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L2660-L2723
[ "def search(criteria, refresh=False, **kwargs):\n '''\n List known packages, available to the system.\n\n refresh\n force a refresh if set to True.\n If set to False (default) it depends on zypper if a refresh is\n executed.\n\n match (str)\n One of `exact`, `words`, `substri...
# -*- coding: utf-8 -*- ''' Package support for openSUSE via the zypper package manager :depends: - ``rpm`` Python module. Install with ``zypper install rpm-python`` .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives a...
saltstack/salt
salt/modules/zypperpkg.py
_Zypper._reset
python
def _reset(self): ''' Resets values of the call setup. :return: ''' self.__cmd = ['zypper', '--non-interactive'] self.__exit_code = 0 self.__call_result = dict() self.__error_msg = '' self.__env = salt.utils.environment.get_module_environment(glob...
Resets values of the call setup. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L112-L134
[ "def get_module_environment(env=None, function=None):\n '''\n Get module optional environment.\n\n To setup an environment option for a particular module,\n add either pillar or config at the minion as follows:\n\n system-environment:\n modules:\n pkg:\n _:\n LC_ALL: e...
class _Zypper(object): ''' Zypper parallel caller. Validates the result and either raises an exception or reports an error. Allows serial zypper calls (first came, first won). ''' SUCCESS_EXIT_CODES = { 0: 'Successful run of zypper with no special info.', 100: 'Patches are avail...
saltstack/salt
salt/modules/zypperpkg.py
_Zypper._is_error
python
def _is_error(self): ''' Is this is an error code? :return: ''' if self.exit_code: msg = self.SUCCESS_EXIT_CODES.get(self.exit_code) if msg: log.info(msg) msg = self.WARNING_EXIT_CODES.get(self.exit_code) if msg: ...
Is this is an error code? :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L214-L228
null
class _Zypper(object): ''' Zypper parallel caller. Validates the result and either raises an exception or reports an error. Allows serial zypper calls (first came, first won). ''' SUCCESS_EXIT_CODES = { 0: 'Successful run of zypper with no special info.', 100: 'Patches are avail...
saltstack/salt
salt/modules/zypperpkg.py
_Zypper._is_xml_mode
python
def _is_xml_mode(self): ''' Is Zypper's output is in XML format? :return: ''' return [itm for itm in self.XML_DIRECTIVES if itm in self.__cmd] and True or False
Is Zypper's output is in XML format? :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L238-L244
null
class _Zypper(object): ''' Zypper parallel caller. Validates the result and either raises an exception or reports an error. Allows serial zypper calls (first came, first won). ''' SUCCESS_EXIT_CODES = { 0: 'Successful run of zypper with no special info.', 100: 'Patches are avail...
saltstack/salt
salt/modules/zypperpkg.py
_Zypper._check_result
python
def _check_result(self): ''' Check and set the result of a zypper command. In case of an error, either raise a CommandExecutionError or extract the error. result The result of a zypper command called with cmd.run_all ''' if not self.__call_result: ...
Check and set the result of a zypper command. In case of an error, either raise a CommandExecutionError or extract the error. result The result of a zypper command called with cmd.run_all
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L246-L281
null
class _Zypper(object): ''' Zypper parallel caller. Validates the result and either raises an exception or reports an error. Allows serial zypper calls (first came, first won). ''' SUCCESS_EXIT_CODES = { 0: 'Successful run of zypper with no special info.', 100: 'Patches are avail...
saltstack/salt
salt/modules/zypperpkg.py
_Zypper.__call
python
def __call(self, *args, **kwargs): ''' Call Zypper. :param state: :return: ''' self.__called = True if self.__xml: self.__cmd.append('--xmlout') if not self.__refresh and '--no-refresh' not in args: self.__cmd.append('--no-refresh'...
Call Zypper. :param state: :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L283-L356
null
class _Zypper(object): ''' Zypper parallel caller. Validates the result and either raises an exception or reports an error. Allows serial zypper calls (first came, first won). ''' SUCCESS_EXIT_CODES = { 0: 'Successful run of zypper with no special info.', 100: 'Patches are avail...
saltstack/salt
salt/modules/zypperpkg.py
Wildcard._get_available_versions
python
def _get_available_versions(self): ''' Get available versions of the package. :return: ''' solvables = self.zypper.nolock.xml.call('se', '-xv', self.name).getElementsByTagName('solvable') if not solvables: raise CommandExecutionError('No packages found matchin...
Get available versions of the package. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L402-L412
null
class Wildcard(object): ''' .. versionadded:: 2017.7.0 Converts string wildcard to a zypper query. Example: '1.2.3.4*' is '1.2.3.4.whatever.is.here' and is equal to: '1.2.3.4 >= and < 1.2.3.5' :param ptn: Pattern :return: Query range ''' Z_OP = ['<', '<=', '=', '>=', '>'...
saltstack/salt
salt/modules/zypperpkg.py
Wildcard._get_scope_versions
python
def _get_scope_versions(self, pkg_versions): ''' Get available difference between next possible matches. :return: ''' get_in_versions = [] for p_version in pkg_versions: if fnmatch.fnmatch(p_version, self.version): get_in_versions.append(p_ver...
Get available difference between next possible matches. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L414-L424
null
class Wildcard(object): ''' .. versionadded:: 2017.7.0 Converts string wildcard to a zypper query. Example: '1.2.3.4*' is '1.2.3.4.whatever.is.here' and is equal to: '1.2.3.4 >= and < 1.2.3.5' :param ptn: Pattern :return: Query range ''' Z_OP = ['<', '<=', '=', '>=', '>'...
saltstack/salt
salt/modules/zypperpkg.py
Wildcard._set_version
python
def _set_version(self, version): ''' Stash operator from the version, if any. :return: ''' if not version: return exact_version = re.sub(r'[<>=+]*', '', version) self._op = version.replace(exact_version, '') or None if self._op and self._op n...
Stash operator from the version, if any. :return:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zypperpkg.py#L426-L439
null
class Wildcard(object): ''' .. versionadded:: 2017.7.0 Converts string wildcard to a zypper query. Example: '1.2.3.4*' is '1.2.3.4.whatever.is.here' and is equal to: '1.2.3.4 >= and < 1.2.3.5' :param ptn: Pattern :return: Query range ''' Z_OP = ['<', '<=', '=', '>=', '>'...
saltstack/salt
salt/utils/vt.py
_cleanup
python
def _cleanup(): ''' Make sure that any terminal processes still running when __del__ was called to the waited and cleaned up. ''' for inst in _ACTIVE[:]: res = inst.isalive() if res is not True: try: _ACTIVE.remove(inst) except ValueError: ...
Make sure that any terminal processes still running when __del__ was called to the waited and cleaned up.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vt.py#L78-L91
null
# -*- coding: utf-8 -*- ''' :codeauthor: Pedro Algarvio (pedro@algarvio.me) salt.utils.vt ~~~~~~~~~~~~~ Virtual Terminal This code has been heavily inspired by Python's subprocess code, the `non blocking version of it`__, some minor online snippets about TTY handling with python includin...
saltstack/salt
salt/utils/vt.py
Terminal.sendline
python
def sendline(self, data, linesep=os.linesep): ''' Send the provided data to the terminal appending a line feed. ''' return self.send('{0}{1}'.format(data, linesep))
Send the provided data to the terminal appending a line feed.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vt.py#L295-L299
[ "def send(self, data):\n '''\n Send data to the terminal. You are responsible to send any required\n line feeds.\n '''\n return self._send(data)\n" ]
class Terminal(object): ''' I'm a virtual terminal ''' def __init__(self, args=None, executable=None, shell=False, cwd=None, env=None, preexec_fn=None, # Terminal Size ...
saltstack/salt
salt/utils/vt.py
Terminal.recv
python
def recv(self, maxsize=None): ''' Receive data from the terminal as a (``stdout``, ``stderr``) tuple. If any of those is ``None`` we can no longer communicate with the terminal's child process. ''' if maxsize is None: maxsize = 1024 elif maxsize < 1: ...
Receive data from the terminal as a (``stdout``, ``stderr``) tuple. If any of those is ``None`` we can no longer communicate with the terminal's child process.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vt.py#L301-L311
[ "def _recv(self, maxsize):\n rfds = []\n if self.child_fd:\n rfds.append(self.child_fd)\n if self.child_fde:\n rfds.append(self.child_fde)\n\n if not self.isalive():\n if not rfds:\n return None, None\n rlist, _, _ = select.select(rfds, [], [], 0)\n if not r...
class Terminal(object): ''' I'm a virtual terminal ''' def __init__(self, args=None, executable=None, shell=False, cwd=None, env=None, preexec_fn=None, # Terminal Size ...
saltstack/salt
salt/utils/vt.py
Terminal.close
python
def close(self, terminate=True, kill=False): ''' Close the communication with the terminal's child. If ``terminate`` is ``True`` then additionally try to terminate the terminal, and if ``kill`` is also ``True``, kill the terminal if terminating it was not enough. ''' ...
Close the communication with the terminal's child. If ``terminate`` is ``True`` then additionally try to terminate the terminal, and if ``kill`` is also ``True``, kill the terminal if terminating it was not enough.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/vt.py#L313-L331
[ "def terminate(self, force=False):\n '''\n This forces a child process to terminate. It starts nicely with\n SIGHUP and SIGINT. If \"force\" is True then moves onto SIGKILL. This\n returns True if the child was terminated. This returns False if the\n child could not be terminated.\n '''\n if no...
class Terminal(object): ''' I'm a virtual terminal ''' def __init__(self, args=None, executable=None, shell=False, cwd=None, env=None, preexec_fn=None, # Terminal Size ...
saltstack/salt
salt/states/pyrax_queues.py
present
python
def present(name, provider): ''' Ensure the RackSpace queue exists. name Name of the Rackspace queue. provider Salt Cloud Provider ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} is_present = list(__salt__['cloud.action']('queues_exists', provider=pr...
Ensure the RackSpace queue exists. name Name of the Rackspace queue. provider Salt Cloud Provider
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyrax_queues.py#L36-L68
null
# -*- coding: utf-8 -*- ''' Manage Rackspace Queues ======================= .. versionadded:: 2015.5.0 Create and destroy Rackspace queues. Be aware that this interacts with Rackspace's services, and so may incur charges. This module uses ``pyrax``, which can be installed via package, or pip. This module is greatly ...
saltstack/salt
salt/states/pyrax_queues.py
absent
python
def absent(name, provider): ''' Ensure the named Rackspace queue is deleted. name Name of the Rackspace queue. provider Salt Cloud provider ''' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} is_present = list(__salt__['cloud.action']('queues_exists', pr...
Ensure the named Rackspace queue is deleted. name Name of the Rackspace queue. provider Salt Cloud provider
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pyrax_queues.py#L71-L102
null
# -*- coding: utf-8 -*- ''' Manage Rackspace Queues ======================= .. versionadded:: 2015.5.0 Create and destroy Rackspace queues. Be aware that this interacts with Rackspace's services, and so may incur charges. This module uses ``pyrax``, which can be installed via package, or pip. This module is greatly ...
saltstack/salt
salt/runners/drac.py
__connect
python
def __connect(hostname, timeout=20, username=None, password=None): ''' Connect to the DRAC ''' drac_cred = __opts__.get('drac') err_msg = 'No drac login credentials found. Please add the \'username\' and \'password\' ' \ 'fields beneath a \'drac\' key in the master configuration file. ...
Connect to the DRAC
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/drac.py#L37-L66
null
# -*- coding: utf-8 -*- ''' Manage Dell DRAC from the Master The login credentials need to be configured in the Salt master configuration file. .. code-block: yaml drac: username: admin password: secret ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/runners/drac.py
__version
python
def __version(client): ''' Grab DRAC version ''' versions = {9: 'CMC', 8: 'iDRAC6', 10: 'iDRAC6', 11: 'iDRAC6', 16: 'iDRAC7', 17: 'iDRAC7'} if isinstance(client, paramiko.SSHClient): (stdin, stdout, stderr) = cl...
Grab DRAC version
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/drac.py#L69-L87
null
# -*- coding: utf-8 -*- ''' Manage Dell DRAC from the Master The login credentials need to be configured in the Salt master configuration file. .. code-block: yaml drac: username: admin password: secret ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/runners/drac.py
pxe
python
def pxe(hostname, timeout=20, username=None, password=None): ''' Connect to the Dell DRAC and have the boot order set to PXE and power cycle the system to PXE boot CLI Example: .. code-block:: bash salt-run drac.pxe example.com ''' _cmds = [ 'racadm config -g cfgServerInfo...
Connect to the Dell DRAC and have the boot order set to PXE and power cycle the system to PXE boot CLI Example: .. code-block:: bash salt-run drac.pxe example.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/drac.py#L90-L121
[ "def __connect(hostname, timeout=20, username=None, password=None):\n '''\n Connect to the DRAC\n '''\n drac_cred = __opts__.get('drac')\n err_msg = 'No drac login credentials found. Please add the \\'username\\' and \\'password\\' ' \\\n 'fields beneath a \\'drac\\' key in the master co...
# -*- coding: utf-8 -*- ''' Manage Dell DRAC from the Master The login credentials need to be configured in the Salt master configuration file. .. code-block: yaml drac: username: admin password: secret ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/runners/drac.py
reboot
python
def reboot(hostname, timeout=20, username=None, password=None): ''' Reboot a server using the Dell DRAC CLI Example: .. code-block:: bash salt-run drac.reboot example.com ''' client = __connect(hostname, timeout, username, password) if isinstance(client, paramiko.SSHClient): ...
Reboot a server using the Dell DRAC CLI Example: .. code-block:: bash salt-run drac.reboot example.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/drac.py#L124-L148
[ "def __connect(hostname, timeout=20, username=None, password=None):\n '''\n Connect to the DRAC\n '''\n drac_cred = __opts__.get('drac')\n err_msg = 'No drac login credentials found. Please add the \\'username\\' and \\'password\\' ' \\\n 'fields beneath a \\'drac\\' key in the master co...
# -*- coding: utf-8 -*- ''' Manage Dell DRAC from the Master The login credentials need to be configured in the Salt master configuration file. .. code-block: yaml drac: username: admin password: secret ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/runners/drac.py
version
python
def version(hostname, timeout=20, username=None, password=None): ''' Display the version of DRAC CLI Example: .. code-block:: bash salt-run drac.version example.com ''' return __version(__connect(hostname, timeout, username, password))
Display the version of DRAC CLI Example: .. code-block:: bash salt-run drac.version example.com
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/drac.py#L205-L215
[ "def __connect(hostname, timeout=20, username=None, password=None):\n '''\n Connect to the DRAC\n '''\n drac_cred = __opts__.get('drac')\n err_msg = 'No drac login credentials found. Please add the \\'username\\' and \\'password\\' ' \\\n 'fields beneath a \\'drac\\' key in the master co...
# -*- coding: utf-8 -*- ''' Manage Dell DRAC from the Master The login credentials need to be configured in the Salt master configuration file. .. code-block: yaml drac: username: admin password: secret ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literal...
saltstack/salt
salt/beacons/glxinfo.py
beacon
python
def beacon(config): ''' Emit the status of a connected display to the minion Mainly this is used to detect when the display fails to connect for whatever reason. .. code-block:: yaml beacons: glxinfo: - user: frank - screen_event: True ''' log.t...
Emit the status of a connected display to the minion Mainly this is used to detect when the display fails to connect for whatever reason. .. code-block:: yaml beacons: glxinfo: - user: frank - screen_event: True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/glxinfo.py#L49-L82
null
# -*- coding: utf-8 -*- ''' Beacon to emit when a display is available to a linux machine .. versionadded:: 2016.3.0 ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Salt libs import salt.utils.path from salt.ext.six.moves import map log = logging.getLogger(__name__...
saltstack/salt
salt/runners/config.py
get
python
def get(key, default='', delimiter=':'): ''' Retrieve master config options, with optional nesting via the delimiter argument. **Arguments** default If the key is not found, the default will be returned instead delimiter Override the delimiter used to separate nested levels ...
Retrieve master config options, with optional nesting via the delimiter argument. **Arguments** default If the key is not found, the default will be returned instead delimiter Override the delimiter used to separate nested levels of a data structure. CLI Example: ....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/config.py#L12-L40
[ "def sdb_get(uri, opts, utils=None):\n '''\n Get a value from a db, using a uri in the form of ``sdb://<profile>/<key>``. If\n the uri provided does not start with ``sdb://``, then it will be returned as-is.\n '''\n if not isinstance(uri, string_types) or not uri.startswith('sdb://'):\n return...
# -*- coding: utf-8 -*- ''' This runner is designed to mirror the execution module config.py, but for master settings ''' from __future__ import absolute_import, print_function, unicode_literals import salt.utils.data import salt.utils.sdb
saltstack/salt
salt/modules/namecheap_ssl.py
reissue
python
def reissue(csr_file, certificate_id, web_server_type, approver_email=None, http_dc_validation=False, **kwargs): ''' Reissues a purchased SSL certificate. Returns a dictionary of result values. csr_file Path to Certificate Signing Requ...
Reissues a purchased SSL certificate. Returns a dictionary of result values. csr_file Path to Certificate Signing Request file certificate_id Unique ID of the SSL certificate you wish to activate web_server_type The type of certificate format to return. Possible values include...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_ssl.py#L58-L128
[ "def __get_certificates(command,\n result_tag_name,\n csr_file,\n certificate_id,\n web_server_type,\n approver_email,\n http_dc_validation,\n kwargs):\n\n web...
# -*- coding: utf-8 -*- ''' Namecheap SSL Certificate Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration ...
saltstack/salt
salt/modules/namecheap_ssl.py
renew
python
def renew(years, certificate_id, certificate_type, promotion_code=None): ''' Renews an SSL certificate if it is ACTIVE and Expires <= 30 days. Returns the following information: - The certificate ID - The order ID - The transaction ID - The amount charged for the order years : 1 ...
Renews an SSL certificate if it is ACTIVE and Expires <= 30 days. Returns the following information: - The certificate ID - The order ID - The transaction ID - The amount charged for the order years : 1 Number of years to register certificate_id Unique ID of the SSL certif...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_ssl.py#L295-L407
[ "def get_opts(command):\n opts = {}\n opts['ApiUser'] = __salt__['config.option']('namecheap.name')\n opts['UserName'] = __salt__['config.option']('namecheap.user')\n opts['ApiKey'] = __salt__['config.option']('namecheap.key')\n opts['ClientIp'] = __salt__['config.option']('namecheap.client_ip')\n ...
# -*- coding: utf-8 -*- ''' Namecheap SSL Certificate Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration ...
saltstack/salt
salt/modules/namecheap_ssl.py
create
python
def create(years, certificate_type, promotion_code=None, sans_to_add=None): ''' Creates a new SSL certificate. Returns the following information: - Whether or not the SSL order was successful - The certificate ID - The order ID - The transaction ID - The amount charged for the order - T...
Creates a new SSL certificate. Returns the following information: - Whether or not the SSL order was successful - The certificate ID - The order ID - The transaction ID - The amount charged for the order - The date on which the certificate was created - The date on which the certificate wil...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_ssl.py#L410-L591
[ "def get_opts(command):\n opts = {}\n opts['ApiUser'] = __salt__['config.option']('namecheap.name')\n opts['UserName'] = __salt__['config.option']('namecheap.user')\n opts['ApiKey'] = __salt__['config.option']('namecheap.key')\n opts['ClientIp'] = __salt__['config.option']('namecheap.client_ip')\n ...
# -*- coding: utf-8 -*- ''' Namecheap SSL Certificate Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration ...
saltstack/salt
salt/modules/namecheap_ssl.py
parse_csr
python
def parse_csr(csr_file, certificate_type, http_dc_validation=False): ''' Parses the CSR. Returns a dictionary of result values. csr_file Path to Certificate Signing Request file certificate_type Type of SSL Certificate. Possible values include: - EV Multi Domain SSL - ...
Parses the CSR. Returns a dictionary of result values. csr_file Path to Certificate Signing Request file certificate_type Type of SSL Certificate. Possible values include: - EV Multi Domain SSL - EV SSL - EV SSL SGC - EssentialSSL - EssentialSSL Wildcar...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_ssl.py#L594-L696
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Namecheap SSL Certificate Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration ...
saltstack/salt
salt/modules/namecheap_ssl.py
get_list
python
def get_list(**kwargs): ''' Returns a list of SSL certificates for a particular user ListType : All Possible values: - All - Processing - EmailSent - TechnicalProblem - InProgress - Completed - Deactivated - Active - Cancelled...
Returns a list of SSL certificates for a particular user ListType : All Possible values: - All - Processing - EmailSent - TechnicalProblem - InProgress - Completed - Deactivated - Active - Cancelled - NewPurchase - New...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_ssl.py#L699-L755
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_opts(command):\n opts = {}\n opts['ApiUser'] = __salt__['config.option']('namecheap.name')\n opts['UserName'] = __salt__['config.option']('namecheap.user')\n opts['ApiKey'] = __salt__['config.option']('namecheap.key')\n opts['Clien...
# -*- coding: utf-8 -*- ''' Namecheap SSL Certificate Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration ...
saltstack/salt
salt/modules/namecheap_ssl.py
get_info
python
def get_info(certificate_id, returncertificate=False, returntype=None): ''' Retrieves information about the requested SSL certificate. Returns a dictionary of information about the SSL certificate with two keys: - **ssl** - Contains the metadata information - **certificate** - Contains the details ...
Retrieves information about the requested SSL certificate. Returns a dictionary of information about the SSL certificate with two keys: - **ssl** - Contains the metadata information - **certificate** - Contains the details for the certificate such as the CSR, Approver, and certificate data certi...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/namecheap_ssl.py#L758-L806
[ "def get_opts(command):\n opts = {}\n opts['ApiUser'] = __salt__['config.option']('namecheap.name')\n opts['UserName'] = __salt__['config.option']('namecheap.user')\n opts['ApiKey'] = __salt__['config.option']('namecheap.key')\n opts['ClientIp'] = __salt__['config.option']('namecheap.client_ip')\n ...
# -*- coding: utf-8 -*- ''' Namecheap SSL Certificate Management .. versionadded:: 2017.7.0 Prerequisites ------------- This module uses the ``requests`` Python module to communicate to the namecheap API. Configuration ------------- The Namecheap username, API key and URL should be set in the minion configuration ...
saltstack/salt
salt/states/cron.py
_check_cron
python
def _check_cron(user, cmd, minute=None, hour=None, daymonth=None, month=None, dayweek=None, comment=None, commented=None, identifier=None, special=None): ''...
Return the changes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L161-L214
[ "def _cron_matched(cron, cmd, identifier=None):\n '''Check if:\n - we find a cron with same cmd, old state behavior\n - but also be smart enough to remove states changed crons where we do\n not removed priorly by a cron.absent by matching on the provided\n identifier.\n We assure r...
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/states/cron.py
_check_cron_env
python
def _check_cron_env(user, name, value=None): ''' Return the environment changes ''' if value is None: value = "" # Matching value set in salt.modules.cron._render_tab lst = __salt__['cron.list_tab'](user) for env in lst['env']: if name == ...
Return the environment changes
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L217-L231
null
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/states/cron.py
_get_cron_info
python
def _get_cron_info(): ''' Returns the proper group owner and path to the cron directory ''' owner = 'root' if __grains__['os'] == 'FreeBSD': group = 'wheel' crontab_dir = '/var/cron/tabs' elif __grains__['os'] == 'OpenBSD': group = 'crontab' crontab_dir = '/var/cr...
Returns the proper group owner and path to the cron directory
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L234-L254
null
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/states/cron.py
present
python
def present(name, user='root', minute='*', hour='*', daymonth='*', month='*', dayweek='*', comment=None, commented=False, identifier=False, special=None): ''' Verifies that the specified cron ...
Verifies that the specified cron job is present for the specified user. It is recommended to use `identifier`. Otherwise the cron job is installed twice if you change the name. For more advanced information about what exactly can be set in the cron timing parameters, check your cron system's documentati...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L257-L383
[ "def _check_cron(user,\n cmd,\n minute=None,\n hour=None,\n daymonth=None,\n month=None,\n dayweek=None,\n comment=None,\n commented=None,\n identifier=None,\n specia...
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/states/cron.py
absent
python
def absent(name, user='root', identifier=False, special=None, **kwargs): ''' Verifies that the specified cron job is absent for the specified user; only the name is matched when removing a cron job. name The command that should be absent in the user c...
Verifies that the specified cron job is absent for the specified user; only the name is matched when removing a cron job. name The command that should be absent in the user crontab. user The name of the user whose crontab needs to be modified, defaults to the root user identif...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L386-L448
[ "def _check_cron(user,\n cmd,\n minute=None,\n hour=None,\n daymonth=None,\n month=None,\n dayweek=None,\n comment=None,\n commented=None,\n identifier=None,\n specia...
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/states/cron.py
file
python
def file(name, source_hash='', source_hash_name=None, user='root', template=None, context=None, replace=True, defaults=None, backup='', **kwargs): ''' Provides file.managed-like functionality (templating, etc.) for a pre-made c...
Provides file.managed-like functionality (templating, etc.) for a pre-made crontab file, to be assigned to a given user. name The source file to be used as the crontab. This source file can be hosted on either the salt master server, or on an HTTP or FTP server. For files hosted on the ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L451-L669
[ "def mkstemp(*args, **kwargs):\n '''\n Helper function which does exactly what ``tempfile.mkstemp()`` does but\n accepts another argument, ``close_fd``, which, by default, is true and closes\n the fd before returning the file path. Something commonly done throughout\n Salt's code.\n '''\n if 'p...
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...
saltstack/salt
salt/states/cron.py
env_present
python
def env_present(name, value=None, user='root'): ''' Verifies that the specified environment variable is present in the crontab for the specified user. name The name of the environment variable to set in the user crontab user The name of the user whos...
Verifies that the specified environment variable is present in the crontab for the specified user. name The name of the environment variable to set in the user crontab user The name of the user whose crontab needs to be modified, defaults to the root user value The val...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/cron.py#L672-L722
[ "def _check_cron_env(user,\n name,\n value=None):\n '''\n Return the environment changes\n '''\n if value is None:\n value = \"\" # Matching value set in salt.modules.cron._render_tab\n lst = __salt__['cron.list_tab'](user)\n for env in lst['env']:\n ...
# -*- coding: utf-8 -*- ''' Management of cron, the Unix command scheduler ============================================== Cron declarations require a number of parameters. The following are the parameters used by Salt to define the various timing values for a cron job: * ``minute`` * ``hour`` * ``daymonth`` * ``month...