repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
saltstack/salt
salt/returners/redis_return.py
get_jids
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...
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...
[ "def", "get_jids", "(", ")", ":", "serv", "=", "_get_serv", "(", "ret", "=", "None", ")", "ret", "=", "{", "}", "for", "s", "in", "serv", ".", "mget", "(", "serv", ".", "keys", "(", "'load:*'", ")", ")", ":", "if", "s", "is", "None", ":", "co...
Return a dict mapping all job ids to job information
[ "Return", "a", "dict", "mapping", "all", "job", "ids", "to", "job", "information" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/redis_return.py#L277-L289
train
saltstack/salt
salt/returners/redis_return.py
clean_old_jobs
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...
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...
[ "def", "clean_old_jobs", "(", ")", ":", "serv", "=", "_get_serv", "(", "ret", "=", "None", ")", "ret_jids", "=", "serv", ".", "keys", "(", "'ret:*'", ")", "living_jids", "=", "set", "(", "serv", ".", "keys", "(", "'load:*'", ")", ")", "to_remove", "=...
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.
[ "Clean", "out", "minions", "s", "return", "data", "for", "old", "jobs", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/redis_return.py#L300-L319
train
saltstack/salt
salt/cli/api.py
SaltAPI.prepare
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']: ...
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']: ...
[ "def", "prepare", "(", "self", ")", ":", "super", "(", "SaltAPI", ",", "self", ")", ".", "prepare", "(", ")", "try", ":", "if", "self", ".", "config", "[", "'verify_env'", "]", ":", "logfile", "=", "self", ".", "config", "[", "'log_file'", "]", "if...
Run the preparation sequence required to start a salt-api daemon. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare()
[ "Run", "the", "preparation", "sequence", "required", "to", "start", "a", "salt", "-", "api", "daemon", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/api.py#L28-L56
train
saltstack/salt
salt/cli/api.py
SaltAPI.start
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']): ...
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']): ...
[ "def", "start", "(", "self", ")", ":", "super", "(", "SaltAPI", ",", "self", ")", ".", "start", "(", ")", "if", "check_user", "(", "self", ".", "config", "[", "'user'", "]", ")", ":", "log", ".", "info", "(", "'The salt-api is starting up'", ")", "se...
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()`.
[ "Start", "the", "actual", "master", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/api.py#L58-L71
train
saltstack/salt
salt/cli/api.py
SaltAPI.shutdown
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: ...
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: ...
[ "def", "shutdown", "(", "self", ",", "exitcode", "=", "0", ",", "exitmsg", "=", "None", ")", ":", "log", ".", "info", "(", "'The salt-api is shutting down..'", ")", "msg", "=", "'The salt-api is shutdown. '", "if", "exitmsg", "is", "not", "None", ":", "exitm...
If sub-classed, run any shutdown operations on this method.
[ "If", "sub", "-", "classed", "run", "any", "shutdown", "operations", "on", "this", "method", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/api.py#L73-L83
train
saltstack/salt
salt/states/zookeeper.py
present
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...
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...
[ "def", "present", "(", "name", ",", "value", ",", "acls", "=", "None", ",", "ephemeral", "=", "False", ",", "sequence", "=", "False", ",", "makepath", "=", "False", ",", "version", "=", "-", "1", ",", "profile", "=", "None", ",", "hosts", "=", "Non...
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...
[ "Make", "sure", "znode", "is", "present", "in", "the", "correct", "state", "with", "the", "correct", "acls" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zookeeper.py#L47-L200
train
saltstack/salt
salt/states/zookeeper.py
absent
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) ...
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) ...
[ "def", "absent", "(", "name", ",", "version", "=", "-", "1", ",", "recursive", "=", "False", ",", "profile", "=", "None", ",", "hosts", "=", "None", ",", "scheme", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "defau...
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...
[ "Make", "sure", "znode", "is", "absent" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zookeeper.py#L203-L276
train
saltstack/salt
salt/states/zookeeper.py
acls
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...
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...
[ "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 Default: -1 (always match) profile Configured Zookeeper profile to authenticate with (Default: None) hosts ...
[ "Update", "acls", "on", "a", "znode" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/zookeeper.py#L279-L362
train
saltstack/salt
salt/modules/timezone.py
_timedatectl
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
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
[ "def", "_timedatectl", "(", ")", ":", "ret", "=", "__salt__", "[", "'cmd.run_all'", "]", "(", "[", "'timedatectl'", "]", ",", "python_shell", "=", "False", ")", "if", "ret", "[", "'retcode'", "]", "!=", "0", ":", "msg", "=", "'timedatectl failed: {0}'", ...
get the output of timedatectl
[ "get", "the", "output", "of", "timedatectl" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L46-L56
train
saltstack/salt
salt/modules/timezone.py
_get_adjtime_timezone
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'):...
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'):...
[ "def", "_get_adjtime_timezone", "(", ")", ":", "adjtime_file", "=", "'/etc/adjtime'", "if", "os", ".", "path", ".", "exists", "(", "adjtime_file", ")", ":", "cmd", "=", "[", "'tail'", ",", "'-n'", ",", "'1'", ",", "adjtime_file", "]", "return", "__salt__",...
Return the timezone in /etc/adjtime of the system clock
[ "Return", "the", "timezone", "in", "/", "etc", "/", "adjtime", "of", "the", "system", "clock" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L70-L84
train
saltstack/salt
salt/modules/timezone.py
get_zone
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 ...
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 ...
[ "def", "get_zone", "(", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'timedatectl'", ")", ":", "ret", "=", "_timedatectl", "(", ")", "for", "line", "in", "(", "x", ".", "strip", "(", ")", "for", "x", "in", "salt", ".", ...
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", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L161-L207
train
saltstack/salt
salt/modules/timezone.py
get_offset
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...
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...
[ "def", "get_offset", "(", ")", ":", "if", "'AIX'", "not", "in", "__grains__", "[", "'os_family'", "]", ":", "return", "__salt__", "[", "'cmd.run'", "]", "(", "[", "'date'", ",", "'+%z'", "]", ",", "python_shell", "=", "False", ")", "salt_path", "=", "'...
Get current numeric timezone offset from UCT (i.e. -0700) CLI Example: .. code-block:: bash salt '*' timezone.get_offset
[ "Get", "current", "numeric", "timezone", "offset", "from", "UCT", "(", "i", ".", "e", ".", "-", "0700", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L223-L241
train
saltstack/salt
salt/modules/timezone.py
set_zone
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...
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...
[ "def", "set_zone", "(", "timezone", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'timedatectl'", ")", ":", "try", ":", "__salt__", "[", "'cmd.run'", "]", "(", "'timedatectl set-timezone {0}'", ".", "format", "(", "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 manually! CLI Example: ...
[ "Unlinks", "then", "symlinks", "/", "etc", "/", "localtime", "to", "the", "set", "timezone", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L244-L317
train
saltstack/salt
salt/modules/timezone.py
zone_compare
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...
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...
[ "def", "zone_compare", "(", "timezone", ")", ":", "if", "'Solaris'", "in", "__grains__", "[", "'os_family'", "]", "or", "'AIX'", "in", "__grains__", "[", "'os_family'", "]", ":", "return", "timezone", "==", "get_zone", "(", ")", "if", "'FreeBSD'", "in", "_...
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...
[ "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",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L320-L365
train
saltstack/salt
salt/modules/timezone.py
get_hwclock
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()): ...
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()): ...
[ "def", "get_hwclock", "(", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'timedatectl'", ")", ":", "ret", "=", "_timedatectl", "(", ")", "for", "line", "in", "(", "x", ".", "strip", "(", ")", "for", "x", "in", "ret", "[",...
Get current hardware clock setting (UTC or localtime) CLI Example: .. code-block:: bash salt '*' timezone.get_hwclock
[ "Get", "current", "hardware", "clock", "setting", "(", "UTC", "or", "localtime", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L378-L488
train
saltstack/salt
salt/modules/timezone.py
set_hwclock
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...
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...
[ "def", "set_hwclock", "(", "clock", ")", ":", "if", "salt", ".", "utils", ".", "path", ".", "which", "(", "'timedatectl'", ")", ":", "cmd", "=", "[", "'timedatectl'", ",", "'set-local-rtc'", ",", "'true'", "if", "clock", "==", "'localtime'", "else", "'fa...
Sets the hardware clock to be either UTC or localtime CLI Example: .. code-block:: bash salt '*' timezone.set_hwclock UTC
[ "Sets", "the", "hardware", "clock", "to", "be", "either", "UTC", "or", "localtime" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/timezone.py#L491-L563
train
saltstack/salt
salt/states/chocolatey.py
installed
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): ...
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): ...
[ "def", "installed", "(", "name", ",", "version", "=", "None", ",", "source", "=", "None", ",", "force", "=", "False", ",", "pre_versions", "=", "False", ",", "install_args", "=", "None", ",", "override_args", "=", "False", ",", "force_x86", "=", "False",...
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 ...
[ "Installs", "a", "package", "if", "not", "already", "installed" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/chocolatey.py#L30-L199
train
saltstack/salt
salt/states/chocolatey.py
uninstalled
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...
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...
[ "def", "uninstalled", "(", "name", ",", "version", "=", "None", ",", "uninstall_args", "=", "None", ",", "override_args", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", "...
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...
[ "Uninstalls", "a", "package" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/chocolatey.py#L202-L278
train
saltstack/salt
salt/utils/job.py
store_job
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...
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...
[ "def", "store_job", "(", "opts", ",", "load", ",", "event", "=", "None", ",", "mminion", "=", "None", ")", ":", "# Generate EndTime", "endtime", "=", "salt", ".", "utils", ".", "jid", ".", "jid_to_time", "(", "salt", ".", "utils", ".", "jid", ".", "g...
Store job information using the configured master_job_cache
[ "Store", "job", "information", "using", "the", "configured", "master_job_cache" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/job.py#L19-L116
train
saltstack/salt
salt/utils/job.py
store_minions
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...
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...
[ "def", "store_minions", "(", "opts", ",", "jid", ",", "minions", ",", "mminion", "=", "None", ",", "syndic_id", "=", "None", ")", ":", "if", "mminion", "is", "None", ":", "mminion", "=", "salt", ".", "minion", ".", "MasterMinion", "(", "opts", ",", "...
Store additional minions matched on lower-level masters using the configured master_job_cache
[ "Store", "additional", "minions", "matched", "on", "lower", "-", "level", "masters", "using", "the", "configured", "master_job_cache" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/job.py#L119-L136
train
saltstack/salt
salt/utils/job.py
get_retcode
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: ...
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: ...
[ "def", "get_retcode", "(", "ret", ")", ":", "retcode", "=", "0", "# if there is a dict with retcode, use that", "if", "isinstance", "(", "ret", ",", "dict", ")", "and", "ret", ".", "get", "(", "'retcode'", ",", "0", ")", "!=", "0", ":", "return", "ret", ...
Determine a retcode for a given return
[ "Determine", "a", "retcode", "for", "a", "given", "return" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/job.py#L139-L150
train
saltstack/salt
salt/beacons/aix_account.py
beacon
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...
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...
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "user", "=", "config", "[", "'user'", "]", "locked_accounts", "=", "__salt__", "[", "'shadow.login_failures'", "]", "(", "user", ")", "ret", ".", "append", "(", "{", "'accounts'", ":", "lo...
Checks for locked accounts due to too many invalid login attempts, 3 or higher. .. code-block:: yaml beacons: aix_account: user: ALL interval: 120
[ "Checks", "for", "locked", "accounts", "due", "to", "too", "many", "invalid", "login", "attempts", "3", "or", "higher", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/aix_account.py#L43-L63
train
saltstack/salt
salt/modules/opsgenie.py
post_data
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...
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...
[ "def", "post_data", "(", "api_key", "=", "None", ",", "name", "=", "'OpsGenie Execution Module'", ",", "reason", "=", "None", ",", "action_type", "=", "None", ")", ":", "if", "api_key", "is", "None", "or", "reason", "is", "None", ":", "raise", "salt", "....
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!"}' ...
[ "Post", "data", "to", "OpsGenie", ".", "It", "s", "designed", "for", "Salt", "s", "Event", "Reactor", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/opsgenie.py#L37-L109
train
saltstack/salt
salt/states/macpackage.py
installed
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...
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...
[ "def", "installed", "(", "name", ",", "target", "=", "\"LocalSystem\"", ",", "dmg", "=", "False", ",", "store", "=", "False", ",", "app", "=", "False", ",", "mpkg", "=", "False", ",", "user", "=", "None", ",", "onlyif", "=", "None", ",", "unless", ...
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? ...
[ "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" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/macpackage.py#L49-L245
train
saltstack/salt
salt/states/macpackage.py
_mod_run_check
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...
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...
[ "def", "_mod_run_check", "(", "cmd_kwargs", ",", "onlyif", ",", "unless", ")", ":", "if", "onlyif", ":", "if", "__salt__", "[", "'cmd.retcode'", "]", "(", "onlyif", ",", "*", "*", "cmd_kwargs", ")", "!=", "0", ":", "return", "{", "'comment'", ":", "'on...
Execute the onlyif and unless logic. Return a result dict if: * onlyif failed (onlyif != 0) * unless succeeded (unless == 0) else return True
[ "Execute", "the", "onlyif", "and", "unless", "logic", ".", "Return", "a", "result", "dict", "if", ":", "*", "onlyif", "failed", "(", "onlyif", "!", "=", "0", ")", "*", "unless", "succeeded", "(", "unless", "==", "0", ")", "else", "return", "True" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/macpackage.py#L248-L269
train
saltstack/salt
salt/modules/rest_service.py
status
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*``) ...
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*``) ...
[ "def", "status", "(", "name", ",", "sig", "=", "None", ")", ":", "proxy_fn", "=", "'rest_sample.service_status'", "contains_globbing", "=", "bool", "(", "re", ".", "search", "(", "r'\\*|\\?|\\[.+\\]'", ",", "name", ")", ")", "if", "contains_globbing", ":", "...
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...
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/rest_service.py#L128-L169
train
saltstack/salt
salt/utils/schedule.py
clean_proc_dir
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...
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...
[ "def", "clean_proc_dir", "(", "opts", ")", ":", "for", "basefilename", "in", "os", ".", "listdir", "(", "salt", ".", "minion", ".", "get_proc_dir", "(", "opts", "[", "'cachedir'", "]", ")", ")", ":", "fn_", "=", "os", ".", "path", ".", "join", "(", ...
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
[ "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", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L1693-L1733
train
saltstack/salt
salt/utils/schedule.py
Schedule.option
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, {})
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, {})
[ "def", "option", "(", "self", ",", "opt", ")", ":", "if", "'config.merge'", "in", "self", ".", "functions", ":", "return", "self", ".", "functions", "[", "'config.merge'", "]", "(", "opt", ",", "{", "}", ",", "omit_master", "=", "True", ")", "return", ...
Return options merged from config and pillar
[ "Return", "options", "merged", "from", "config", "and", "pillar" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L165-L171
train
saltstack/salt
salt/utils/schedule.py
Schedule._get_schedule
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'...
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'...
[ "def", "_get_schedule", "(", "self", ",", "include_opts", "=", "True", ",", "include_pillar", "=", "True", ",", "remove_hidden", "=", "False", ")", ":", "schedule", "=", "{", "}", "if", "include_pillar", ":", "pillar_schedule", "=", "self", ".", "opts", "....
Return the schedule data structure
[ "Return", "the", "schedule", "data", "structure" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L173-L199
train
saltstack/salt
salt/utils/schedule.py
Schedule._check_max_running
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...
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...
[ "def", "_check_max_running", "(", "self", ",", "func", ",", "data", ",", "opts", ",", "now", ")", ":", "# 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 Fal...
Return the schedule data structure
[ "Return", "the", "schedule", "data", "structure" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L201-L246
train
saltstack/salt
salt/utils/schedule.py
Schedule.persist
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']) ...
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']) ...
[ "def", "persist", "(", "self", ")", ":", "config_dir", "=", "self", ".", "opts", ".", "get", "(", "'conf_dir'", ",", "None", ")", "if", "config_dir", "is", "None", "and", "'conf_file'", "in", "self", ".", "opts", ":", "config_dir", "=", "os", ".", "p...
Persist the modified schedule into <<configdir>>/<<default_include>>/_schedule.conf
[ "Persist", "the", "modified", "schedule", "into", "<<configdir", ">>", "/", "<<default_include", ">>", "/", "_schedule", ".", "conf" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L248-L281
train
saltstack/salt
salt/utils/schedule.py
Schedule.delete_job
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...
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...
[ "def", "delete_job", "(", "self", ",", "name", ",", "persist", "=", "True", ")", ":", "# ensure job exists, then delete it", "if", "name", "in", "self", ".", "opts", "[", "'schedule'", "]", ":", "del", "self", ".", "opts", "[", "'schedule'", "]", "[", "n...
Deletes a job from the scheduler. Ignore jobs from pillar
[ "Deletes", "a", "job", "from", "the", "scheduler", ".", "Ignore", "jobs", "from", "pillar" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L283-L304
train
saltstack/salt
salt/utils/schedule.py
Schedule.reset
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'] = {}
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'] = {}
[ "def", "reset", "(", "self", ")", ":", "self", ".", "skip_function", "=", "None", "self", ".", "skip_during_range", "=", "None", "self", ".", "enabled", "=", "True", "self", ".", "splay", "=", "None", "self", ".", "opts", "[", "'schedule'", "]", "=", ...
Reset the scheduler to defaults
[ "Reset", "the", "scheduler", "to", "defaults" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L306-L314
train
saltstack/salt
salt/utils/schedule.py
Schedule.delete_job_prefix
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...
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...
[ "def", "delete_job_prefix", "(", "self", ",", "name", ",", "persist", "=", "True", ")", ":", "# ensure job exists, then delete it", "for", "job", "in", "list", "(", "self", ".", "opts", "[", "'schedule'", "]", ".", "keys", "(", ")", ")", ":", "if", "job"...
Deletes a job from the scheduler. Ignores jobs from pillar
[ "Deletes", "a", "job", "from", "the", "scheduler", ".", "Ignores", "jobs", "from", "pillar" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L316-L340
train
saltstack/salt
salt/utils/schedule.py
Schedule.add_job
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...
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...
[ "def", "add_job", "(", "self", ",", "data", ",", "persist", "=", "True", ")", ":", "# we don't do any checking here besides making sure its a dict.", "# eval() already does for us and raises errors accordingly", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":...
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.
[ "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", "-", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L342-L382
train
saltstack/salt
salt/utils/schedule.py
Schedule.modify_job
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...
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...
[ "def", "modify_job", "(", "self", ",", "name", ",", "schedule", ",", "persist", "=", "True", ")", ":", "# ensure job exists, then replace it", "if", "name", "in", "self", ".", "opts", "[", "'schedule'", "]", ":", "self", ".", "delete_job", "(", "name", ","...
Modify a job in the scheduler. Ignores jobs from pillar
[ "Modify", "a", "job", "in", "the", "scheduler", ".", "Ignores", "jobs", "from", "pillar" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L424-L438
train
saltstack/salt
salt/utils/schedule.py
Schedule.run_job
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'] ...
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'] ...
[ "def", "run_job", "(", "self", ",", "name", ")", ":", "data", "=", "self", ".", "_get_schedule", "(", ")", ".", "get", "(", "name", ",", "{", "}", ")", "if", "'function'", "in", "data", ":", "func", "=", "data", "[", "'function'", "]", "elif", "'...
Run a schedule job now
[ "Run", "a", "schedule", "job", "now" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L440-L470
train
saltstack/salt
salt/utils/schedule.py
Schedule.enable_schedule
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'...
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'...
[ "def", "enable_schedule", "(", "self", ")", ":", "self", ".", "opts", "[", "'schedule'", "]", "[", "'enabled'", "]", "=", "True", "# Fire the complete event back along with updated list of schedule", "evt", "=", "salt", ".", "utils", ".", "event", ".", "get_event"...
Enable the scheduler.
[ "Enable", "the", "scheduler", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L472-L481
train
saltstack/salt
salt/utils/schedule.py
Schedule.reload
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...
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...
[ "def", "reload", "(", "self", ",", "schedule", ")", ":", "# Remove all jobs from self.intervals", "self", ".", "intervals", "=", "{", "}", "if", "'schedule'", "in", "schedule", ":", "schedule", "=", "schedule", "[", "'schedule'", "]", "self", ".", "opts", "....
Reload the schedule from saved schedule file.
[ "Reload", "the", "schedule", "from", "saved", "schedule", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L494-L503
train
saltstack/salt
salt/utils/schedule.py
Schedule.list
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_...
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_...
[ "def", "list", "(", "self", ",", "where", ")", ":", "if", "where", "==", "'pillar'", ":", "schedule", "=", "self", ".", "_get_schedule", "(", "include_opts", "=", "False", ")", "elif", "where", "==", "'opts'", ":", "schedule", "=", "self", ".", "_get_s...
List the current schedule items
[ "List", "the", "current", "schedule", "items" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L505-L519
train
saltstack/salt
salt/utils/schedule.py
Schedule.save_schedule
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}, ...
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}, ...
[ "def", "save_schedule", "(", "self", ")", ":", "self", ".", "persist", "(", ")", "# Fire the complete event back along with the list of schedule", "evt", "=", "salt", ".", "utils", ".", "event", ".", "get_event", "(", "'minion'", ",", "opts", "=", "self", ".", ...
Save the current schedule
[ "Save", "the", "current", "schedule" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L521-L530
train
saltstack/salt
salt/utils/schedule.py
Schedule.skip_job
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']...
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']...
[ "def", "skip_job", "(", "self", ",", "name", ",", "data", ")", ":", "time", "=", "data", "[", "'time'", "]", "time_fmt", "=", "data", ".", "get", "(", "'time_fmt'", ",", "'%Y-%m-%dT%H:%M:%S'", ")", "# ensure job exists, then disable it", "if", "name", "in", ...
Skip a job at a specific time in the scheduler. Ignores jobs from pillar
[ "Skip", "a", "job", "at", "a", "specific", "time", "in", "the", "scheduler", ".", "Ignores", "jobs", "from", "pillar" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L562-L584
train
saltstack/salt
salt/utils/schedule.py
Schedule.get_next_fire_time
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) ...
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) ...
[ "def", "get_next_fire_time", "(", "self", ",", "name", ",", "fmt", "=", "'%Y-%m-%dT%H:%M:%S'", ")", ":", "schedule", "=", "self", ".", "_get_schedule", "(", ")", "_next_fire_time", "=", "None", "if", "schedule", ":", "_next_fire_time", "=", "schedule", ".", ...
Return the next fire time for the specified job
[ "Return", "the", "next", "fire", "time", "for", "the", "specified", "job" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L586-L601
train
saltstack/salt
salt/utils/schedule.py
Schedule.handle_func
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 ...
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 ...
[ "def", "handle_func", "(", "self", ",", "multiprocessing_enabled", ",", "func", ",", "data", ")", ":", "if", "salt", ".", "utils", ".", "platform", ".", "is_windows", "(", ")", "or", "self", ".", "opts", ".", "get", "(", "'transport'", ")", "==", "'zer...
Execute this method in a multiprocess or thread
[ "Execute", "this", "method", "in", "a", "multiprocess", "or", "thread" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L611-L851
train
saltstack/salt
salt/utils/schedule.py
Schedule.eval
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...
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...
[ "def", "eval", "(", "self", ",", "now", "=", "None", ")", ":", "log", ".", "trace", "(", "'==== evaluating schedule now %s ====='", ",", "now", ")", "loop_interval", "=", "self", ".", "opts", "[", "'loop_interval'", "]", "if", "not", "isinstance", "(", "lo...
Evaluate and execute the schedule :param datetime now: Override current time with a datetime object instance``
[ "Evaluate", "and", "execute", "the", "schedule" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schedule.py#L853-L1637
train
saltstack/salt
salt/modules/aws_sqs.py
_run_aws
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...
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...
[ "def", "_run_aws", "(", "cmd", ",", "region", ",", "opts", ",", "user", ",", "*", "*", "kwargs", ")", ":", "# These args need a specific key value that aren't", "# valid python parameter keys", "receipthandle", "=", "kwargs", ".", "pop", "(", "'receipthandle'", ",",...
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
[ "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", "argumen...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L34-L68
train
saltstack/salt
salt/modules/aws_sqs.py
receive_message
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...
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...
[ "def", "receive_message", "(", "queue", ",", "region", ",", "num", "=", "1", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "ret", "=", "{", "'Messages'", ":", "None", ",", "}", "queues", "=", "list_queues", "(", "region", ",", "opts...
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...
[ "Receive", "one", "or", "more", "messages", "from", "a", "queue", "in", "a", "region" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L71-L112
train
saltstack/salt
salt/modules/aws_sqs.py
delete_message
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...
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...
[ "def", "delete_message", "(", "queue", ",", "region", ",", "receipthandle", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "queues", "=", "list_queues", "(", "region", ",", "opts", ",", "user", ")", "url_map", "=", "_parse_queue_list", "("...
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...
[ "Delete", "one", "or", "more", "messages", "from", "a", "queue", "in", "a", "region" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L115-L152
train
saltstack/salt
salt/modules/aws_sqs.py
list_queues
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: ...
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: ...
[ "def", "list_queues", "(", "region", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "out", "=", "_run_aws", "(", "'list-queues'", ",", "region", ",", "opts", ",", "user", ")", "ret", "=", "{", "'retcode'", ":", "0", ",", "'stdout'", ...
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>
[ "List", "the", "queues", "in", "the", "selected", "region", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L155-L179
train
saltstack/salt
salt/modules/aws_sqs.py
create_queue
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...
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...
[ "def", "create_queue", "(", "name", ",", "region", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "create", "=", "{", "'queue-name'", ":", "name", "}", "out", "=", "_run_aws", "(", "'create-queue'", ",", "region", "=", "region", ",", "...
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: ...
[ "Creates", "a", "queue", "with", "the", "correct", "name", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L182-L214
train
saltstack/salt
salt/modules/aws_sqs.py
delete_queue
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...
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...
[ "def", "delete_queue", "(", "name", ",", "region", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "queues", "=", "list_queues", "(", "region", ",", "opts", ",", "user", ")", "url_map", "=", "_parse_queue_list", "(", "queues", ")", "log",...
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: ...
[ "Deletes", "a", "queue", "in", "the", "region", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L217-L264
train
saltstack/salt
salt/modules/aws_sqs.py
queue_exists
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 ...
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 ...
[ "def", "queue_exists", "(", "name", ",", "region", ",", "opts", "=", "None", ",", "user", "=", "None", ")", ":", "output", "=", "list_queues", "(", "region", ",", "opts", ",", "user", ")", "return", "name", "in", "_parse_queue_list", "(", "output", ")"...
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...
[ "Returns", "True", "or", "False", "on", "whether", "the", "queue", "exists", "in", "the", "region" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L267-L290
train
saltstack/salt
salt/modules/aws_sqs.py
_parse_queue_list
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
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
[ "def", "_parse_queue_list", "(", "list_output", ")", ":", "queues", "=", "dict", "(", "(", "q", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", ",", "q", ")", "for", "q", "in", "list_output", "[", "'stdout'", "]", ")", "return", "queues" ]
Parse the queue to get a dict of name -> URL
[ "Parse", "the", "queue", "to", "get", "a", "dict", "of", "name", "-", ">", "URL" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aws_sqs.py#L293-L298
train
saltstack/salt
salt/cloud/clouds/xen.py
_get_session
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 =...
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 =...
[ "def", "_get_session", "(", ")", ":", "api_version", "=", "'1.0'", "originator", "=", "'salt_cloud_{}_driver'", ".", "format", "(", "__virtualname__", ")", "url", "=", "config", ".", "get_cloud_config_value", "(", "'url'", ",", "get_configured_provider", "(", ")",...
Get a connection to the XenServer host
[ "Get", "a", "connection", "to", "the", "XenServer", "host" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L131-L181
train
saltstack/salt
salt/cloud/clouds/xen.py
list_nodes
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...
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...
[ "def", "list_nodes", "(", ")", ":", "session", "=", "_get_session", "(", ")", "vms", "=", "session", ".", "xenapi", ".", "VM", ".", "get_all_records", "(", ")", "ret", "=", "{", "}", "for", "vm", "in", "vms", ":", "record", "=", "session", ".", "xe...
List virtual machines .. code-block:: bash salt-cloud -Q
[ "List", "virtual", "machines" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L184-L214
train
saltstack/salt
salt/cloud/clouds/xen.py
get_vm_ip
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...
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...
[ "def", "get_vm_ip", "(", "name", "=", "None", ",", "session", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'This function must be called with -a or --action.'", ")", "if", "session",...
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
[ "Get", "the", "IP", "address", "of", "the", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L217-L260
train
saltstack/salt
salt/cloud/clouds/xen.py
set_vm_ip
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...
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...
[ "def", "set_vm_ip", "(", "name", "=", "None", ",", "ipv4_cidr", "=", "None", ",", "ipv4_gw", "=", "None", ",", "session", "=", "None", ",", "call", "=", "None", ")", ":", "mode", "=", "'static'", "# TODO: Need to add support for IPv6", "if", "call", "==", ...
Set the IP address on a virtual interface (vif)
[ "Set", "the", "IP", "address", "on", "a", "virtual", "interface", "(", "vif", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L263-L302
train
saltstack/salt
salt/cloud/clouds/xen.py
list_nodes_full
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) ...
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) ...
[ "def", "list_nodes_full", "(", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "ret", "=", "{", "}", "vms", "=", "session", ".", "xenapi", ".", "VM", ".", "get_all", "(", ")", "for", "...
List full virtual machines .. code-block:: bash salt-cloud -F
[ "List", "full", "virtual", "machines" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L305-L351
train
saltstack/salt
salt/cloud/clouds/xen.py
vdi_list
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 ...
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 ...
[ "def", "vdi_list", "(", "call", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudException", "(", "'This function must be called with -f or --function.'", ")", "log", ".", "debug", "(", "'kwargs is %s'", ...
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" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L370-L411
train
saltstack/salt
salt/cloud/clouds/xen.py
template_list
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...
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...
[ "def", "template_list", "(", "call", "=", "None", ")", ":", "templates", "=", "{", "}", "session", "=", "_get_session", "(", ")", "vms", "=", "session", ".", "xenapi", ".", "VM", ".", "get_all", "(", ")", "for", "vm", "in", "vms", ":", "record", "=...
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
[ "Return", "available", "Xen", "template", "information", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L447-L466
train
saltstack/salt
salt/cloud/clouds/xen.py
show_instance
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...
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...
[ "def", "show_instance", "(", "name", ",", "session", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The show_instnce function must be called with -a or --action.'", ")", "log", ".", "de...
Show information about a specific VM or template .. code-block:: bash salt-cloud -a show_instance xenvm01 .. note:: memory is memory_dynamic_max
[ "Show", "information", "about", "a", "specific", "VM", "or", "template" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L469-L511
train
saltstack/salt
salt/cloud/clouds/xen.py
_determine_resource_pool
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: ...
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: ...
[ "def", "_determine_resource_pool", "(", "session", ",", "vm_", ")", ":", "resource_pool", "=", "''", "if", "'resource_pool'", "in", "vm_", ".", "keys", "(", ")", ":", "resource_pool", "=", "_get_pool", "(", "vm_", "[", "'resource_pool'", "]", ",", "session",...
Called by create() used to determine resource pool
[ "Called", "by", "create", "()", "used", "to", "determine", "resource", "pool" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L514-L530
train
saltstack/salt
salt/cloud/clouds/xen.py
_determine_storage_repo
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...
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...
[ "def", "_determine_storage_repo", "(", "session", ",", "resource_pool", ",", "vm_", ")", ":", "storage_repo", "=", "''", "if", "'storage_repo'", "in", "vm_", ".", "keys", "(", ")", ":", "storage_repo", "=", "_get_sr", "(", "vm_", "[", "'storage_repo'", "]", ...
Called by create() used to determine storage repo for create
[ "Called", "by", "create", "()", "used", "to", "determine", "storage", "repo", "for", "create" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L533-L550
train
saltstack/salt
salt/cloud/clouds/xen.py
create
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']( ...
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']( ...
[ "def", "create", "(", "vm_", ")", ":", "name", "=", "vm_", "[", "'name'", "]", "record", "=", "{", "}", "ret", "=", "{", "}", "# fire creating event", "__utils__", "[", "'cloud.fire_event'", "]", "(", "'event'", ",", "'starting create'", ",", "'salt/cloud/...
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
[ "Create", "a", "VM", "in", "Xen" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L553-L661
train
saltstack/salt
salt/cloud/clouds/xen.py
_deploy_salt_minion
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') ...
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') ...
[ "def", "_deploy_salt_minion", "(", "name", ",", "session", ",", "vm_", ")", ":", "# Get bootstrap values", "vm_", "[", "'ssh_host'", "]", "=", "get_vm_ip", "(", "name", ",", "session", ")", "vm_", "[", "'user'", "]", "=", "vm_", ".", "get", "(", "'user'"...
Deploy salt minion during create()
[ "Deploy", "salt", "minion", "during", "create", "()" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L664-L678
train
saltstack/salt
salt/cloud/clouds/xen.py
_set_static_ip
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 ...
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 ...
[ "def", "_set_static_ip", "(", "name", ",", "session", ",", "vm_", ")", ":", "ipv4_cidr", "=", "''", "ipv4_gw", "=", "''", "if", "'ipv4_gw'", "in", "vm_", ".", "keys", "(", ")", ":", "log", ".", "debug", "(", "'ipv4_gw is found in keys'", ")", "ipv4_gw", ...
Set static IP during create() if defined
[ "Set", "static", "IP", "during", "create", "()", "if", "defined" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L681-L694
train
saltstack/salt
salt/cloud/clouds/xen.py
_wait_for_ip
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'...
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'...
[ "def", "_wait_for_ip", "(", "name", ",", "session", ")", ":", "start_time", "=", "datetime", ".", "now", "(", ")", "status", "=", "None", "while", "status", "is", "None", ":", "status", "=", "get_vm_ip", "(", "name", ",", "session", ")", "if", "status"...
Wait for IP to be available during create()
[ "Wait", "for", "IP", "to", "be", "available", "during", "create", "()" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L697-L718
train
saltstack/salt
salt/cloud/clouds/xen.py
_run_async_task
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...
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...
[ "def", "_run_async_task", "(", "task", "=", "None", ",", "session", "=", "None", ")", ":", "if", "task", "is", "None", "or", "session", "is", "None", ":", "return", "None", "task_name", "=", "session", ".", "xenapi", ".", "task", ".", "get_name_label", ...
Run XenAPI task in asynchronous mode to prevent timeouts
[ "Run", "XenAPI", "task", "in", "asynchronous", "mode", "to", "prevent", "timeouts" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L721-L734
train
saltstack/salt
salt/cloud/clouds/xen.py
_clone_vm
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 ...
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 ...
[ "def", "_clone_vm", "(", "image", "=", "None", ",", "name", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "log", ".", "debug", "(", "'Creating VM %s by cloning %s'", ",",...
Create VM by cloning This is faster and should be used if source and target are in the same storage repository
[ "Create", "VM", "by", "cloning" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L737-L750
train
saltstack/salt
salt/cloud/clouds/xen.py
_copy_vm
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 ...
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 ...
[ "def", "_copy_vm", "(", "template", "=", "None", ",", "name", "=", "None", ",", "session", "=", "None", ",", "sr", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "log", ".", "debug", "(", "'Crea...
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" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L753-L770
train
saltstack/salt
salt/cloud/clouds/xen.py
_provision_vm
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)
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)
[ "def", "_provision_vm", "(", "name", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "log", ".", "info", "(", "'Provisioning VM %s'", ",", "name", ")", "vm", "=", "_get_v...
Provision vm right after clone/copy
[ "Provision", "vm", "right", "after", "clone", "/", "copy" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L773-L782
train
saltstack/salt
salt/cloud/clouds/xen.py
unpause
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: ...
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: ...
[ "def", "unpause", "(", "name", ",", "call", "=", "None", ",", "session", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The show_instnce function must be called with -a or --action.'", ")", "if", "session", "is"...
UnPause a vm .. code-block:: bash salt-cloud -a unpause xenvm01
[ "UnPause", "a", "vm" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L829-L848
train
saltstack/salt
salt/cloud/clouds/xen.py
resume
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:...
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:...
[ "def", "resume", "(", "name", ",", "call", "=", "None", ",", "session", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The show_instnce function must be called with -a or --action.'", ")", "if", "session", "is",...
Resume a vm from disk .. code-block:: bash salt-cloud -a resume xenvm01
[ "Resume", "a", "vm", "from", "disk" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L873-L892
train
saltstack/salt
salt/cloud/clouds/xen.py
stop
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...
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...
[ "def", "stop", "(", "name", ",", "call", "=", "None", ",", "session", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The show_instnce function must be called with -a or --action.'", ")", "return", "shutdown", "(...
Stop a vm .. code-block:: bash salt-cloud -a stop xenvm01
[ "Stop", "a", "vm" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L895-L909
train
saltstack/salt
salt/cloud/clouds/xen.py
reboot
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...
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...
[ "def", "reboot", "(", "name", ",", "call", "=", "None", ",", "session", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'The show_instnce function must be called with -a or --action.'", ")", "if", "session", "is",...
Reboot a vm .. code-block:: bash salt-cloud -a reboot xenvm01
[ "Reboot", "a", "vm" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L934-L957
train
saltstack/salt
salt/cloud/clouds/xen.py
_get_vm
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
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
[ "def", "_get_vm", "(", "name", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "vms", "=", "session", ".", "xenapi", ".", "VM", ".", "get_by_name_label", "(", "name", "...
Get XEN vm instance object reference
[ "Get", "XEN", "vm", "instance", "object", "reference" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L960-L969
train
saltstack/salt
salt/cloud/clouds/xen.py
_get_sr
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
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
[ "def", "_get_sr", "(", "name", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "srs", "=", "session", ".", "xenapi", ".", "SR", ".", "get_by_name_label", "(", "name", "...
Get XEN sr (storage repo) object reference
[ "Get", "XEN", "sr", "(", "storage", "repo", ")", "object", "reference" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L972-L981
train
saltstack/salt
salt/cloud/clouds/xen.py
_get_pool
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...
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...
[ "def", "_get_pool", "(", "name", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "pools", "=", "session", ".", "xenapi", ".", "pool", ".", "get_all", "(", ")", "for", ...
Get XEN resource pool object reference
[ "Get", "XEN", "resource", "pool", "object", "reference" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L984-L995
train
saltstack/salt
salt/cloud/clouds/xen.py
destroy
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.' ) ...
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.' ) ...
[ "def", "destroy", "(", "name", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The destroy action must be called with -d, --destroy, '", "'-a or --action.'", ")", "ret", "=", "{", "}", ...
Destroy Xen VM or template instance .. code-block:: bash salt-cloud -d xenvm01
[ "Destroy", "Xen", "VM", "or", "template", "instance" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L998-L1053
train
saltstack/salt
salt/cloud/clouds/xen.py
sr_list
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...
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...
[ "def", "sr_list", "(", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'This function must be called with -f, --function argument.'", ")", "ret", "=", "{", "}", "session", "=", "_get_session", "(", ")", ...
Geta list of storage repositories .. code-block:: bash salt-cloud -f sr_list myxen
[ "Geta", "list", "of", "storage", "repositories" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1056-L1075
train
saltstack/salt
salt/cloud/clouds/xen.py
host_list
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(...
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(...
[ "def", "host_list", "(", "call", "=", "None", ")", ":", "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
[ "Get", "a", "list", "of", "Xen", "Servers" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1078-L1096
train
saltstack/salt
salt/cloud/clouds/xen.py
pool_list
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...
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...
[ "def", "pool_list", "(", "call", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'This function must be called with -f, --function argument.'", ")", "ret", "=", "{", "}", "session", "=", "_get_session", "(", ")", ...
Get a list of Resource Pools .. code-block:: bash salt-cloud -f pool_list myxen
[ "Get", "a", "list", "of", "Resource", "Pools" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1099-L1118
train
saltstack/salt
salt/cloud/clouds/xen.py
pif_list
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...
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...
[ "def", "pif_list", "(", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'This function must be called with -f, --function argument.'", ")", "ret", "=", "{", "}", "session", "=", "_get_session", "(", ")", ...
Get a list of Resource Pools .. code-block:: bash salt-cloud -f pool_list myxen
[ "Get", "a", "list", "of", "Resource", "Pools" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1121-L1139
train
saltstack/salt
salt/cloud/clouds/xen.py
vif_list
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...
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...
[ "def", "vif_list", "(", "name", ",", "call", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'This function must be called with -a, --action argument.'", ")", "if", "name", "is", "No...
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
[ "Get", "a", "list", "of", "virtual", "network", "interfaces", "on", "a", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1142-L1171
train
saltstack/salt
salt/cloud/clouds/xen.py
vbd_list
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...
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...
[ "def", "vbd_list", "(", "name", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'This function must be called with -a, --action argument.'", ")", "if", "name", "is", "None", ":", "retu...
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
[ "Get", "a", "list", "of", "VBDs", "on", "a", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1174-L1205
train
saltstack/salt
salt/cloud/clouds/xen.py
destroy_vm_vdis
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(...
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(...
[ "def", "destroy_vm_vdis", "(", "name", "=", "None", ",", "session", "=", "None", ",", "call", "=", "None", ")", ":", "if", "session", "is", "None", ":", "session", "=", "_get_session", "(", ")", "ret", "=", "{", "}", "# get vm object", "vms", "=", "s...
Get virtual block devices on VM .. code-block:: bash salt-cloud -a destroy_vm_vdis xenvm01
[ "Get", "virtual", "block", "devices", "on", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1227-L1256
train
saltstack/salt
salt/cloud/clouds/xen.py
destroy_template
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...
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...
[ "def", "destroy_template", "(", "name", "=", "None", ",", "call", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "call", "==", "'action'", ":", "raise", "SaltCloudSystemExit", "(", "'The destroy_template function must be called with -f.'", ")", "if", ...
Destroy Xen VM or template instance .. code-block:: bash salt-cloud -f destroy_template myxen name=testvm2
[ "Destroy", "Xen", "VM", "or", "template", "instance" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1259-L1289
train
saltstack/salt
salt/cloud/clouds/xen.py
get_pv_args
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...
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...
[ "def", "get_pv_args", "(", "name", ",", "session", "=", "None", ",", "call", "=", "None", ")", ":", "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
[ "Get", "PV", "arguments", "for", "a", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1292-L1312
train
saltstack/salt
salt/cloud/clouds/xen.py
set_pv_args
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...
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...
[ "def", "set_pv_args", "(", "name", ",", "kwargs", "=", "None", ",", "session", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "==", "'function'", ":", "raise", "SaltCloudException", "(", "'This function must be called with -a or --action.'", ")",...
Set PV arguments for a VM .. code-block:: bash salt-cloud -a set_pv_args xenvm01 pv_args="utf-8 graphical"
[ "Set", "PV", "arguments", "for", "a", "VM" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/xen.py#L1315-L1341
train
saltstack/salt
salt/modules/mac_service.py
_name_in_services
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...
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...
[ "def", "_name_in_services", "(", "name", ",", "services", ")", ":", "if", "name", "in", "services", ":", "# Match on label", "return", "services", "[", "name", "]", "for", "service", "in", "six", ".", "itervalues", "(", "services", ")", ":", "if", "service...
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
[ "Checks", "to", "see", "if", "the", "given", "service", "is", "in", "the", "given", "services", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L76-L102
train
saltstack/salt
salt/modules/mac_service.py
_get_service
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...
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...
[ "def", "_get_service", "(", "name", ")", ":", "services", "=", "__utils__", "[", "'mac_utils.available_services'", "]", "(", ")", "name", "=", "name", ".", "lower", "(", ")", "service", "=", "_name_in_services", "(", "name", ",", "services", ")", "# if we wo...
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
[ "Get", "information", "about", "a", "service", ".", "If", "the", "service", "is", "not", "found", "raise", "an", "error" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L105-L145
train
saltstack/salt
salt/modules/mac_service.py
_always_running_service
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 ...
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 ...
[ "def", "_always_running_service", "(", "name", ")", ":", "# get all the info from the launchctl service", "service_info", "=", "show", "(", "name", ")", "# get the value for the KeepAlive key in service plist", "try", ":", "keep_alive", "=", "service_info", "[", "'plist'", ...
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...
[ "Check", "if", "the", "service", "should", "always", "be", "running", "based", "on", "the", "KeepAlive", "Key", "in", "the", "service", "plist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L148-L185
train
saltstack/salt
salt/modules/mac_service.py
_get_domain_target
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...
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...
[ "def", "_get_domain_target", "(", "name", ",", "service_target", "=", "False", ")", ":", "# Get service information", "service", "=", "_get_service", "(", "name", ")", "# get the path to the service", "path", "=", "service", "[", "'file_path'", "]", "# most of the tim...
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...
[ "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...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L188-L226
train
saltstack/salt
salt/modules/mac_service.py
list_
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...
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...
[ "def", "list_", "(", "name", "=", "None", ",", "runas", "=", "None", ")", ":", "if", "name", ":", "# Get service information and label", "service", "=", "_get_service", "(", "name", ")", "label", "=", "service", "[", "'plist'", "]", "[", "'Label'", "]", ...
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: ...
[ "Run", "launchctl", "list", "and", "return", "the", "output" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L298-L336
train
saltstack/salt
salt/modules/mac_service.py
enable
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: ...
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: ...
[ "def", "enable", "(", "name", ",", "runas", "=", "None", ")", ":", "# Get the domain target. enable requires a full <service-target>", "service_target", "=", "_get_domain_target", "(", "name", ",", "service_target", "=", "True", ")", "[", "0", "]", "# Enable the servi...
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:...
[ "Enable", "a", "launchd", "service", ".", "Raises", "an", "error", "if", "the", "service", "fails", "to", "be", "enabled" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L339-L360
train
saltstack/salt
salt/modules/mac_service.py
disable
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 ...
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 ...
[ "def", "disable", "(", "name", ",", "runas", "=", "None", ")", ":", "# Get the service target. enable requires a full <service-target>", "service_target", "=", "_get_domain_target", "(", "name", ",", "service_target", "=", "True", ")", "[", "0", "]", "# disable the se...
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...
[ "Disable", "a", "launchd", "service", ".", "Raises", "an", "error", "if", "the", "service", "fails", "to", "be", "disabled" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L363-L385
train
saltstack/salt
salt/modules/mac_service.py
start
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 :...
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 :...
[ "def", "start", "(", "name", ",", "runas", "=", "None", ")", ":", "# Get the domain target.", "domain_target", ",", "path", "=", "_get_domain_target", "(", "name", ")", "# Load (bootstrap) the service: will raise an error if it fails", "return", "launchctl", "(", "'boot...
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...
[ "Start", "a", "launchd", "service", ".", "Raises", "an", "error", "if", "the", "service", "fails", "to", "start" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L388-L413
train
saltstack/salt
salt/modules/mac_service.py
stop
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...
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...
[ "def", "stop", "(", "name", ",", "runas", "=", "None", ")", ":", "# Get the domain target.", "domain_target", ",", "path", "=", "_get_domain_target", "(", "name", ")", "# Stop (bootout) the service: will raise an error if it fails", "return", "launchctl", "(", "'bootout...
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...
[ "Stop", "a", "launchd", "service", ".", "Raises", "an", "error", "if", "the", "service", "fails", "to", "stop" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L416-L442
train
saltstack/salt
salt/modules/mac_service.py
restart
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:...
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:...
[ "def", "restart", "(", "name", ",", "runas", "=", "None", ")", ":", "# Restart the service: will raise an error if it fails", "if", "enabled", "(", "name", ")", ":", "stop", "(", "name", ",", "runas", "=", "runas", ")", "start", "(", "name", ",", "runas", ...
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 '*...
[ "Unloads", "and", "reloads", "a", "launchd", "service", ".", "Raises", "an", "error", "if", "the", "service", "fails", "to", "reload" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L445-L468
train
saltstack/salt
salt/modules/mac_service.py
status
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...
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...
[ "def", "status", "(", "name", ",", "sig", "=", "None", ",", "runas", "=", "None", ")", ":", "# Find service with ps", "if", "sig", ":", "return", "__salt__", "[", "'status.pid'", "]", "(", "sig", ")", "try", ":", "_get_service", "(", "name", ")", "exce...
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...
[ "Return", "the", "status", "for", "a", "service", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mac_service.py#L471-L527
train