text
stringlengths
81
112k
Update a connection pool def update_connector_c_pool(name, server=None, **kwargs): ''' Update a connection pool ''' if 'transactionSupport' in kwargs and kwargs['transactionSupport'] not in ( 'XATransaction', 'LocalTransaction', 'NoTransaction' ): ...
Delete a connection pool def delete_connector_c_pool(name, target='server', cascade=True, server=None): ''' Delete a connection pool ''' data = {'target': target, 'cascade': cascade} return _delete_element(name, 'resources/connector-connection-pool', data, server)
Create a connection resource def create_connector_resource(name, server=None, **kwargs): ''' Create a connection resource ''' defaults = { 'description': '', 'enabled': True, 'id': name, 'poolName': '', 'objectType': 'user', 'target': 'server' } ...
Update a connection resource def update_connector_resource(name, server=None, **kwargs): ''' Update a connection resource ''' # You're not supposed to update jndiName, if you do so, it will crash, silently if 'jndiName' in kwargs: del kwargs['jndiName'] return _update_element(name, 'res...
Create a JMS destination def create_admin_object_resource(name, server=None, **kwargs): ''' Create a JMS destination ''' defaults = { 'description': '', 'className': 'com.sun.messaging.Queue', 'enabled': True, 'id': name, 'resAdapter': 'jmsra', 'resType':...
Update a JMS destination def update_admin_object_resource(name, server=None, **kwargs): ''' Update a JMS destination ''' if 'jndiName' in kwargs: del kwargs['jndiName'] return _update_element(name, 'resources/admin-object-resource', kwargs, server)
Create a connection resource def create_jdbc_connection_pool(name, server=None, **kwargs): ''' Create a connection resource ''' defaults = { 'allowNonComponentCallers': False, 'associateWithThread': False, 'connectionCreationRetryAttempts': '0', 'connectionCreationRetryI...
Delete a JDBC pool def delete_jdbc_connection_pool(name, target='server', cascade=False, server=None): ''' Delete a JDBC pool ''' data = {'target': target, 'cascade': cascade} return _delete_element(name, 'resources/jdbc-connection-pool', data, server)
Create a JDBC resource def create_jdbc_resource(name, server=None, **kwargs): ''' Create a JDBC resource ''' defaults = { 'description': '', 'enabled': True, 'id': name, 'poolName': '', 'target': 'server' } # Data = defaults + merge kwargs + poolname ...
Update a JDBC resource def update_jdbc_resource(name, server=None, **kwargs): ''' Update a JDBC resource ''' # You're not supposed to update jndiName, if you do so, it will crash, silently if 'jndiName' in kwargs: del kwargs['jndiName'] return _update_element(name, 'resources/jdbc-resou...
Get system properties def get_system_properties(server=None): ''' Get system properties ''' properties = {} data = _api_get('system-properties', server) # Get properties into a dict if any(data['extraProperties']['systemProperties']): for element in data['extraProperties']['systemP...
Ensure a network exists and is up-to-date name Name of the network provider A dict of network provider options. shared Set the network as shared. external Whether this network is externally accessible. admin_state_up Set the network administrative state ...
Ensure a network does not exists name Name of the network def absent(name, auth=None, **kwargs): ''' Ensure a network does not exists name Name of the network ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} kwargs =...
Split a smartos docker uuid into repo and tag def _split_docker_uuid(uuid): ''' Split a smartos docker uuid into repo and tag ''' if uuid: uuid = uuid.split(':') if len(uuid) == 2: tag = uuid[1] repo = uuid[0] return repo, tag return None, None
Check if uuid is a valid smartos uuid Example: e69a0918-055d-11e5-8912-e3ceb6df4cf8 def _is_uuid(uuid): ''' Check if uuid is a valid smartos uuid Example: e69a0918-055d-11e5-8912-e3ceb6df4cf8 ''' if uuid and list((len(x) for x in uuid.split('-'))) == [8, 4, 4, 4, 12]: return True ...
Return imgadm version CLI Example: .. code-block:: bash salt '*' imgadm.version def version(): ''' Return imgadm version CLI Example: .. code-block:: bash salt '*' imgadm.version ''' ret = {} cmd = 'imgadm --version' res = __salt__['cmd.run'](cmd).splitline...
Get the image uuid from an imported docker image .. versionadded:: 2019.2.0 def docker_to_uuid(uuid): ''' Get the image uuid from an imported docker image .. versionadded:: 2019.2.0 ''' if _is_uuid(uuid): return uuid if _is_docker_uuid(uuid): images = list_installed(verbos...
Return a list of available images search : string search keyword verbose : boolean (False) toggle verbose output CLI Example: .. code-block:: bash salt '*' imgadm.avail [percona] salt '*' imgadm.avail verbose=True def avail(search=None, verbose=False): ''' Re...
Show manifest of a given image uuid : string uuid of image CLI Example: .. code-block:: bash salt '*' imgadm.show e42f8c84-bbea-11e2-b920-078fab2aab1f salt '*' imgadm.show plexinc/pms-docker:plexpass def show(uuid): ''' Show manifest of a given image uuid : string ...
Import an image from the repository uuid : string uuid to import verbose : boolean (False) toggle verbose output CLI Example: .. code-block:: bash salt '*' imgadm.import e42f8c84-bbea-11e2-b920-078fab2aab1f [verbose=True] def import_image(uuid, verbose=False): ''' Im...
Remove an installed image uuid : string Specifies uuid to import CLI Example: .. code-block:: bash salt '*' imgadm.delete e42f8c84-bbea-11e2-b920-078fab2aab1f def delete(uuid): ''' Remove an installed image uuid : string Specifies uuid to import CLI Example: ...
Remove unused images verbose : boolean (False) toggle verbose output CLI Example: .. code-block:: bash salt '*' imgadm.vacuum [verbose=True] def vacuum(verbose=False): ''' Remove unused images verbose : boolean (False) toggle verbose output CLI Example: .....
Return a list of available sources verbose : boolean (False) toggle verbose output .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.sources def sources(verbose=False): ''' Return a list of available sources verbose : boolean (False) ...
Delete a source source : string source url to delete .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.source_delete https://updates.joyent.com def source_delete(source): ''' Delete a source source : string source url to delete ....
Add a new source source : string source url to add source_trype : string (imgapi) source type, either imgapi or docker .. versionadded:: 2019.2.0 CLI Example: .. code-block:: bash salt '*' imgadm.source_add https://updates.joyent.com salt '*' imgadm.source_add ht...
Helper function for instantiating a Flags object Args: instantiated (bool): True to return an instantiated object, False to return the object definition. Use False if inherited by another class. Default is True. Returns: object: An instance of the Flags obj...
Helper function for instantiating a Dacl class. Args: obj_name (str): The full path to the object. If None, a blank DACL will be created. Default is None. obj_type (str): The type of object. Default is 'File' Returns: object: An instantiated Dacl o...
Converts a username to a sid, or verifies a sid. Required for working with the DACL. Args: principal(str): The principal to lookup the sid. Can be a sid or a username. Returns: PySID Object: A sid Usage: .. code-block:: python # Get a user's sid salt...
Converts a PySID object to a string SID. Args: principal(str): The principal to lookup the sid. Must be a PySID object. Returns: str: A string sid Usage: .. code-block:: python # Get a PySID object py_sid = salt.utils.win_dacl.get_sid('jsnuffy') ...
Gets the name from the specified principal. Args: principal (str): Find the Normalized name based on this. Can be a PySID object, a SID string, or a user name in any capitalization. .. note:: Searching based on the user name can be slow on hosts connect...
r''' Gets the owner of the passed object Args: obj_name (str): The path for which to obtain owner information. The format of this parameter is different depending on the ``obj_type`` obj_type (str): The type of object to query. This value changes the format...
r''' Gets the primary group of the passed object Args: obj_name (str): The path for which to obtain primary group information obj_type (str): The type of object to query. This value changes the format of the ``obj_name`` parameter as follows: -...
Set the owner of an object. This can be a file, folder, registry key, printer, service, etc... Args: obj_name (str): The object for which to set owner. This can be the path to a file or folder, a registry key, printer, etc. For more information about how to format t...
Set the permissions of an object. This can be a file, folder, registry key, printer, service, etc... Args: obj_name (str): The object for which to set permissions. This can be the path to a file or folder, a registry key, printer, etc. For more information about how...
r''' Remove a user's ACE from an object. This can be a file, folder, registry key, printer, service, etc... Args: obj_name (str): The object from which to remove the ace. This can be the path to a file or folder, a registry key, printer, etc. For more informatio...
Get the permissions for the passed object Args: obj_name (str): The name of or path to the object. principal (Optional[str]): The name of the user or group for which to get permissions. Can also pass a SID. If None, all ACEs defined on the object will be ...
r''' Check if the object has a permission Args: obj_name (str): The name of or path to the object. principal (str): The name of the user or group for which to get permissions. Can also pass a SID. permission (str): The permission to ver...
Enable or disable an objects inheritance. Args: obj_name (str): The name of the object enabled (bool): True to enable inheritance, False to disable obj_type (Optional[str]): The type of object. Only three objects allow inheritance. Valid ob...
Get an object's inheritance. Args: obj_name (str): The name of the object obj_type (Optional[str]): The type of object. Only three object types allow inheritance. Valid objects are: - file (default): This is a file or directory - regist...
r''' Copy the security descriptor of the Source to the Target. You can specify a specific portion of the security descriptor to copy using one of the `copy_*` parameters. .. note:: At least one `copy_*` parameter must be ``True`` .. note:: The user account running this command must...
Helper function used by ``check_perms`` for checking and setting Grant and Deny permissions. Args: obj_name (str): The name or full path to the object obj_type (Optional[str]): The type of object for which to check permissions. Default is 'file' new_perms (dic...
Check owner and permissions for the passed directory. This function checks the permissions and sets them, returning the changes made. .. versionadded:: 2019.2.0 Args: obj_name (str): The name or full path to the object obj_type (Optional[str]): The type of object ...
Set permissions for the given path .. versionadded:: 2019.2.0 Args: obj_name (str): The name or full path to the object obj_type (Optional[str]): The type of object for which to check permissions. Default is 'file' grant_perms (dict): A dictionary...
Retrieve a set of public keys from GitHub for the specified list of users. Expects input in list format. Optionally, a value in the list may be a dict whose value is a list of key IDs to be returned. If this is not done, then all keys will be returned. Some example data structures that coupld be passed...
Retrieves DNS host record settings for the requested domain. returns a dictionary of information about the requested domain sld SLD of the domain name tld TLD of the domain name CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.get_hosts sld tld ...
Gets a list of DNS servers associated with the requested domain. returns a dictionary of information about requested domain sld SLD of the domain name tld TLD of the domain name CLI Example: .. code-block:: bash salt 'my-minion' namecheap_domains_dns.get_list sld tld d...
Sets DNS host records settings for the requested domain. returns True if the host records were set successfully sld SLD of the domain name tld TLD of the domain name hosts Must be passed as a list of Python dictionaries, with each dictionary containing the following k...
Sets domain to use custom DNS servers. returns True if the custom nameservers were set successfully sld SLD of the domain name tld TLD of the domain name nameservers array of strings List of nameservers to be associated with this domain CLI Example: .. code-block::...
Sets domain to use namecheap default DNS servers. Required for free services like Host record management, URL forwarding, email forwarding, dynamic DNS and other value added services. sld SLD of the domain name tld TLD of the domain name Returns ``True`` if the domain was successf...
Display the profiling data in a table format. def output(data, **kwargs): ''' Display the profiling data in a table format. ''' rows = _find_durations(data) kwargs['opts'] = __opts__ kwargs['rows_key'] = 'rows' kwargs['labels_key'] = 'labels' to_show = {'labels': ['name', 'mod.fun', ...
Ensure an image exists, copy it else from source name : An alias of the image, this is used to check if the image exists and it will be added as alias to the image on copy/create. source : Source dict. For an LXD to LXD copy: .. code-block: yaml source: ...
Ensure a hosted zone exists with the given attributes. name The name of the state definition. Name The name of the domain. This should be a fully-specified domain, and should terminate with a period. This is the name you have registered with your DNS registrar. It is also the name ...
Ensure the Route53 Hostes Zone described is absent name The name of the state definition. Name The name of the domain. This should be a fully-specified domain, and should terminate with a period. If not provided, the value of name will be used. PrivateZone Set True if del...
Ensure the Route53 record is present. name The name of the state definition. This will be used for Name if the latter is not provided. HostedZoneId The ID of a zone to create the record in. Exclusive with DomainName. DomainName The domain name of a zone to create the rec...
Ensure the Route53 record is deleted. name The name of the state definition. This will be used for Name if the latter is not provided. HostedZoneId The ID of the zone to delete the record from. Exclusive with DomainName. DomainName The domain name of the zone to delete t...
Get module optional environment. To setup an environment option for a particular module, add either pillar or config at the minion as follows: system-environment: modules: pkg: _: LC_ALL: en_GB.UTF-8 FOO: bar install: HELLO: world ...
Run the aptly command. :return: The string output of the command. :rtype: str def _cmd_run(cmd): ''' Run the aptly command. :return: The string output of the command. :rtype: str ''' cmd.insert(0, 'aptly') cmd_ret = __salt__['cmd.run_all'](cmd, ignore_retcode=True) if cmd_ret...
Convert string value to it's closest non-string analog, if possible. :param dict value: The string value to attempt conversion on. :return: The converted value. :rtype: Union[bool, int, None, str] def _convert_to_closest_type(value): ''' Convert string value to it's closest non-string analog, if ...
Format the common arguments for creating or editing a repository. :param str comment: The description of the repository. :param str component: The default component to use when publishing. :param str distribution: The default distribution to use when publishing. :param str uploaders_file: The repositor...
Parse the output of an aptly show command. :param str cmd_ret: The text of the command output that needs to be parsed. :return: A dictionary containing the configuration data. :rtype: dict def _parse_show_output(cmd_ret): ''' Parse the output of an aptly show command. :param str cmd_ret: The...
Convert matching string values to lists/dictionaries. :param dict parsed_data: The text of the command output that needs to be parsed. :return: A dictionary containing the modified configuration data. :rtype: dict def _convert_parsed_show_output(parsed_data): ''' Convert matching string values to...
Validate that the configuration file exists and is readable. :param str config_path: The path to the configuration file for the aptly instance. :return: None :rtype: None def _validate_config(config_path): ''' Validate that the configuration file exists and is readable. :param str config_pat...
Get the configuration data. :param str config_path: The path to the configuration file for the aptly instance. :return: A dictionary containing the configuration data. :rtype: dict CLI Example: .. code-block:: bash salt '*' aptly.get_config def get_config(config_path=_DEFAULT_CONFIG_PA...
List all of the local package repositories. :param str config_path: The path to the configuration file for the aptly instance. :param bool with_packages: Return a list of packages in the repo. :return: A dictionary of the repositories. :rtype: dict CLI Example: .. code-block:: bash ...
Get detailed information about a local package repository. :param str name: The name of the local repository. :param str config_path: The path to the configuration file for the aptly instance. :param bool with_packages: Return a list of packages in the repo. :return: A dictionary containing informatio...
Create a new local package repository. :param str name: The name of the local repository. :param str config_path: The path to the configuration file for the aptly instance. :param str comment: The description of the repository. :param str component: The default component to use when publishing. :pa...
Configure the settings for a local package repository. :param str name: The name of the local repository. :param str config_path: The path to the configuration file for the aptly instance. :param str comment: The description of the repository. :param str component: The default component to use when pub...
Remove a local package repository. :param str name: The name of the local repository. :param str config_path: The path to the configuration file for the aptly instance. :param bool force: Whether to remove the repository even if it is used as the source of an existing snapshot. :return: A bool...
Get a list of all the mirrored remote repositories. :param str config_path: The path to the configuration file for the aptly instance. :return: A list of the mirror names. :rtype: list CLI Example: .. code-block:: bash salt '*' aptly.list_mirrors def list_mirrors(config_path=_DEFAULT_C...
Get detailed information about a mirrored remote repository. :param str name: The name of the remote repository mirror. :param str config_path: The path to the configuration file for the aptly instance. :param bool with_packages: Return a list of packages in the repo. :return: A dictionary containing ...
Remove a mirrored remote repository. By default, Package data is not removed. :param str name: The name of the remote repository mirror. :param str config_path: The path to the configuration file for the aptly instance. :param bool force: Whether to remove the mirror even if it is used as the source ...
Get a list of all the published repositories. :param str config_path: The path to the configuration file for the aptly instance. :return: A list of the published repositories. :rtype: list CLI Example: .. code-block:: bash salt '*' aptly.list_published def list_published(config_path=_D...
Get the details of a published repository. :param str name: The distribution name of the published repository. :param str config_path: The path to the configuration file for the aptly instance. :param str endpoint: The publishing endpoint. :param str prefix: The prefix for publishing. :return: A d...
Remove files belonging to a published repository. Aptly tries to remove as many files belonging to this repository as possible. :param str name: The distribution name of the published repository. :param str config_path: The path to the configuration file for the aptly instance. :param str endpoint:...
Get a list of all the existing snapshots. :param str config_path: The path to the configuration file for the aptly instance. :param bool sort_by_time: Whether to sort by creation time instead of by name. :return: A list of the snapshot names. :rtype: list CLI Example: .. code-block:: bash ...
Get detailed information about a snapshot. :param str name: The name of the snapshot given during snapshot creation. :param str config_path: The path to the configuration file for the aptly instance. :param bool with_packages: Return a list of packages in the snapshot. :return: A dictionary containing...
Remove information about a snapshot. If a snapshot is published, it can not be dropped without first removing publishing for that snapshot. If a snapshot is used as the source for other snapshots, Aptly will refuse to remove it unless forced. :param str name: The name of the snapshot given ...
Remove data regarding unreferenced packages and delete files in the package pool that are no longer being used by packages. :param bool dry_run: Report potential changes without making any changes. :return: A dictionary of the package keys and files that were removed. :rtype: dict CLI Example...
Publishes minions as a list of dicts. def publish_minions(self): ''' Publishes minions as a list of dicts. ''' minions = [] for minion, minion_info in six.iteritems(self.minions): curr_minion = {} curr_minion.update(minion_info) curr_minion.u...
Publishes the data to the event stream. def publish(self, key, data): ''' Publishes the data to the event stream. ''' publish_data = {key: data} self.handler.send(salt.utils.json.dumps(publish_data), False)
Check if any minions have connected or dropped. Send a message to the client if they have. def process_presence_events(self, event_data, token, opts): ''' Check if any minions have connected or dropped. Send a message to the client if they have. ''' tag = event_data['tag...
Process events and publish data def process(self, salt_data, token, opts): ''' Process events and publish data ''' parts = salt_data['tag'].split('/') if len(parts) < 2: return # TBD: Simplify these conditional expressions if parts[1] == 'job': ...
Ensures that a distinguished name list exists with the items provided. name: The name of the module function to execute. name(str): The name of the distinguished names list. items(list): A list of items to ensure exist on the distinguished names list. SLS Example: .. code-block:: yaml ...
Get alarm details. Also can be used to check to see if an alarm exists. CLI example:: salt myminion boto_cloudwatch.get_alarm myalarm region=us-east-1 def get_alarm(name, region=None, key=None, keyid=None, profile=None): ''' Get alarm details. Also can be used to check to see if an alarm exists. ...
this presenter magic makes yaml.safe_dump work with the objects returned from boto.describe_alarms() def _safe_dump(data): ''' this presenter magic makes yaml.safe_dump work with the objects returned from boto.describe_alarms() ''' custom_dumper = __utils__['yaml.get_dumper']('SafeOrder...
Get all alarm details. Produces results that can be used to create an sls file. If prefix parameter is given, alarm names in the output will be prepended with the prefix; alarms that have the prefix will be skipped. This can be used to convert existing alarms to be managed by salt, as follows: ...
Create or update a cloudwatch alarm. Params are the same as: https://boto.readthedocs.io/en/latest/ref/cloudwatch.html#boto.ec2.cloudwatch.alarm.MetricAlarm. Dimensions must be a dict. If the value of Dimensions is a string, it will be json decoded to produce a dict. alarm_actions, insufficient_da...
Convert a list of strings into actual arns. Converts convenience names such as 'scaling_policy:...' CLI Example:: salt '*' convert_to_arn 'scaling_policy:' def convert_to_arn(arns, region=None, key=None, keyid=None, profile=None): ''' Convert a list of strings into actual arns. Converts conve...
Delete a cloudwatch alarm CLI example to delete a queue:: salt myminion boto_cloudwatch.delete_alarm myalarm region=us-east-1 def delete_alarm(name, region=None, key=None, keyid=None, profile=None): ''' Delete a cloudwatch alarm CLI example to delete a queue:: salt myminion boto_clo...
Convert a boto.ec2.cloudwatch.alarm.MetricAlarm into a dict. Convenience for pretty printing. def _metric_alarm_to_dict(alarm): ''' Convert a boto.ec2.cloudwatch.alarm.MetricAlarm into a dict. Convenience for pretty printing. ''' d = odict.OrderedDict() fields = ['name', 'metric', 'namespac...
Ensure GPG public key is present in keychain name The unique name or keyid for the GPG public key. keys The keyId or keyIds to add to the GPG keychain. user Add GPG keys to the specified user's keychain keyserver The keyserver to retrieve the keys from. gnupghome...
Ensure GPG public key is absent in keychain name The unique name or keyid for the GPG public key. keys The keyId or keyIds to add to the GPG keychain. user Remove GPG keys from the specified user's keychain gnupghome Override GNUPG Home directory def absent(name, ...
Extract pillar from an hg repository def ext_pillar(minion_id, pillar, repo, branch='default', root=None): ''' Extract pillar from an hg repository ''' with Repo(repo) as repo: repo.update(branch) envname = 'base' if branch == 'default' else branch if root: path = os.path.normpa...
Ensure we are using the latest revision in the hg repository def update(self, branch='default'): ''' Ensure we are using the latest revision in the hg repository ''' log.debug('Updating hg repo from hg_pillar module (pull)') self.repo.pull() log.debug('Updating hg repo f...
Open the connection to the network device managed through netmiko. def init(opts): ''' Open the connection to the network device managed through netmiko. ''' proxy_dict = opts.get('proxy', {}) opts['multiprocessing'] = proxy_dict.get('multiprocessing', False) netmiko_connection_args = p...
Return the connection status with the network device. def alive(opts): ''' Return the connection status with the network device. ''' log.debug('Checking if %s is still alive', opts.get('id', '')) if not netmiko_device['always_alive']: return True if ping() and initialized(): ret...
Calls an arbitrary netmiko method. def call(method, *args, **kwargs): ''' Calls an arbitrary netmiko method. ''' kwargs = clean_kwargs(**kwargs) if not netmiko_device['always_alive']: connection = ConnectHandler(**netmiko_device['args']) ret = getattr(connection, method)(*args, **kw...
Given a trail name, check to see if the given trail exists. Returns True if the given trail exists and returns False if the given trail does not exist. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.exists mytrail def exists(Name, region=None, key=None, keyid=Non...
Given a trail name describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.describe mytrail def describe(Name, region=None, key=None, keyid=None, profile=None): ''' Given a trail name describe ...
Given a trail name describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_cloudtrail.describe mytrail def status(Name, region=None, key=None, keyid=None, profile=None): ''' Given a trail name describe it...