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/returners/redis_return.py
get_jids
python
def get_jids(): ''' Return a dict mapping all job ids to job information ''' serv = _get_serv(ret=None) ret = {} for s in serv.mget(serv.keys('load:*')): if s is None: continue load = salt.utils.json.loads(s) jid = load['jid'] ret[jid] = salt.utils.jid...
Return a dict mapping all job ids to job information
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/redis_return.py#L277-L289
[ "def _get_serv(ret=None):\n '''\n Return a redis server object\n '''\n _options = _get_options(ret)\n global REDIS_POOL\n if REDIS_POOL:\n return REDIS_POOL\n elif _options.get('cluster_mode'):\n REDIS_POOL = StrictRedisCluster(startup_nodes=_options.get('startup_nodes'),\n ...
# -*- coding: utf-8 -*- ''' Return data to a redis server To enable this returner the minion will need the python client for redis installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml redis.db: '0' redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/returners/redis_return.py
clean_old_jobs
python
def clean_old_jobs(): ''' Clean out minions's return data for old jobs. Normally, hset 'ret:<jid>' are saved with a TTL, and will eventually get cleaned by redis.But for jobs with some very late minion return, the corresponding hset's TTL will be refreshed to a too late timestamp, we'll do manu...
Clean out minions's return data for old jobs. Normally, hset 'ret:<jid>' are saved with a TTL, and will eventually get cleaned by redis.But for jobs with some very late minion return, the corresponding hset's TTL will be refreshed to a too late timestamp, we'll do manually cleaning here.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/redis_return.py#L300-L319
[ "def _get_serv(ret=None):\n '''\n Return a redis server object\n '''\n _options = _get_options(ret)\n global REDIS_POOL\n if REDIS_POOL:\n return REDIS_POOL\n elif _options.get('cluster_mode'):\n REDIS_POOL = StrictRedisCluster(startup_nodes=_options.get('startup_nodes'),\n ...
# -*- coding: utf-8 -*- ''' Return data to a redis server To enable this returner the minion will need the python client for redis installed and the following values configured in the minion or master config, these are the defaults: .. code-block:: yaml redis.db: '0' redis.host: 'salt' redis.port: 6379 ...
saltstack/salt
salt/cli/api.py
SaltAPI.prepare
python
def prepare(self): ''' Run the preparation sequence required to start a salt-api daemon. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare() ''' super(SaltAPI, self).prepare() try: if self.config['verify_env']: ...
Run the preparation sequence required to start a salt-api daemon. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare()
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/api.py#L28-L56
[ "def verify_files(files, user):\n '''\n Verify that the named files exist and are owned by the named user\n '''\n if salt.utils.platform.is_windows():\n return True\n import pwd # after confirming not running Windows\n try:\n pwnam = pwd.getpwnam(user)\n uid = pwnam[2]\n e...
class SaltAPI(parsers.SaltAPIParser): ''' The cli parser object used to fire up the salt api system. ''' def start(self): ''' Start the actual master. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required c...
saltstack/salt
salt/cli/api.py
SaltAPI.start
python
def start(self): ''' Start the actual master. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required code before calling `super()`. ''' super(SaltAPI, self).start() if check_user(self.config['user']): ...
Start the actual master. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required code before calling `super()`.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/api.py#L58-L71
[ "def check_user(user):\n '''\n Check user and assign process uid/gid.\n '''\n if salt.utils.platform.is_windows():\n return True\n if user == salt.utils.user.get_user():\n return True\n import pwd # after confirming not running Windows\n try:\n pwuser = pwd.getpwnam(user)\...
class SaltAPI(parsers.SaltAPIParser): ''' The cli parser object used to fire up the salt api system. ''' def prepare(self): ''' Run the preparation sequence required to start a salt-api daemon. If sub-classed, don't **ever** forget to run: super(YourSubClass, self)...
saltstack/salt
salt/cli/api.py
SaltAPI.shutdown
python
def shutdown(self, exitcode=0, exitmsg=None): ''' If sub-classed, run any shutdown operations on this method. ''' log.info('The salt-api is shutting down..') msg = 'The salt-api is shutdown. ' if exitmsg is not None: exitmsg = msg + exitmsg else: ...
If sub-classed, run any shutdown operations on this method.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/api.py#L73-L83
null
class SaltAPI(parsers.SaltAPIParser): ''' The cli parser object used to fire up the salt api system. ''' def prepare(self): ''' Run the preparation sequence required to start a salt-api daemon. If sub-classed, don't **ever** forget to run: super(YourSubClass, self)...
saltstack/salt
salt/states/zookeeper.py
present
python
def present(name, value, acls=None, ephemeral=False, sequence=False, makepath=False, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None): ''' Make sure znode is present in the correct state with the correct acls name path to znode valu...
Make sure znode is present in the correct state with the correct acls name path to znode value value znode should be set to acls list of acl dictionaries to set on znode (make sure the ones salt is connected with are included) Default: None ephemeral Boolean t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zookeeper.py#L47-L200
[ "def _check_acls(left, right):\n first = not bool(set(left) - set(right))\n second = not bool(set(right) - set(left))\n return first and second\n" ]
# -*- coding: utf-8 -*- ''' :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. ACLS ~~~~ For more information about acls, please checkout the kazoo documentation. http://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl The following options c...
saltstack/salt
salt/states/zookeeper.py
absent
python
def absent(name, version=-1, recursive=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None): ''' Make sure znode is absent name path to znode version Specify the version which should be deleted Default: -1 (always match) ...
Make sure znode is absent name path to znode version Specify the version which should be deleted Default: -1 (always match) recursive Boolean to indicate if children should be recursively deleted Default: False profile Configured Zookeeper profile to a...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zookeeper.py#L203-L276
null
# -*- coding: utf-8 -*- ''' :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. ACLS ~~~~ For more information about acls, please checkout the kazoo documentation. http://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl The following options c...
saltstack/salt
salt/states/zookeeper.py
acls
python
def acls(name, acls, version=-1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None): ''' Update acls on a znode name path to znode acls list of acl dictionaries to set on znode version Specify the version which should be deleted...
Update acls on a znode name path to znode acls list of acl dictionaries to set on znode version Specify the version which should be deleted Default: -1 (always match) profile Configured Zookeeper profile to authenticate with (Default: None) hosts ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zookeeper.py#L279-L362
[ "def _check_acls(left, right):\n first = not bool(set(left) - set(right))\n second = not bool(set(right) - set(left))\n return first and second\n" ]
# -*- coding: utf-8 -*- ''' :depends: kazoo :configuration: See :py:mod:`salt.modules.zookeeper` for setup instructions. ACLS ~~~~ For more information about acls, please checkout the kazoo documentation. http://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl The following options c...
saltstack/salt
salt/modules/timezone.py
_timedatectl
python
def _timedatectl(): ''' get the output of timedatectl ''' ret = __salt__['cmd.run_all'](['timedatectl'], python_shell=False) if ret['retcode'] != 0: msg = 'timedatectl failed: {0}'.format(ret['stderr']) raise CommandExecutionError(msg) return ret
get the output of timedatectl
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L46-L56
null
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
_get_adjtime_timezone
python
def _get_adjtime_timezone(): ''' Return the timezone in /etc/adjtime of the system clock ''' adjtime_file = '/etc/adjtime' if os.path.exists(adjtime_file): cmd = ['tail', '-n', '1', adjtime_file] return __salt__['cmd.run'](cmd, python_shell=False) elif os.path.exists('/dev/rtc'):...
Return the timezone in /etc/adjtime of the system clock
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L70-L84
null
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
get_zone
python
def get_zone(): ''' Get current timezone (i.e. America/Denver) .. versionchanged:: 2016.11.4 .. note:: On AIX operating systems, Posix values can also be returned 'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00' CLI Example: .. code-block:: bash salt '*' timezone.get_zone ...
Get current timezone (i.e. America/Denver) .. versionchanged:: 2016.11.4 .. note:: On AIX operating systems, Posix values can also be returned 'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00' CLI Example: .. code-block:: bash salt '*' timezone.get_zone
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L161-L207
[ "def _timedatectl():\n '''\n get the output of timedatectl\n '''\n ret = __salt__['cmd.run_all'](['timedatectl'], python_shell=False)\n\n if ret['retcode'] != 0:\n msg = 'timedatectl failed: {0}'.format(ret['stderr'])\n raise CommandExecutionError(msg)\n\n return ret\n", "def _get_...
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
get_offset
python
def get_offset(): ''' Get current numeric timezone offset from UCT (i.e. -0700) CLI Example: .. code-block:: bash salt '*' timezone.get_offset ''' if 'AIX' not in __grains__['os_family']: return __salt__['cmd.run'](['date', '+%z'], python_shell=False) salt_path = '/opt/sa...
Get current numeric timezone offset from UCT (i.e. -0700) CLI Example: .. code-block:: bash salt '*' timezone.get_offset
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L223-L241
null
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
set_zone
python
def set_zone(timezone): ''' Unlinks, then symlinks /etc/localtime to the set timezone. The timezone is crucial to several system processes, each of which SHOULD be restarted (for instance, whatever you system uses as its cron and syslog daemons). This will not be automagically done and must be done...
Unlinks, then symlinks /etc/localtime to the set timezone. The timezone is crucial to several system processes, each of which SHOULD be restarted (for instance, whatever you system uses as its cron and syslog daemons). This will not be automagically done and must be done manually! CLI Example: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L244-L317
[ "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 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
zone_compare
python
def zone_compare(timezone): ''' Compares the given timezone name with the system timezone name. Checks the hash sum between the given timezone, and the one set in /etc/localtime. Returns True if names and hash sums match, and False if not. Mostly useful for running state checks. .. versionchang...
Compares the given timezone name with the system timezone name. Checks the hash sum between the given timezone, and the one set in /etc/localtime. Returns True if names and hash sums match, and False if not. Mostly useful for running state checks. .. versionchanged:: 2016.3.0 .. note:: On...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L320-L365
[ "def get_zone():\n '''\n Get current timezone (i.e. America/Denver)\n\n .. versionchanged:: 2016.11.4\n\n .. note::\n\n On AIX operating systems, Posix values can also be returned\n 'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00'\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*'...
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
get_hwclock
python
def get_hwclock(): ''' Get current hardware clock setting (UTC or localtime) CLI Example: .. code-block:: bash salt '*' timezone.get_hwclock ''' if salt.utils.path.which('timedatectl'): ret = _timedatectl() for line in (x.strip() for x in ret['stdout'].splitlines()): ...
Get current hardware clock setting (UTC or localtime) CLI Example: .. code-block:: bash salt '*' timezone.get_hwclock
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L378-L488
[ "def _timedatectl():\n '''\n get the output of timedatectl\n '''\n ret = __salt__['cmd.run_all'](['timedatectl'], python_shell=False)\n\n if ret['retcode'] != 0:\n msg = 'timedatectl failed: {0}'.format(ret['stderr'])\n raise CommandExecutionError(msg)\n\n return ret\n", "def _get_...
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/modules/timezone.py
set_hwclock
python
def set_hwclock(clock): ''' Sets the hardware clock to be either UTC or localtime CLI Example: .. code-block:: bash salt '*' timezone.set_hwclock UTC ''' if salt.utils.path.which('timedatectl'): cmd = ['timedatectl', 'set-local-rtc', 'true' if clock == 'localtim...
Sets the hardware clock to be either UTC or localtime CLI Example: .. code-block:: bash salt '*' timezone.set_hwclock UTC
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L491-L563
[ "def get_zone():\n '''\n Get current timezone (i.e. America/Denver)\n\n .. versionchanged:: 2016.11.4\n\n .. note::\n\n On AIX operating systems, Posix values can also be returned\n 'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00'\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*'...
# -*- coding: utf-8 -*- ''' Module for managing timezone on POSIX-like systems. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import filecmp import os import errno import logging import re import string # Import salt libs import salt.utils.files import salt.utils.ha...
saltstack/salt
salt/states/chocolatey.py
installed
python
def installed(name, version=None, source=None, force=False, pre_versions=False, install_args=None, override_args=False, force_x86=False, package_args=None, allow_multiple=False, execution_timeout=None): ''' Installs a package if not already installed Args: name (str): ...
Installs a package if not already installed Args: name (str): The name of the package to be installed. Required. version (str): Install a specific version of the package. Defaults to latest version. If the version is different to the one installed then the ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/chocolatey.py#L30-L199
[ "def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):\n '''\n Compares two version numbers. Accepts a custom function to perform the\n cmp-style version comparison, otherwise uses version_cmp().\n '''\n cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),\n '>=': (0...
# -*- coding: utf-8 -*- ''' Manage Chocolatey package installs .. versionadded:: 2016.3.0 .. note:: Chocolatey pulls data from the Chocolatey internet database to determine current versions, find available versions, etc. This is normally a slow operation and may be optimized by specifying a local, smaller...
saltstack/salt
salt/states/chocolatey.py
uninstalled
python
def uninstalled(name, version=None, uninstall_args=None, override_args=False): ''' Uninstalls a package name The name of the package to be uninstalled version Uninstalls a specific version of the package. Defaults to latest version installed. uninstall_args A list of unins...
Uninstalls a package name The name of the package to be uninstalled version Uninstalls a specific version of the package. Defaults to latest version installed. uninstall_args A list of uninstall arguments you want to pass to the uninstallation process i.e product key or feat...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/chocolatey.py#L202-L278
null
# -*- coding: utf-8 -*- ''' Manage Chocolatey package installs .. versionadded:: 2016.3.0 .. note:: Chocolatey pulls data from the Chocolatey internet database to determine current versions, find available versions, etc. This is normally a slow operation and may be optimized by specifying a local, smaller...
saltstack/salt
salt/utils/job.py
store_job
python
def store_job(opts, load, event=None, mminion=None): ''' Store job information using the configured master_job_cache ''' # Generate EndTime endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid(opts)) # If the return data is invalid, just ignore it if any(key not in load for key in ('r...
Store job information using the configured master_job_cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/job.py#L19-L116
[ "def valid_id(opts, id_):\n '''\n Returns if the passed id is valid\n '''\n try:\n if any(x in id_ for x in ('/', '\\\\', str('\\0'))):\n return False\n return bool(clean_path(opts['pki_dir'], id_))\n except (AttributeError, KeyError, TypeError, UnicodeDecodeError):\n ...
# -*- coding: utf-8 -*- ''' Functions for interacting with the job cache ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Import Salt libs import salt.minion import salt.utils.jid import salt.utils.event import salt.utils.verify log = logging.getLogger(__name__) d...
saltstack/salt
salt/utils/job.py
store_minions
python
def store_minions(opts, jid, minions, mminion=None, syndic_id=None): ''' Store additional minions matched on lower-level masters using the configured master_job_cache ''' if mminion is None: mminion = salt.minion.MasterMinion(opts, states=False, rend=False) job_cache = opts['master_job_c...
Store additional minions matched on lower-level masters using the configured master_job_cache
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/job.py#L119-L136
null
# -*- coding: utf-8 -*- ''' Functions for interacting with the job cache ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Import Salt libs import salt.minion import salt.utils.jid import salt.utils.event import salt.utils.verify log = logging.getLogger(__name__) de...
saltstack/salt
salt/utils/job.py
get_retcode
python
def get_retcode(ret): ''' Determine a retcode for a given return ''' retcode = 0 # if there is a dict with retcode, use that if isinstance(ret, dict) and ret.get('retcode', 0) != 0: return ret['retcode'] # if its a boolean, False means 1 elif isinstance(ret, bool) and not ret: ...
Determine a retcode for a given return
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/job.py#L139-L150
null
# -*- coding: utf-8 -*- ''' Functions for interacting with the job cache ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging # Import Salt libs import salt.minion import salt.utils.jid import salt.utils.event import salt.utils.verify log = logging.getLogger(__name__) de...
saltstack/salt
salt/beacons/aix_account.py
beacon
python
def beacon(config): ''' Checks for locked accounts due to too many invalid login attempts, 3 or higher. .. code-block:: yaml beacons: aix_account: user: ALL interval: 120 ''' ret = [] user = config['user'] locked_accounts = __salt__['shadow.log...
Checks for locked accounts due to too many invalid login attempts, 3 or higher. .. code-block:: yaml beacons: aix_account: user: ALL interval: 120
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/aix_account.py#L43-L63
null
# -*- coding: utf-8 -*- ''' Beacon to fire event when we notice a AIX user is locked due to many failed login attempts. .. versionadded:: 2018.3.0 :depends: none ''' # Import Python libs from __future__ import absolute_import, unicode_literals import logging log = logging.getLogger(__name__) __virtualname__ = 'aix...
saltstack/salt
salt/modules/opsgenie.py
post_data
python
def post_data(api_key=None, name='OpsGenie Execution Module', reason=None, action_type=None): ''' Post data to OpsGenie. It's designed for Salt's Event Reactor. After configuring the sls reaction file as shown above, you can trigger the module with your designated tag (og-tag in this case...
Post data to OpsGenie. It's designed for Salt's Event Reactor. After configuring the sls reaction file as shown above, you can trigger the module with your designated tag (og-tag in this case). CLI Example: .. code-block:: bash salt-call event.send 'og-tag' '{"reason" : "Overheating CPU!"}' ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opsgenie.py#L37-L109
[ "def dumps(obj, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly\n passed as True) for unicode compatibility. Note that setting it to True\n will mess up any unicode characters, as they will be dumped as the string\n lite...
# -*- coding: utf-8 -*- ''' Module for sending data to OpsGenie .. versionadded:: 2018.3.0 :configuration: This module can be used in Reactor System for posting data to OpsGenie as a remote-execution function. For example: .. code-block:: yaml opsgenie_event_poster: local.opsgenie.pos...
saltstack/salt
salt/states/macpackage.py
installed
python
def installed(name, target="LocalSystem", dmg=False, store=False, app=False, mpkg=False, user=None, onlyif=None, unless=None, force=False, allow_untrusted=False, version_check=None): ''' Install a Mac OS Package from a pkg or dmg file, if given a dmg file it will first be mounted in a temporar...
Install a Mac OS Package from a pkg or dmg file, if given a dmg file it will first be mounted in a temporary location name The pkg or dmg file to install target The location in which to install the package. This can be a path or LocalSystem dmg Is the given file a dmg file? ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/macpackage.py#L49-L245
[ "def _mod_run_check(cmd_kwargs, onlyif, unless):\n '''\n Execute the onlyif and unless logic.\n Return a result dict if:\n * onlyif failed (onlyif != 0)\n * unless succeeded (unless == 0)\n else return True\n '''\n if onlyif:\n if __salt__['cmd.retcode'](onlyif, **cmd_kwargs) != 0:\n ...
# -*- coding: utf-8 -*- ''' Installing of mac pkg files =========================== Install any kind of pkg, dmg or app file on macOS: .. code-block:: yaml /mnt/test.pkg: macpackage.installed: - store: True /mnt/test.dmg: macpackage.installed: - dmg: True /mnt/xcode.dmg: ...
saltstack/salt
salt/states/macpackage.py
_mod_run_check
python
def _mod_run_check(cmd_kwargs, onlyif, unless): ''' Execute the onlyif and unless logic. Return a result dict if: * onlyif failed (onlyif != 0) * unless succeeded (unless == 0) else return True ''' if onlyif: if __salt__['cmd.retcode'](onlyif, **cmd_kwargs) != 0: retu...
Execute the onlyif and unless logic. Return a result dict if: * onlyif failed (onlyif != 0) * unless succeeded (unless == 0) else return True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/macpackage.py#L248-L269
null
# -*- coding: utf-8 -*- ''' Installing of mac pkg files =========================== Install any kind of pkg, dmg or app file on macOS: .. code-block:: yaml /mnt/test.pkg: macpackage.installed: - store: True /mnt/test.dmg: macpackage.installed: - dmg: True /mnt/xcode.dmg: ...
saltstack/salt
salt/modules/rest_service.py
status
python
def status(name, sig=None): ''' Return the status for a service via rest_sample. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionadded:: 2015.8.0 .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) ...
Return the status for a service via rest_sample. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionadded:: 2015.8.0 .. versionchanged:: 2018.3.0 The service name can now be a glob (e.g. ``salt*``) Args: name (str): The name of t...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rest_service.py#L128-L169
[ "def get_all():\n '''\n Return a list of all available services\n\n .. versionadded:: 2015.8.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' service.get_all\n '''\n proxy_fn = 'rest_sample.service_list'\n return __proxy__[proxy_fn]()\n" ]
# -*- coding: utf-8 -*- ''' Provide the service module for the proxy-minion REST sample ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function import logging import fnmatch import re # Import Salt libs import salt.utils.platform log = logging.getLogger(__name__) __func_alia...
saltstack/salt
salt/utils/schedule.py
clean_proc_dir
python
def clean_proc_dir(opts): ''' Loop through jid files in the minion proc directory (default /var/cache/salt/minion/proc) and remove any that refer to processes that no longer exist ''' for basefilename in os.listdir(salt.minion.get_proc_dir(opts['cachedir'])): fn_ = os.path.join(salt.minion...
Loop through jid files in the minion proc directory (default /var/cache/salt/minion/proc) and remove any that refer to processes that no longer exist
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L1693-L1733
[ "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 -*- # See doc/topics/jobs/index.rst ''' Scheduling routines are located here. To activate the scheduler make the ``schedule`` option available to the master or minion configurations (master config file or for the minion via config or pillar). Detailed tutorial about scheduling jobs can be found :r...
saltstack/salt
salt/utils/schedule.py
Schedule.option
python
def option(self, opt): ''' Return options merged from config and pillar ''' if 'config.merge' in self.functions: return self.functions['config.merge'](opt, {}, omit_master=True) return self.opts.get(opt, {})
Return options merged from config and pillar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L165-L171
null
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule._get_schedule
python
def _get_schedule(self, include_opts=True, include_pillar=True, remove_hidden=False): ''' Return the schedule data structure ''' schedule = {} if include_pillar: pillar_schedule = self.opts.get('pillar'...
Return the schedule data structure
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L173-L199
null
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule._check_max_running
python
def _check_max_running(self, func, data, opts, now): ''' Return the schedule data structure ''' # Check to see if there are other jobs with this # signature running. If there are more than maxrunning # jobs present then don't start another. # If jid_include is Fa...
Return the schedule data structure
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L201-L246
null
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.persist
python
def persist(self): ''' Persist the modified schedule into <<configdir>>/<<default_include>>/_schedule.conf ''' config_dir = self.opts.get('conf_dir', None) if config_dir is None and 'conf_file' in self.opts: config_dir = os.path.dirname(self.opts['conf_file']) ...
Persist the modified schedule into <<configdir>>/<<default_include>>/_schedule.conf
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L248-L281
[ "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 ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.delete_job
python
def delete_job(self, name, persist=True): ''' Deletes a job from the scheduler. Ignore jobs from pillar ''' # ensure job exists, then delete it if name in self.opts['schedule']: del self.opts['schedule'][name] elif name in self._get_schedule(include_opts=False...
Deletes a job from the scheduler. Ignore jobs from pillar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L283-L304
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.reset
python
def reset(self): ''' Reset the scheduler to defaults ''' self.skip_function = None self.skip_during_range = None self.enabled = True self.splay = None self.opts['schedule'] = {}
Reset the scheduler to defaults
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L306-L314
null
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.delete_job_prefix
python
def delete_job_prefix(self, name, persist=True): ''' Deletes a job from the scheduler. Ignores jobs from pillar ''' # ensure job exists, then delete it for job in list(self.opts['schedule'].keys()): if job.startswith(name): del self.opts['schedule'][jo...
Deletes a job from the scheduler. Ignores jobs from pillar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L316-L340
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.add_job
python
def add_job(self, data, persist=True): ''' Adds a new job to the scheduler. The format is the same as required in the configuration file. See the docs on how YAML is interpreted into python data-structures to make sure, you pass correct dictionaries. ''' # we don't do an...
Adds a new job to the scheduler. The format is the same as required in the configuration file. See the docs on how YAML is interpreted into python data-structures to make sure, you pass correct dictionaries.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L342-L382
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass i...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.modify_job
python
def modify_job(self, name, schedule, persist=True): ''' Modify a job in the scheduler. Ignores jobs from pillar ''' # ensure job exists, then replace it if name in self.opts['schedule']: self.delete_job(name, persist) elif name in self._get_schedule(include_op...
Modify a job in the scheduler. Ignores jobs from pillar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L424-L438
[ "def _get_schedule(self,\n include_opts=True,\n include_pillar=True,\n remove_hidden=False):\n '''\n Return the schedule data structure\n '''\n schedule = {}\n if include_pillar:\n pillar_schedule = self.opts.get('pillar', {}).get('schedule', ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.run_job
python
def run_job(self, name): ''' Run a schedule job now ''' data = self._get_schedule().get(name, {}) if 'function' in data: func = data['function'] elif 'func' in data: func = data['func'] elif 'fun' in data: func = data['fun'] ...
Run a schedule job now
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L440-L470
[ "def _get_schedule(self,\n include_opts=True,\n include_pillar=True,\n remove_hidden=False):\n '''\n Return the schedule data structure\n '''\n schedule = {}\n if include_pillar:\n pillar_schedule = self.opts.get('pillar', {}).get('schedule', ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.enable_schedule
python
def enable_schedule(self): ''' Enable the scheduler. ''' self.opts['schedule']['enabled'] = True # Fire the complete event back along with updated list of schedule evt = salt.utils.event.get_event('minion', opts=self.opts, listen=False) evt.fire_event({'complete'...
Enable the scheduler.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L472-L481
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.reload
python
def reload(self, schedule): ''' Reload the schedule from saved schedule file. ''' # Remove all jobs from self.intervals self.intervals = {} if 'schedule' in schedule: schedule = schedule['schedule'] self.opts.setdefault('schedule', {}).update(schedule...
Reload the schedule from saved schedule file.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L494-L503
null
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.list
python
def list(self, where): ''' List the current schedule items ''' if where == 'pillar': schedule = self._get_schedule(include_opts=False) elif where == 'opts': schedule = self._get_schedule(include_pillar=False) else: schedule = self._get_...
List the current schedule items
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L505-L519
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.save_schedule
python
def save_schedule(self): ''' Save the current schedule ''' self.persist() # Fire the complete event back along with the list of schedule evt = salt.utils.event.get_event('minion', opts=self.opts, listen=False) evt.fire_event({'complete': True}, ...
Save the current schedule
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L521-L530
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.skip_job
python
def skip_job(self, name, data): ''' Skip a job at a specific time in the scheduler. Ignores jobs from pillar ''' time = data['time'] time_fmt = data.get('time_fmt', '%Y-%m-%dT%H:%M:%S') # ensure job exists, then disable it if name in self.opts['schedule']...
Skip a job at a specific time in the scheduler. Ignores jobs from pillar
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L562-L584
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.get_next_fire_time
python
def get_next_fire_time(self, name, fmt='%Y-%m-%dT%H:%M:%S'): ''' Return the next fire time for the specified job ''' schedule = self._get_schedule() _next_fire_time = None if schedule: _next_fire_time = schedule.get(name, {}).get('_next_fire_time', None) ...
Return the next fire time for the specified job
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L586-L601
[ "def get_event(\n node, sock_dir=None, transport='zeromq',\n opts=None, listen=True, io_loop=None, keep_loop=False, raise_errors=False):\n '''\n Return an event object suitable for the named transport\n\n :param IOLoop io_loop: Pass in an io_loop if you want asynchronous\n ...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.handle_func
python
def handle_func(self, multiprocessing_enabled, func, data): ''' Execute this method in a multiprocess or thread ''' if salt.utils.platform.is_windows() \ or self.opts.get('transport') == 'zeromq': # Since function references can't be pickled and pickling ...
Execute this method in a multiprocess or thread
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L611-L851
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_master_event(opts, sock_dir, listen=True, io_loop=None, raise_errors=False, keep_loop=False):\n '''\n Return an event object suitable for the named transport\n '''\n # TODO: AIO core is separate from transport\n if opts['transport'...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/utils/schedule.py
Schedule.eval
python
def eval(self, now=None): ''' Evaluate and execute the schedule :param datetime now: Override current time with a datetime object instance`` ''' log.trace('==== evaluating schedule now %s =====', now) loop_interval = self.opts['loop_interval'] if not isinstanc...
Evaluate and execute the schedule :param datetime now: Override current time with a datetime object instance``
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L853-L1637
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _get_schedule(self,\n include_opts=True,\n include_pillar=True,\n remove_hidden=False):\n '''\n Return the schedule data structure\n '''\n schedule = {}\n if include_pillar:\n p...
class Schedule(object): ''' Create a Schedule object, pass in the opts and the functions dict to use ''' instance = None def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None, standa...
saltstack/salt
salt/modules/aws_sqs.py
_run_aws
python
def _run_aws(cmd, region, opts, user, **kwargs): ''' Runs the given command against AWS. cmd Command to run region Region to execute cmd in opts Pass in from salt user Pass in from salt kwargs Key-value arguments to pass to the command ''' # Th...
Runs the given command against AWS. cmd Command to run region Region to execute cmd in opts Pass in from salt user Pass in from salt kwargs Key-value arguments to pass to the command
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L34-L68
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def loads(s, **kwargs):\n '''\n .. versionadded:: 2018.3.0\n\n Wraps json.loads and prevents a traceback in the event that a bytestring is\n passed to the function. (Python < 3.6 cannot load bytestrings)\n\n You can pass an alternate json ...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
receive_message
python
def receive_message(queue, region, num=1, opts=None, user=None): ''' Receive one or more messages from a queue in a region queue The name of the queue to receive messages from region Region where SQS queues exists num : 1 The max number of messages to receive opts : N...
Receive one or more messages from a queue in a region queue The name of the queue to receive messages from region Region where SQS queues exists num : 1 The max number of messages to receive opts : None Any additional options to add to the command line user : Non...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L71-L112
[ "def _run_aws(cmd, region, opts, user, **kwargs):\n '''\n Runs the given command against AWS.\n cmd\n Command to run\n region\n Region to execute cmd in\n opts\n Pass in from salt\n user\n Pass in from salt\n kwargs\n Key-value arguments to pass to the command...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
delete_message
python
def delete_message(queue, region, receipthandle, opts=None, user=None): ''' Delete one or more messages from a queue in a region queue The name of the queue to delete messages from region Region where SQS queues exists receipthandle The ReceiptHandle of the message to dele...
Delete one or more messages from a queue in a region queue The name of the queue to delete messages from region Region where SQS queues exists receipthandle The ReceiptHandle of the message to delete. The ReceiptHandle is obtained in the return from receive_message op...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L115-L152
[ "def _run_aws(cmd, region, opts, user, **kwargs):\n '''\n Runs the given command against AWS.\n cmd\n Command to run\n region\n Region to execute cmd in\n opts\n Pass in from salt\n user\n Pass in from salt\n kwargs\n Key-value arguments to pass to the command...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
list_queues
python
def list_queues(region, opts=None, user=None): ''' List the queues in the selected region. region Region to list SQS queues for opts : None Any additional options to add to the command line user : None Run hg as a user other than what the minion runs as CLI Example: ...
List the queues in the selected region. region Region to list SQS queues for opts : None Any additional options to add to the command line user : None Run hg as a user other than what the minion runs as CLI Example: salt '*' aws_sqs.list_queues <region>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L155-L179
[ "def _run_aws(cmd, region, opts, user, **kwargs):\n '''\n Runs the given command against AWS.\n cmd\n Command to run\n region\n Region to execute cmd in\n opts\n Pass in from salt\n user\n Pass in from salt\n kwargs\n Key-value arguments to pass to the command...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
create_queue
python
def create_queue(name, region, opts=None, user=None): ''' Creates a queue with the correct name. name Name of the SQS queue to create region Region to create the SQS queue in opts : None Any additional options to add to the command line user : None Run hg as a...
Creates a queue with the correct name. name Name of the SQS queue to create region Region to create the SQS queue in opts : None Any additional options to add to the command line user : None Run hg as a user other than what the minion runs as CLI Example: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L182-L214
[ "def _run_aws(cmd, region, opts, user, **kwargs):\n '''\n Runs the given command against AWS.\n cmd\n Command to run\n region\n Region to execute cmd in\n opts\n Pass in from salt\n user\n Pass in from salt\n kwargs\n Key-value arguments to pass to the command...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
delete_queue
python
def delete_queue(name, region, opts=None, user=None): ''' Deletes a queue in the region. name Name of the SQS queue to deletes region Name of the region to delete the queue from opts : None Any additional options to add to the command line user : None Run hg as...
Deletes a queue in the region. name Name of the SQS queue to deletes region Name of the region to delete the queue from opts : None Any additional options to add to the command line user : None Run hg as a user other than what the minion runs as CLI Example: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L217-L264
[ "def _run_aws(cmd, region, opts, user, **kwargs):\n '''\n Runs the given command against AWS.\n cmd\n Command to run\n region\n Region to execute cmd in\n opts\n Pass in from salt\n user\n Pass in from salt\n kwargs\n Key-value arguments to pass to the command...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
queue_exists
python
def queue_exists(name, region, opts=None, user=None): ''' Returns True or False on whether the queue exists in the region name Name of the SQS queue to search for region Name of the region to search for the queue in opts : None Any additional options to add to the command ...
Returns True or False on whether the queue exists in the region name Name of the SQS queue to search for region Name of the region to search for the queue in opts : None Any additional options to add to the command line user : None Run hg as a user other than what the...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L267-L290
[ "def list_queues(region, opts=None, user=None):\n '''\n List the queues in the selected region.\n\n region\n Region to list SQS queues for\n\n opts : None\n Any additional options to add to the command line\n\n user : None\n Run hg as a user other than what the minion runs as\n\n...
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/modules/aws_sqs.py
_parse_queue_list
python
def _parse_queue_list(list_output): ''' Parse the queue to get a dict of name -> URL ''' queues = dict((q.split('/')[-1], q) for q in list_output['stdout']) return queues
Parse the queue to get a dict of name -> URL
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L293-L298
null
# -*- coding: utf-8 -*- ''' Support for the Amazon Simple Queue Service. ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import salt libs import salt.utils.json import salt.utils.path from salt.ext import six log = logging.getLogger(__name__) _OUTPU...
saltstack/salt
salt/cloud/clouds/xen.py
_get_session
python
def _get_session(): ''' Get a connection to the XenServer host ''' api_version = '1.0' originator = 'salt_cloud_{}_driver'.format(__virtualname__) url = config.get_cloud_config_value( 'url', get_configured_provider(), __opts__, search_global=False ) user =...
Get a connection to the XenServer host
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L131-L181
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
list_nodes
python
def list_nodes(): ''' List virtual machines .. code-block:: bash salt-cloud -Q ''' session = _get_session() vms = session.xenapi.VM.get_all_records() ret = {} for vm in vms: record = session.xenapi.VM.get_record(vm) if not record['is_a_template'] and not re...
List virtual machines .. code-block:: bash salt-cloud -Q
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L184-L214
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
get_vm_ip
python
def get_vm_ip(name=None, session=None, call=None): ''' Get the IP address of the VM .. code-block:: bash salt-cloud -a get_vm_ip xenvm01 .. note:: Requires xen guest tools to be installed in VM ''' if call == 'function': raise SaltCloudException( 'This function mu...
Get the IP address of the VM .. code-block:: bash salt-cloud -a get_vm_ip xenvm01 .. note:: Requires xen guest tools to be installed in VM
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L217-L260
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
set_vm_ip
python
def set_vm_ip(name=None, ipv4_cidr=None, ipv4_gw=None, session=None, call=None): ''' Set the IP address on a virtual interface (vif) ''' mode = 'static' # TODO: Need to add support for IPv6 if call == 'function': raise SaltCloudExc...
Set the IP address on a virtual interface (vif)
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L263-L302
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
list_nodes_full
python
def list_nodes_full(session=None): ''' List full virtual machines .. code-block:: bash salt-cloud -F ''' if session is None: session = _get_session() ret = {} vms = session.xenapi.VM.get_all() for vm in vms: record = session.xenapi.VM.get_record(vm) ...
List full virtual machines .. code-block:: bash salt-cloud -F
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L305-L351
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
vdi_list
python
def vdi_list(call=None, kwargs=None): ''' Return available Xen VDI images If this function is called with the ``-f`` or ``--function`` then it can return a list with minimal deatil using the ``terse=True`` keyword argument. .. code-block:: bash salt-cloud -f vdi_list myxen terse=True ...
Return available Xen VDI images If this function is called with the ``-f`` or ``--function`` then it can return a list with minimal deatil using the ``terse=True`` keyword argument. .. code-block:: bash salt-cloud -f vdi_list myxen terse=True
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L370-L411
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
template_list
python
def template_list(call=None): ''' Return available Xen template information. This returns the details of each template to show number cores, memory sizes, etc.. .. code-block:: bash salt-cloud -f template_list myxen ''' templates = {} session = _get_session() vms = session...
Return available Xen template information. This returns the details of each template to show number cores, memory sizes, etc.. .. code-block:: bash salt-cloud -f template_list myxen
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L447-L466
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
show_instance
python
def show_instance(name, session=None, call=None): ''' Show information about a specific VM or template .. code-block:: bash salt-cloud -a show_instance xenvm01 .. note:: memory is memory_dynamic_max ''' if call == 'function': raise SaltCloudException( 'The...
Show information about a specific VM or template .. code-block:: bash salt-cloud -a show_instance xenvm01 .. note:: memory is memory_dynamic_max
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L469-L511
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_determine_resource_pool
python
def _determine_resource_pool(session, vm_): ''' Called by create() used to determine resource pool ''' resource_pool = '' if 'resource_pool' in vm_.keys(): resource_pool = _get_pool(vm_['resource_pool'], session) else: pool = session.xenapi.pool.get_all() if not pool: ...
Called by create() used to determine resource pool
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L514-L530
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_determine_storage_repo
python
def _determine_storage_repo(session, resource_pool, vm_): ''' Called by create() used to determine storage repo for create ''' storage_repo = '' if 'storage_repo' in vm_.keys(): storage_repo = _get_sr(vm_['storage_repo'], session) else: storage_repo = None if resource_poo...
Called by create() used to determine storage repo for create
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L533-L550
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
create
python
def create(vm_): ''' Create a VM in Xen The configuration for this function is read from the profile settings. .. code-block:: bash salt-cloud -p some_profile xenvm01 ''' name = vm_['name'] record = {} ret = {} # fire creating event __utils__['cloud.fire_event']( ...
Create a VM in Xen The configuration for this function is read from the profile settings. .. code-block:: bash salt-cloud -p some_profile xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L553-L661
[ "def start(name, call=None, session=None):\n '''\n Start a vm\n\n .. code-block:: bash\n\n salt-cloud -a start xenvm01\n\n '''\n if call == 'function':\n raise SaltCloudException(\n 'The show_instnce function must be called with -a or --action.'\n )\n if session is...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_deploy_salt_minion
python
def _deploy_salt_minion(name, session, vm_): ''' Deploy salt minion during create() ''' # Get bootstrap values vm_['ssh_host'] = get_vm_ip(name, session) vm_['user'] = vm_.get('user', 'root') vm_['password'] = vm_.get('password', 'p@ssw0rd!') vm_['provider'] = vm_.get('provider', 'xen') ...
Deploy salt minion during create()
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L664-L678
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_set_static_ip
python
def _set_static_ip(name, session, vm_): ''' Set static IP during create() if defined ''' ipv4_cidr = '' ipv4_gw = '' if 'ipv4_gw' in vm_.keys(): log.debug('ipv4_gw is found in keys') ipv4_gw = vm_['ipv4_gw'] if 'ipv4_cidr' in vm_.keys(): log.debug('ipv4_cidr is found ...
Set static IP during create() if defined
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L681-L694
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_wait_for_ip
python
def _wait_for_ip(name, session): ''' Wait for IP to be available during create() ''' start_time = datetime.now() status = None while status is None: status = get_vm_ip(name, session) if status is not None: # ignore APIPA address if status.startswith('169'...
Wait for IP to be available during create()
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L697-L718
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_run_async_task
python
def _run_async_task(task=None, session=None): ''' Run XenAPI task in asynchronous mode to prevent timeouts ''' if task is None or session is None: return None task_name = session.xenapi.task.get_name_label(task) log.debug('Running %s', task_name) while session.xenapi.task.get_status...
Run XenAPI task in asynchronous mode to prevent timeouts
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L721-L734
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_clone_vm
python
def _clone_vm(image=None, name=None, session=None): ''' Create VM by cloning This is faster and should be used if source and target are in the same storage repository ''' if session is None: session = _get_session() log.debug('Creating VM %s by cloning %s', name, image) source ...
Create VM by cloning This is faster and should be used if source and target are in the same storage repository
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L737-L750
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_copy_vm
python
def _copy_vm(template=None, name=None, session=None, sr=None): ''' Create VM by copy This is slower and should be used if source and target are NOT in the same storage repository template = object reference name = string name of new VM session = object reference sr = object reference ...
Create VM by copy This is slower and should be used if source and target are NOT in the same storage repository template = object reference name = string name of new VM session = object reference sr = object reference
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L753-L770
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_provision_vm
python
def _provision_vm(name=None, session=None): ''' Provision vm right after clone/copy ''' if session is None: session = _get_session() log.info('Provisioning VM %s', name) vm = _get_vm(name, session) task = session.xenapi.Async.VM.provision(vm) _run_async_task(task, session)
Provision vm right after clone/copy
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L773-L782
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
unpause
python
def unpause(name, call=None, session=None): ''' UnPause a vm .. code-block:: bash salt-cloud -a unpause xenvm01 ''' if call == 'function': raise SaltCloudException( 'The show_instnce function must be called with -a or --action.' ) if session is None: ...
UnPause a vm .. code-block:: bash salt-cloud -a unpause xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L829-L848
[ "def show_instance(name, session=None, call=None):\n '''\n Show information about a specific VM or template\n\n .. code-block:: bash\n\n salt-cloud -a show_instance xenvm01\n\n .. note:: memory is memory_dynamic_max\n\n '''\n if call == 'function':\n raise SaltCloudException(...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
resume
python
def resume(name, call=None, session=None): ''' Resume a vm from disk .. code-block:: bash salt-cloud -a resume xenvm01 ''' if call == 'function': raise SaltCloudException( 'The show_instnce function must be called with -a or --action.' ) if session is None:...
Resume a vm from disk .. code-block:: bash salt-cloud -a resume xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L873-L892
[ "def show_instance(name, session=None, call=None):\n '''\n Show information about a specific VM or template\n\n .. code-block:: bash\n\n salt-cloud -a show_instance xenvm01\n\n .. note:: memory is memory_dynamic_max\n\n '''\n if call == 'function':\n raise SaltCloudException(...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
stop
python
def stop(name, call=None, session=None): ''' Stop a vm .. code-block:: bash salt-cloud -a stop xenvm01 ''' if call == 'function': raise SaltCloudException( 'The show_instnce function must be called with -a or --action.' ) return shutdown(name, call, sessio...
Stop a vm .. code-block:: bash salt-cloud -a stop xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L895-L909
[ "def shutdown(name, call=None, session=None):\n '''\n Shutdown a vm\n\n .. code-block:: bash\n\n salt-cloud -a shutdown xenvm01\n\n '''\n if call == 'function':\n raise SaltCloudException(\n 'The show_instnce function must be called with -a or --action.'\n )\n if s...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
reboot
python
def reboot(name, call=None, session=None): ''' Reboot a vm .. code-block:: bash salt-cloud -a reboot xenvm01 ''' if call == 'function': raise SaltCloudException( 'The show_instnce function must be called with -a or --action.' ) if session is None: s...
Reboot a vm .. code-block:: bash salt-cloud -a reboot xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L934-L957
[ "def show_instance(name, session=None, call=None):\n '''\n Show information about a specific VM or template\n\n .. code-block:: bash\n\n salt-cloud -a show_instance xenvm01\n\n .. note:: memory is memory_dynamic_max\n\n '''\n if call == 'function':\n raise SaltCloudException(...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_get_vm
python
def _get_vm(name=None, session=None): ''' Get XEN vm instance object reference ''' if session is None: session = _get_session() vms = session.xenapi.VM.get_by_name_label(name) if len(vms) == 1: return vms[0] return None
Get XEN vm instance object reference
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L960-L969
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_get_sr
python
def _get_sr(name=None, session=None): ''' Get XEN sr (storage repo) object reference ''' if session is None: session = _get_session() srs = session.xenapi.SR.get_by_name_label(name) if len(srs) == 1: return srs[0] return None
Get XEN sr (storage repo) object reference
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L972-L981
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
_get_pool
python
def _get_pool(name=None, session=None): ''' Get XEN resource pool object reference ''' if session is None: session = _get_session() pools = session.xenapi.pool.get_all() for pool in pools: pool_record = session.xenapi.pool.get_record(pool) if name in pool_record.get('name...
Get XEN resource pool object reference
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L984-L995
null
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
destroy
python
def destroy(name=None, call=None): ''' Destroy Xen VM or template instance .. code-block:: bash salt-cloud -d xenvm01 ''' if call == 'function': raise SaltCloudSystemExit( 'The destroy action must be called with -d, --destroy, ' '-a or --action.' ) ...
Destroy Xen VM or template instance .. code-block:: bash salt-cloud -d xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L998-L1053
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
sr_list
python
def sr_list(call=None): ''' Geta list of storage repositories .. code-block:: bash salt-cloud -f sr_list myxen ''' if call != 'function': raise SaltCloudSystemExit( 'This function must be called with -f, --function argument.' ) ret = {} session = _get_s...
Geta list of storage repositories .. code-block:: bash salt-cloud -f sr_list myxen
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1056-L1075
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
host_list
python
def host_list(call=None): ''' Get a list of Xen Servers .. code-block:: bash salt-cloud -f host_list myxen ''' if call == 'action': raise SaltCloudSystemExit( 'This function must be called with -f, --function argument.' ) ret = {} session = _get_session(...
Get a list of Xen Servers .. code-block:: bash salt-cloud -f host_list myxen
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1078-L1096
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
pool_list
python
def pool_list(call=None): ''' Get a list of Resource Pools .. code-block:: bash salt-cloud -f pool_list myxen ''' if call == 'action': raise SaltCloudSystemExit( 'This function must be called with -f, --function argument.' ) ret = {} session = _get_sess...
Get a list of Resource Pools .. code-block:: bash salt-cloud -f pool_list myxen
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1099-L1118
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
pif_list
python
def pif_list(call=None): ''' Get a list of Resource Pools .. code-block:: bash salt-cloud -f pool_list myxen ''' if call != 'function': raise SaltCloudSystemExit( 'This function must be called with -f, --function argument.' ) ret = {} session = _get_sess...
Get a list of Resource Pools .. code-block:: bash salt-cloud -f pool_list myxen
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1121-L1139
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
vif_list
python
def vif_list(name, call=None, kwargs=None): ''' Get a list of virtual network interfaces on a VM **requires**: the name of the vm with the vbd definition .. code-block:: bash salt-cloud -a vif_list xenvm01 ''' if call == 'function': raise SaltCloudSystemExit( 'Th...
Get a list of virtual network interfaces on a VM **requires**: the name of the vm with the vbd definition .. code-block:: bash salt-cloud -a vif_list xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1142-L1171
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
vbd_list
python
def vbd_list(name=None, call=None): ''' Get a list of VBDs on a VM **requires**: the name of the vm with the vbd definition .. code-block:: bash salt-cloud -a vbd_list xenvm01 ''' if call == 'function': raise SaltCloudSystemExit( 'This function must be called with...
Get a list of VBDs on a VM **requires**: the name of the vm with the vbd definition .. code-block:: bash salt-cloud -a vbd_list xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1174-L1205
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
destroy_vm_vdis
python
def destroy_vm_vdis(name=None, session=None, call=None): ''' Get virtual block devices on VM .. code-block:: bash salt-cloud -a destroy_vm_vdis xenvm01 ''' if session is None: session = _get_session() ret = {} # get vm object vms = session.xenapi.VM.get_by_name_label(...
Get virtual block devices on VM .. code-block:: bash salt-cloud -a destroy_vm_vdis xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1227-L1256
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
destroy_template
python
def destroy_template(name=None, call=None, kwargs=None): ''' Destroy Xen VM or template instance .. code-block:: bash salt-cloud -f destroy_template myxen name=testvm2 ''' if call == 'action': raise SaltCloudSystemExit( 'The destroy_template function must be ca...
Destroy Xen VM or template instance .. code-block:: bash salt-cloud -f destroy_template myxen name=testvm2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1259-L1289
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
get_pv_args
python
def get_pv_args(name, session=None, call=None): ''' Get PV arguments for a VM .. code-block:: bash salt-cloud -a get_pv_args xenvm01 ''' if call == 'function': raise SaltCloudException( 'This function must be called with -a or --action.' ) if session is Non...
Get PV arguments for a VM .. code-block:: bash salt-cloud -a get_pv_args xenvm01
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1292-L1312
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/cloud/clouds/xen.py
set_pv_args
python
def set_pv_args(name, kwargs=None, session=None, call=None): ''' Set PV arguments for a VM .. code-block:: bash salt-cloud -a set_pv_args xenvm01 pv_args="utf-8 graphical" ''' if call == 'function': raise SaltCloudException( 'This function must be called with -a or --a...
Set PV arguments for a VM .. code-block:: bash salt-cloud -a set_pv_args xenvm01 pv_args="utf-8 graphical"
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1315-L1341
[ "def _get_session():\n '''\n Get a connection to the XenServer host\n '''\n api_version = '1.0'\n originator = 'salt_cloud_{}_driver'.format(__virtualname__)\n url = config.get_cloud_config_value(\n 'url',\n get_configured_provider(),\n __opts__,\n search_global=False\n...
# -*- coding: utf-8 -*- ''' XenServer Cloud Driver ====================== The XenServer driver is designed to work with a Citrix XenServer. Requires XenServer SDK (can be downloaded from https://www.citrix.com/downloads/xenserver/product-software/ ) Place a copy of the XenAPI.py in the Python site-packages folder. ...
saltstack/salt
salt/modules/mac_service.py
_name_in_services
python
def _name_in_services(name, services): ''' Checks to see if the given service is in the given services. :param str name: Service label, file name, or full path :param dict services: The currently available services. :return: The service information for the service, otherwise an empty dictiona...
Checks to see if the given service is in the given services. :param str name: Service label, file name, or full path :param dict services: The currently available services. :return: The service information for the service, otherwise an empty dictionary :rtype: dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L76-L102
null
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
_get_service
python
def _get_service(name): ''' Get information about a service. If the service is not found, raise an error :param str name: Service label, file name, or full path :return: The service information for the service, otherwise an Error :rtype: dict ''' services = __utils__['mac_utils.availa...
Get information about a service. If the service is not found, raise an error :param str name: Service label, file name, or full path :return: The service information for the service, otherwise an Error :rtype: dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L105-L145
[ "def _name_in_services(name, services):\n '''\n Checks to see if the given service is in the given services.\n\n :param str name: Service label, file name, or full path\n\n :param dict services: The currently available services.\n\n :return: The service information for the service, otherwise\n an ...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
_always_running_service
python
def _always_running_service(name): ''' Check if the service should always be running based on the KeepAlive Key in the service plist. :param str name: Service label, file name, or full path :return: True if the KeepAlive key is set to True, False if set to False or not set in the plist at ...
Check if the service should always be running based on the KeepAlive Key in the service plist. :param str name: Service label, file name, or full path :return: True if the KeepAlive key is set to True, False if set to False or not set in the plist at all. :rtype: bool .. versionadded:: 2...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L148-L185
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def show(name):\n '''\n Show properties of a launchctl service\n\n :param str name: Service label, file name, or full path\n\n :return: The service information if the service is found\n :rtype: dict\n\n CLI Example:\n\n .. code-block...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
_get_domain_target
python
def _get_domain_target(name, service_target=False): ''' Returns the domain/service target and path for a service. This is used to determine whether or not a service should be loaded in a user space or system space. :param str name: Service label, file name, or full path :param bool service_tar...
Returns the domain/service target and path for a service. This is used to determine whether or not a service should be loaded in a user space or system space. :param str name: Service label, file name, or full path :param bool service_target: Whether to return a full service target. This is needed...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L188-L226
[ "def _get_service(name):\n '''\n Get information about a service. If the service is not found, raise an\n error\n\n :param str name: Service label, file name, or full path\n\n :return: The service information for the service, otherwise an Error\n :rtype: dict\n '''\n services = __utils__['m...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
list_
python
def list_(name=None, runas=None): ''' Run launchctl list and return the output :param str name: The name of the service to list :param str runas: User to run launchctl commands :return: If a name is passed returns information about the named service, otherwise returns a list of all servic...
Run launchctl list and return the output :param str name: The name of the service to list :param str runas: User to run launchctl commands :return: If a name is passed returns information about the named service, otherwise returns a list of all services and pids :rtype: str CLI Example: ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L298-L336
[ "def _get_service(name):\n '''\n Get information about a service. If the service is not found, raise an\n error\n\n :param str name: Service label, file name, or full path\n\n :return: The service information for the service, otherwise an Error\n :rtype: dict\n '''\n services = __utils__['m...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
enable
python
def enable(name, runas=None): ''' Enable a launchd service. Raises an error if the service fails to be enabled :param str name: Service label, file name, or full path :param str runas: User to run launchctl commands :return: ``True`` if successful or if the service is already enabled :rtype: ...
Enable a launchd service. Raises an error if the service fails to be enabled :param str name: Service label, file name, or full path :param str runas: User to run launchctl commands :return: ``True`` if successful or if the service is already enabled :rtype: bool CLI Example: .. code-block:...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L339-L360
[ "def launchctl(sub_cmd, *args, **kwargs):\n '''\n Run a launchctl command and raise an error if it fails\n\n :param str sub_cmd: Sub command supplied to launchctl\n\n :param tuple args: Tuple containing additional arguments to pass to\n launchctl\n\n :param dict kwargs: Dictionary containing a...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
disable
python
def disable(name, runas=None): ''' Disable a launchd service. Raises an error if the service fails to be disabled :param str name: Service label, file name, or full path :param str runas: User to run launchctl commands :return: ``True`` if successful or if the service is already disabled ...
Disable a launchd service. Raises an error if the service fails to be disabled :param str name: Service label, file name, or full path :param str runas: User to run launchctl commands :return: ``True`` if successful or if the service is already disabled :rtype: bool CLI Example: .. code...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L363-L385
[ "def launchctl(sub_cmd, *args, **kwargs):\n '''\n Run a launchctl command and raise an error if it fails\n\n :param str sub_cmd: Sub command supplied to launchctl\n\n :param tuple args: Tuple containing additional arguments to pass to\n launchctl\n\n :param dict kwargs: Dictionary containing a...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
start
python
def start(name, runas=None): ''' Start a launchd service. Raises an error if the service fails to start .. note:: To start a service in macOS the service must be enabled first. Use ``service.enable`` to enable the service. :param str name: Service label, file name, or full path :...
Start a launchd service. Raises an error if the service fails to start .. note:: To start a service in macOS the service must be enabled first. Use ``service.enable`` to enable the service. :param str name: Service label, file name, or full path :param str runas: User to run launchctl co...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L388-L413
[ "def launchctl(sub_cmd, *args, **kwargs):\n '''\n Run a launchctl command and raise an error if it fails\n\n :param str sub_cmd: Sub command supplied to launchctl\n\n :param tuple args: Tuple containing additional arguments to pass to\n launchctl\n\n :param dict kwargs: Dictionary containing a...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
stop
python
def stop(name, runas=None): ''' Stop a launchd service. Raises an error if the service fails to stop .. note:: Though ``service.stop`` will unload a service in macOS, the service will start on next boot unless it is disabled. Use ``service.disable`` to disable the service :par...
Stop a launchd service. Raises an error if the service fails to stop .. note:: Though ``service.stop`` will unload a service in macOS, the service will start on next boot unless it is disabled. Use ``service.disable`` to disable the service :param str name: Service label, file name, o...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L416-L442
[ "def launchctl(sub_cmd, *args, **kwargs):\n '''\n Run a launchctl command and raise an error if it fails\n\n :param str sub_cmd: Sub command supplied to launchctl\n\n :param tuple args: Tuple containing additional arguments to pass to\n launchctl\n\n :param dict kwargs: Dictionary containing a...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
restart
python
def restart(name, runas=None): ''' Unloads and reloads a launchd service. Raises an error if the service fails to reload :param str name: Service label, file name, or full path :param str runas: User to run launchctl commands :return: ``True`` if successful :rtype: bool CLI Example:...
Unloads and reloads a launchd service. Raises an error if the service fails to reload :param str name: Service label, file name, or full path :param str runas: User to run launchctl commands :return: ``True`` if successful :rtype: bool CLI Example: .. code-block:: bash salt '*...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L445-L468
[ "def start(name, runas=None):\n '''\n Start a launchd service. Raises an error if the service fails to start\n\n .. note::\n To start a service in macOS the service must be enabled first. Use\n ``service.enable`` to enable the service.\n\n :param str name: Service label, file name, or ful...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...
saltstack/salt
salt/modules/mac_service.py
status
python
def status(name, sig=None, runas=None): ''' Return the status for a service. :param str name: Used to find the service from launchctl. Can be any part of the service name or a regex expression. :param str sig: Find the service with status.pid instead. Note that ``name`` must still be...
Return the status for a service. :param str name: Used to find the service from launchctl. Can be any part of the service name or a regex expression. :param str sig: Find the service with status.pid instead. Note that ``name`` must still be provided. :param str runas: User to run launch...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L471-L527
[ "def enabled(name, runas=None):\n '''\n Check if the specified service is enabled\n\n :param str name: The name of the service to look up\n\n :param str runas: User to run launchctl commands\n\n :return: True if the specified service enabled, otherwise False\n :rtype: bool\n\n CLI Example:\n\n ...
# -*- coding: utf-8 -*- ''' The service module for macOS .. versionadded:: 2016.3.0 This module has support for services in the following locations. .. code-block:: bash /System/Library/LaunchDaemons/ /System/Library/LaunchAgents/ /Library/LaunchDaemons/ /Library/LaunchAgents/ # As of version "...