text stringlengths 81 112k |
|---|
Disable the named service to start at boot
CLI Example:
.. code-block:: bash
salt '*' service.disable <service name>
def disable(name, **kwargs):
'''
Disable the named service to start at boot
CLI Example:
.. code-block:: bash
salt '*' service.disable <service name>
''... |
get connection args
def _get_kwargs(profile=None, **connection_args):
'''
get connection args
'''
if profile:
prefix = profile + ":keystone."
else:
prefix = "keystone."
def get(key, default=None):
'''
look in connection_args first, then default to config file
... |
Returns the API version derived from endpoint's response.
CLI Example:
.. code-block:: bash
salt '*' keystone.api_version
def api_version(profile=None, **connection_args):
'''
Returns the API version derived from endpoint's response.
CLI Example:
.. code-block:: bash
salt ... |
Set up keystone credentials. Only intended to be used within Keystone-enabled modules.
CLI Example:
.. code-block:: bash
salt '*' keystone.auth
def auth(profile=None, **connection_args):
'''
Set up keystone credentials. Only intended to be used within Keystone-enabled modules.
CLI Examp... |
Create EC2-compatible credentials for user per tenant
CLI Examples:
.. code-block:: bash
salt '*' keystone.ec2_credentials_create name=admin tenant=admin
salt '*' keystone.ec2_credentials_create \
user_id=c965f79c4f864eaaa9c3b41904e67082 \
tenant_id=722787eb540849158668370dc6... |
Delete EC2-compatible credentials
CLI Examples:
.. code-block:: bash
salt '*' keystone.ec2_credentials_delete \
860f8c2c38ca4fab989f9bc56a061a64 access_key=5f66d2f24f604b8bb9cd28886106f442
salt '*' keystone.ec2_credentials_delete name=admin \
access_key=5f66d2f24f604b8bb9cd28... |
Return ec2_credentials for a user (keystone ec2-credentials-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.ec2_credentials_get c965f79c4f864eaaa9c3b41904e67082 access=722787eb540849158668370
salt '*' keystone.ec2_credentials_get user_id=c965f79c4f864eaaa9c3b41904e67082 access=72278... |
Return a list of ec2_credentials for a specific user (keystone ec2-credentials-list)
CLI Examples:
.. code-block:: bash
salt '*' keystone.ec2_credentials_list 298ce377245c4ec9b70e1c639c89e654
salt '*' keystone.ec2_credentials_list user_id=298ce377245c4ec9b70e1c639c89e654
salt '*' keys... |
Return a specific endpoint (keystone endpoint-get)
CLI Example:
.. code-block:: bash
salt 'v2' keystone.endpoint_get nova [region=RegionOne]
salt 'v3' keystone.endpoint_get nova interface=admin [region=RegionOne]
def endpoint_get(service, region=None, profile=None, interface=None, **connect... |
Return a list of available endpoints (keystone endpoints-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.endpoint_list
def endpoint_list(profile=None, **connection_args):
'''
Return a list of available endpoints (keystone endpoints-list)
CLI Example:
.. code-block:: bash
... |
Create an endpoint for an Openstack service
CLI Examples:
.. code-block:: bash
salt 'v2' keystone.endpoint_create nova 'http://public/url' 'http://internal/url' 'http://adminurl/url' region
salt 'v3' keystone.endpoint_create nova url='http://public/url' interface='public' region='RegionOne'
... |
Delete endpoints of an Openstack service
CLI Examples:
.. code-block:: bash
salt 'v2' keystone.endpoint_delete nova [region=RegionOne]
salt 'v3' keystone.endpoint_delete nova interface=admin [region=RegionOne]
def endpoint_delete(service, region=None, profile=None, interface=None, **connect... |
Create a named role.
CLI Example:
.. code-block:: bash
salt '*' keystone.role_create admin
def role_create(name, profile=None, **connection_args):
'''
Create a named role.
CLI Example:
.. code-block:: bash
salt '*' keystone.role_create admin
'''
kstone = auth(prof... |
Delete a role (keystone role-delete)
CLI Examples:
.. code-block:: bash
salt '*' keystone.role_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.role_delete role_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.role_delete name=admin
def role_delete(role_id=None, name=N... |
Return a specific roles (keystone role-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.role_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.role_get role_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.role_get name=nova
def role_get(role_id=None, name=None, pr... |
Return a list of available roles (keystone role-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.role_list
def role_list(profile=None, **connection_args):
'''
Return a list of available roles (keystone role-list)
CLI Example:
.. code-block:: bash
salt '*' keystone... |
Add service to Keystone service catalog
CLI Examples:
.. code-block:: bash
salt '*' keystone.service_create nova compute \
'OpenStack Compute Service'
def service_create(name, service_type, description=None, profile=None,
**connection_args):
'''
Add service to Keystone ser... |
Delete a service from Keystone service catalog
CLI Examples:
.. code-block:: bash
salt '*' keystone.service_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.service_delete name=nova
def service_delete(service_id=None, name=None, profile=None, **connection_args):
'''
Delete a... |
Return a specific services (keystone service-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.service_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.service_get service_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.service_get name=nova
def service_get(servic... |
Return a list of available services (keystone services-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.service_list
def service_list(profile=None, **connection_args):
'''
Return a list of available services (keystone services-list)
CLI Example:
.. code-block:: bash
... |
Create a keystone tenant
CLI Examples:
.. code-block:: bash
salt '*' keystone.tenant_create nova description='nova tenant'
salt '*' keystone.tenant_create test enabled=False
def tenant_create(name, description=None, enabled=True, profile=None,
**connection_args):
'''
... |
Delete a tenant (keystone tenant-delete)
CLI Examples:
.. code-block:: bash
salt '*' keystone.tenant_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.tenant_delete tenant_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.tenant_delete name=demo
def tenant_delete(tenant_i... |
Delete a project (keystone project-delete).
Overrides keystone tenant-delete form api V2. For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project id.
name
The project name.
profile
Configuration profile - if configuration for multiple openstack accoun... |
Return a specific tenants (keystone tenant-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.tenant_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.tenant_get tenant_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.tenant_get name=nova
def tenant_get(tenant_id=Non... |
Return a specific projects (keystone project-get)
Overrides keystone tenant-get form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project id.
name
The project name.
profile
Configuration profile - if configuration for multiple openstack... |
Return a list of available tenants (keystone tenants-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.tenant_list
def tenant_list(profile=None, **connection_args):
'''
Return a list of available tenants (keystone tenants-list)
CLI Example:
.. code-block:: bash
sal... |
Return a list of available projects (keystone projects-list).
Overrides keystone tenants-list form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
profile
Configuration profile - if configuration for multiple openstack accounts required.
CLI Example:
.. code-block:: bas... |
Update a tenant's information (keystone tenant-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
CLI Examples:
.. code-block:: bash
salt '*' keystone.tenant_update name=admin enabled=True
salt '*' keystone.tenant_update c9... |
Update a tenant's information (keystone project-update)
The following fields may be updated: name, description, enabled.
Can only update name if targeting by ID
Overrides keystone tenant_update form api V2.
For keystone api V3 only.
.. versionadded:: 2016.11.0
project_id
The project i... |
Return the configured tokens (keystone token-get)
CLI Example:
.. code-block:: bash
salt '*' keystone.token_get c965f79c4f864eaaa9c3b41904e67082
def token_get(profile=None, **connection_args):
'''
Return the configured tokens (keystone token-get)
CLI Example:
.. code-block:: bash
... |
Return a list of available users (keystone user-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.user_list
def user_list(profile=None, **connection_args):
'''
Return a list of available users (keystone user-list)
CLI Example:
.. code-block:: bash
salt '*' keystone... |
Return a specific users (keystone user-get)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_get c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_get user_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_get name=nova
def user_get(user_id=None, name=None, pr... |
Create a user (keystone user-create)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_create name=jack password=zero email=jack@halloweentown.org \
tenant_id=a28a7b5a999a455f84b1f5210264375e enabled=True
def user_create(name, password, email, tenant_id=None,
enabled=... |
Delete a user (keystone user-delete)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_delete c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_delete user_id=c965f79c4f864eaaa9c3b41904e67082
salt '*' keystone.user_delete name=nova
def user_delete(user_id=None, name=Non... |
Update a user's information (keystone user-update)
The following fields may be updated: name, email, enabled, tenant.
Because the name is one of the fields, a valid user id is required.
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_update user_id=c965f79c4f864eaaa9c3b41904e67082 n... |
Verify a user's password
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_verify_password name=test password=foobar
salt '*' keystone.user_verify_password user_id=c965f79c4f864eaaa9c3b41904e67082 password=foobar
def user_verify_password(user_id=None, name=None, password=None,
... |
Update a user's password (keystone user-password-update)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_password_update c965f79c4f864eaaa9c3b41904e67082 password=12345
salt '*' keystone.user_password_update user_id=c965f79c4f864eaaa9c3b41904e67082 password=12345
salt '*' ke... |
Add role for user in tenant (keystone user-role-add)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_role_add \
user_id=298ce377245c4ec9b70e1c639c89e654 \
tenant_id=7167a092ece84bae8cead4bf9d15bb3b \
role_id=ce377245c4ec9b70e1c639c89e8cead4
salt '*' keystone.user_role_add user=admin... |
Return a list of available user_roles (keystone user-roles-list)
CLI Examples:
.. code-block:: bash
salt '*' keystone.user_role_list \
user_id=298ce377245c4ec9b70e1c639c89e654 \
tenant_id=7167a092ece84bae8cead4bf9d15bb3b
salt '*' keystone.user_role_list user_name=admin tenant_name=admin
def ... |
Template for writing list functions
Return a list of available items (keystone items-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.item_list
def _item_list(profile=None, **connection_args):
'''
Template for writing list functions
Return a list of available items (keystone... |
:return: Path to the .ssh/config file - usually <home>/.ssh/config
def _get_ssh_config_file(opts):
'''
:return: Path to the .ssh/config file - usually <home>/.ssh/config
'''
ssh_config_file = opts.get('ssh_config_file')
if not os.path.isfile(ssh_config_file):
raise IOError('Cannot find SSH ... |
Parses lines from the SSH config to create roster targets.
:param lines: Individual lines from the ssh config file
:return: Dictionary of targets in similar style to the flat roster
def parse_ssh_config(lines):
'''
Parses lines from the SSH config to create roster targets.
:param lines: Individua... |
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
def targets(tgt, tgt_type='glob', **kwargs):
'''
Return the targets from the flat yaml file, checks opts for location but
defaults to /etc/salt/roster
'''
ssh_config_file = _get_ssh_config_file... |
Return minions that match via glob
def ret_glob_minions(self):
'''
Return minions that match via glob
'''
minions = {}
for minion in self.raw:
if fnmatch.fnmatch(minion, self.tgt):
data = self.get_data(minion)
if data:
... |
Return the configured ip
def get_data(self, minion):
'''
Return the configured ip
'''
if isinstance(self.raw[minion], six.string_types):
return {'host': self.raw[minion]}
if isinstance(self.raw[minion], dict):
return self.raw[minion]
return False |
Pack this exception into a serializable dictionary that is safe for
transport via msgpack
def pack(self):
'''
Pack this exception into a serializable dictionary that is safe for
transport via msgpack
'''
if six.PY3:
return {'message': six.text_type(self), 'ar... |
Try to reactivate the expired domain name
Returns the following information:
- Whether or not the domain was reactivated successfully
- The amount charged for reactivation
- The order ID
- The transaction ID
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.re... |
Try to renew the specified expiring domain name for a specified number of years
domain_name
The domain name to be renewed
years
Number of years to renew
Returns the following information:
- Whether or not the domain was renewed successfully
- The domain ID
- The order ID
... |
Try to register the specified domain name
domain_name
The domain name to be registered
years
Number of years to register
Returns the following information:
- Whether or not the domain was renewed successfully
- Whether or not WhoisGuard is enabled
- Whether or not registratio... |
Checks the availability of domains
domains_to_check
array of strings List of domains to check
Returns a dictionary mapping the each domain name to a boolean denoting
whether or not it is available.
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.check domai... |
Returns information about the requested domain
returns a dictionary of information about the domain_name
domain_name
string Domain name to get information about
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_info my-domain-name
def get_info(domain_name):
... |
Returns a list of TLDs as objects
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_tld_list
def get_tld_list():
'''
Returns a list of TLDs as objects
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_tld_list
'''
resp... |
Returns a list of domains for the particular user as a list of objects
offset by ``page`` length of ``page_size``
list_type : ALL
One of ``ALL``, ``EXPIRING``, ``EXPIRED``
search_term
Keyword to look for on the domain list
page : 1
Number of result page to return
page_siz... |
Obtain the Pillar data from **reclass** for the given ``minion_id``.
def ext_pillar(minion_id, pillar, **kwargs):
'''
Obtain the Pillar data from **reclass** for the given ``minion_id``.
'''
# If reclass is installed, __virtual__ put it onto the search path, so we
# don't need to protect against I... |
Assign status data to a dict.
def _set_status(m,
comment=INVALID_RESPONSE,
status=False,
out=None):
'''
Assign status data to a dict.
'''
m['out'] = out
m['status'] = status
m['logs'] = LOG.messages[:]
m['logs_by_level'] = LOG.by_level.copy()
... |
Return invalid status.
def _invalid(m, comment=INVALID_RESPONSE, out=None):
'''
Return invalid status.
'''
return _set_status(m, status=False, comment=comment, out=out) |
Return valid status.
def _valid(m, comment=VALID_RESPONSE, out=None):
'''
Return valid status.
'''
return _set_status(m, status=True, comment=comment, out=out) |
Run a command.
output
return output if true
directory
directory to execute in
runas
user used to run buildout as
env
environment variables to set when running
exitcode
fails if cmd does not return this exit code
(set to None to disable check)
... |
Find all buildout configs in a subdirectory.
only buildout.cfg and etc/buildout.cfg are valid in::
path
directory where to start to search
cfg
a optional list to append to
.
├── buildout.cfg
├── etc
│ └── buildout.cfg
├── foo
... |
Get the current bootstrap.py script content
def _get_bootstrap_content(directory='.'):
'''
Get the current bootstrap.py script content
'''
try:
with salt.utils.files.fopen(os.path.join(
os.path.abspath(directory),
'bootstrap.py')) ... |
Check for buildout versions.
In any cases, check for a version pinning
Also check for buildout.dumppickedversions which is buildout1 specific
Also check for the version targeted by the local bootstrap file
Take as default buildout2
directory
directory to execute in
def _get_buildout_ver(d... |
Get the most appropriate download URL for the bootstrap script.
directory
directory to execute in
def _get_bootstrap_url(directory):
'''
Get the most appropriate download URL for the bootstrap script.
directory
directory to execute in
'''
v = _get_buildout_ver(directory)
... |
Upgrade current bootstrap.py with the last released one.
Indeed, when we first run a buildout, a common source of problem
is to have a locally stale bootstrap, we just try to grab a new copy
directory
directory to execute in
offline
are we executing buildout in offline mode
build... |
Run the buildout bootstrap dance (python bootstrap.py).
directory
directory to execute in
config
alternative buildout configuration file to use
runas
User used to run buildout as
env
environment variables to set when running
buildout_ver
force a specific ... |
Run a buildout in a directory.
directory
directory to execute in
config
alternative buildout configuration file to use
offline
are we executing buildout in offline mode
runas
user used to run buildout as
env
environment variables to set when running
... |
Run buildout in a directory.
directory
directory to execute in
config
buildout config to use
parts
specific buildout parts to run
runas
user used to run buildout as
env
environment variables to set when running
buildout_ver
force a specific b... |
Execute queries against SQLite3, merge and return as a dict
def ext_pillar(minion_id,
pillar,
*args,
**kwargs):
'''
Execute queries against SQLite3, merge and return as a dict
'''
return SQLite3ExtPillar().fetch(minion_id, pillar, *args, **kwargs) |
Read pillar data from HTTP response.
:param str url: Url to request.
:param bool with_grains: Whether to substitute strings in the url with their grain values.
:return: A dictionary of the pillar data to add.
:rtype: dict
def ext_pillar(minion_id,
pillar, # pylint: disable=W0613
... |
Verify user password.
username
Username on which to perform password check
password
Password to check
encrypted
Whether or not the password is encrypted
Default: False
.. code-block: bash
salt '*' nxos.cmd check_password username=admin password=admin
... |
NOTE: This function is preserved for backwards compatibilty. This allows
commands to be executed using either of the following syntactic forms.
salt '*' nxos.cmd <function>
or
salt '*' nxos.<function>
command
function from `salt.modules.nxos` to run
args
positional args to ... |
Get roles assigned to a username.
.. code-block: bash
salt '*' nxos.cmd get_roles username=admin
def get_roles(username, **kwargs):
'''
Get roles assigned to a username.
.. code-block: bash
salt '*' nxos.cmd get_roles username=admin
'''
user = get_user(username)
if not u... |
Get username line from switch.
.. code-block: bash
salt '*' nxos.cmd get_user username=admin
def get_user(username, **kwargs):
'''
Get username line from switch.
.. code-block: bash
salt '*' nxos.cmd get_user username=admin
'''
command = 'show run | include "^username {0} pa... |
Get grains for minion.
.. code-block: bash
salt '*' nxos.cmd grains
def grains(**kwargs):
'''
Get grains for minion.
.. code-block: bash
salt '*' nxos.cmd grains
'''
if not DEVICE_DETAILS['grains_cache']:
ret = salt.utils.nxos.system_info(show_ver(**kwargs))
... |
Send arbitray commands to the NX-OS device.
command
The command to be sent.
method:
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to the device.
Defaults to ``cli_show_ascii`... |
Execute one or more show (non-configuration) commands.
commands
The commands to be executed.
raw_text: ``True``
Whether to return raw text or structured data.
NOTE: raw_text option is ignored for SSH proxy minion. Data is
returned unstructured.
CLI Example:
.. code-b... |
Shortcut to run `show version` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_ver
def show_ver(**kwargs):
'''
Shortcut to run `show version` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_ver
'''
command = 'show version'
info = ''
... |
Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run
def show_run(**kwargs):
'''
Shortcut to run `show running-config` on the NX-OS device.
.. code-block:: bash
salt '*' nxos.cmd show_run
'''
command = 'show running-confi... |
Configures the Nexus switch with the specified commands.
This method is used to send configuration commands to the switch. It
will take either a string or a list and prepend the necessary commands
to put the session into config mode.
.. warning::
All the commands will be applied directly to ... |
Delete one or more config lines to the switch running config.
lines
Configuration lines to remove.
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block:: bash... |
Set users password on switch.
username
Username to configure
password
Password to configure for username
encrypted
Whether or not to encrypt the password
Default: False
role
Configure role for the username
Default: None
crypt_salt
Configur... |
Assign role to username.
username
Username for role configuration
role
Configure role for username
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code... |
Remove role from username.
username
Username for role removal
role
Role to remove
no_save_config
If True, don't save configuration commands to startup configuration.
If False, save configuration to startup configuration.
Default: False
.. code-block:: bash
... |
Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH.
def _configure_device(commands, **kwargs):
'''
Helper function to send configuration commands to the device over a
proxy minion or native minion using NX-API or SSH.
'''
if sal... |
Helper function to send configuration commands using NX-API.
def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
'''
Helper function to send configuration commands using NX-API.
'''
api_kwargs = __salt__['config.get']('nxos', {})
api_kwargs.update(**kwargs)
if not isinstanc... |
Helper function to send exec and config requests over NX-API.
commands
The exec or config commands to be sent.
method: ``cli_show``
``cli_show_ascii``: Return raw test or unstructured output.
``cli_show``: Return structured output.
``cli_conf``: Send configuration commands to t... |
Returns the data compressed at gzip level compression.
def compress(data, compresslevel=9):
'''
Returns the data compressed at gzip level compression.
'''
buf = BytesIO()
with open_fileobj(buf, 'wb', compresslevel) as ogz:
if six.PY3 and not isinstance(data, bytes):
data = data.... |
Generator that reads chunk_size bytes at a time from a file/filehandle and
yields the compressed result of each read.
.. note::
Each chunk is compressed separately. They cannot be stitched together
to form a compressed file. This function is designed to break up a file
into compressed c... |
Relocate an absolute path to a new root directory.
def _root(path, root):
'''
Relocate an absolute path to a new root directory.
'''
if root:
return os.path.join(root, os.path.relpath(path, os.path.sep))
else:
return path |
Build a canonical unit name treating unit names without one
of the valid suffixes as a service.
def _canonical_unit_name(name):
'''
Build a canonical unit name treating unit names without one
of the valid suffixes as a service.
'''
if not isinstance(name, six.string_types):
name = six.t... |
Returns boolean telling whether or not the named service is available
def _check_available(name):
'''
Returns boolean telling whether or not the named service is available
'''
_status = _systemctl_status(name)
sd_version = salt.utils.systemd.version(__context__)
if sd_version is not None and sd... |
Check for modified/updated unit files, and run a daemon-reload if any are
found.
def _check_for_unit_changes(name):
'''
Check for modified/updated unit files, and run a daemon-reload if any are
found.
'''
contextkey = 'systemd._check_for_unit_changes.{0}'.format(name)
if contextkey not in _... |
Common code for conditionally removing masks before making changes to a
service's state.
def _check_unmask(name, unmask, unmask_runtime, root=None):
'''
Common code for conditionally removing masks before making changes to a
service's state.
'''
if unmask:
unmask_(name, runtime=False, r... |
Remove context
def _clear_context():
'''
Remove context
'''
# Using list() here because modifying a dictionary during iteration will
# raise a RuntimeError.
for key in list(__context__):
try:
if key.startswith('systemd._systemctl_status.'):
__context__.pop(ke... |
Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be overridden with entries
in /etc/inittab, or via the kernel command-line at boot
def _default_runlevel():
'''
Try to figure out the default runlevel. It is kept in
/etc/init/rc-sysinit.conf, but can be over... |
Use os.listdir() to get all the unit files
def _get_systemd_services(root):
'''
Use os.listdir() to get all the unit files
'''
ret = set()
for path in SYSTEM_CONFIG_PATHS + (LOCAL_CONFIG_PATH,):
# Make sure user has access to the path, and if the path is a
# link it's likely that an... |
Use os.listdir() and os.access() to get all the initscripts
def _get_sysv_services(root, systemd_services=None):
'''
Use os.listdir() and os.access() to get all the initscripts
'''
initscript_path = _root(INITSCRIPT_PATH, root)
try:
sysv_services = os.listdir(initscript_path)
except OSE... |
Returns the path to the sysv service manager (either update-rc.d or
chkconfig)
def _get_service_exec():
'''
Returns the path to the sysv service manager (either update-rc.d or
chkconfig)
'''
contextkey = 'systemd._get_service_exec'
if contextkey not in __context__:
executables = ('u... |
Return the current runlevel
def _runlevel():
'''
Return the current runlevel
'''
contextkey = 'systemd._runlevel'
if contextkey in __context__:
return __context__[contextkey]
out = __salt__['cmd.run']('runlevel', python_shell=False, ignore_retcode=True)
try:
ret = out.split(... |
Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining stderr text.
def _strip_scope(msg):
'''
Strip unnecessary message about running the command with --scope from
stderr so that we can raise an exception with the remaining std... |
Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service.
def _systemctl_cmd(action, name=None, systemd_scope=False, no_block=False,
root=None):
'''
Build a systemctl command line. Treat unit names without one
of the valid suffixes as a service.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.