repository_name stringclasses 316
values | func_path_in_repository stringlengths 6 223 | func_name stringlengths 1 134 | language stringclasses 1
value | func_code_string stringlengths 57 65.5k | func_documentation_string stringlengths 1 46.3k | split_name stringclasses 1
value | func_code_url stringlengths 91 315 | called_functions listlengths 1 156 ⌀ | enclosing_scope stringlengths 2 1.48M |
|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/boto_vpc.py | associate_dhcp_options_to_vpc | python | def associate_dhcp_options_to_vpc(dhcp_options_id, vpc_id=None, vpc_name=None,
region=None, key=None, keyid=None, profile=None):
'''
Given valid DHCP options id and a valid VPC id, associate the DHCP options record with the VPC.
Returns True if the DHCP options record were... | Given valid DHCP options id and a valid VPC id, associate the DHCP options record with the VPC.
Returns True if the DHCP options record were associated and returns False if the DHCP options record was not associated.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.associate_dhcp_options... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1641-L1671 | [
"def check_vpc(vpc_id=None, vpc_name=None, region=None, key=None,\n keyid=None, profile=None):\n '''\n Check whether a VPC with the given name or id exists.\n Returns the vpc_id or None. Raises SaltInvocationError if\n both vpc_id and vpc_name are None. Optionally raise a\n CommandExecut... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | dhcp_options_exists | python | def dhcp_options_exists(dhcp_options_id=None, name=None, dhcp_options_name=None,
tags=None, region=None, key=None, keyid=None, profile=None):
'''
Check if a dhcp option exists.
Returns True if the dhcp option exists; Returns False otherwise.
CLI Example:
.. code-block:: ba... | Check if a dhcp option exists.
Returns True if the dhcp option exists; Returns False otherwise.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.dhcp_options_exists dhcp_options_id='dhcp-a0bl34pp' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1674-L1697 | [
"def resource_exists(resource, name=None, resource_id=None, tags=None,\n region=None, key=None, keyid=None, profile=None):\n '''\n Given a resource type and name, return {exists: true} if it exists,\n {exists: false} if it does not exist, or {error: {message: error text}\n on error.\n... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | create_network_acl | python | def create_network_acl(vpc_id=None, vpc_name=None, network_acl_name=None,
subnet_id=None, subnet_name=None, tags=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a vpc_id, creates a network acl.
Returns the network acl id if successful, otherwi... | Given a vpc_id, creates a network acl.
Returns the network acl id if successful, otherwise returns False.
.. versionchanged:: 2015.8.0
Added vpc_name, subnet_id, and subnet_name arguments
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.create_network_acl 'vpc-6b1fe402' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1700-L1757 | [
"def check_vpc(vpc_id=None, vpc_name=None, region=None, key=None,\n keyid=None, profile=None):\n '''\n Check whether a VPC with the given name or id exists.\n Returns the vpc_id or None. Raises SaltInvocationError if\n both vpc_id and vpc_name are None. Optionally raise a\n CommandExecut... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | delete_network_acl | python | def delete_network_acl(network_acl_id=None, network_acl_name=None, disassociate=False,
region=None, key=None, keyid=None, profile=None):
'''
Delete a network acl based on the network_acl_id or network_acl_name provided.
CLI Examples:
.. code-block:: bash
salt myminion b... | Delete a network acl based on the network_acl_id or network_acl_name provided.
CLI Examples:
.. code-block:: bash
salt myminion boto_vpc.delete_network_acl network_acl_id='acl-5fb85d36' \\
disassociate=false
.. code-block:: bash
salt myminion boto_vpc.delete_network_acl ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1760-L1793 | [
"def _delete_resource(resource, name=None, resource_id=None, region=None,\n key=None, keyid=None, profile=None, **kwargs):\n '''\n Delete a VPC resource. Returns True if successful, otherwise False.\n '''\n\n if not _exactly_one((name, resource_id)):\n raise SaltInvocationErro... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | network_acl_exists | python | def network_acl_exists(network_acl_id=None, name=None, network_acl_name=None,
tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Checks if a network acl exists.
Returns True if the network acl exists or returns False if it doesn't exist.
CLI ... | Checks if a network acl exists.
Returns True if the network acl exists or returns False if it doesn't exist.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.network_acl_exists network_acl_id='acl-5fb85d36' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1796-L1819 | [
"def resource_exists(resource, name=None, resource_id=None, tags=None,\n region=None, key=None, keyid=None, profile=None):\n '''\n Given a resource type and name, return {exists: true} if it exists,\n {exists: false} if it does not exist, or {error: {message: error text}\n on error.\n... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | associate_network_acl_to_subnet | python | def associate_network_acl_to_subnet(network_acl_id=None, subnet_id=None,
network_acl_name=None,
subnet_name=None, region=None,
key=None, keyid=None, profile=None):
'''
Given a network acl and subnet ids o... | Given a network acl and subnet ids or names, associate a network acl to a subnet.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.associate_network_acl_to_subnet \\
network_acl_id='acl-5fb85d36' subnet_id='subnet-6a1fe403'
.. code-block:: bash
salt myminion boto... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1822-L1870 | [
"def _get_resource_id(resource, name, region=None, key=None,\n keyid=None, profile=None):\n '''\n Get an AWS id for a VPC resource by type and name.\n '''\n\n _id = _cache_id(name, sub_resource=resource,\n region=region, key=key,\n keyid=keyid, p... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | disassociate_network_acl | python | def disassociate_network_acl(subnet_id=None, vpc_id=None, subnet_name=None, vpc_name=None,
region=None, key=None, keyid=None, profile=None):
'''
Given a subnet ID, disassociates a network acl.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.disassociate_n... | Given a subnet ID, disassociates a network acl.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.disassociate_network_acl 'subnet-6a1fe403' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1873-L1909 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | create_network_acl_entry | python | def create_network_acl_entry(network_acl_id=None, rule_number=None, protocol=None,
rule_action=None, cidr_block=None, egress=None,
network_acl_name=None, icmp_code=None, icmp_type=None,
port_range_from=None, port_range_to=None,
... | Creates a network acl entry.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.create_network_acl_entry 'acl-5fb85d36' '32767' \\
'all' 'deny' '0.0.0.0/0' egress=true | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L1965-L1983 | [
"def _create_network_acl_entry(network_acl_id=None, rule_number=None, protocol=None,\n rule_action=None, cidr_block=None, egress=None,\n network_acl_name=None, icmp_code=None, icmp_type=None,\n port_range_from=None, port_range_to... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | delete_network_acl_entry | python | def delete_network_acl_entry(network_acl_id=None, rule_number=None, egress=None,
network_acl_name=None, region=None, key=None, keyid=None,
profile=None):
'''
Deletes a network acl entry.
CLI Example:
.. code-block:: bash
salt myminion ... | Deletes a network acl entry.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.delete_network_acl_entry 'acl-5fb85d36' '32767' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2008-L2045 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | create_route_table | python | def create_route_table(vpc_id=None, vpc_name=None, route_table_name=None,
tags=None, region=None, key=None, keyid=None, profile=None):
'''
Creates a route table.
.. versionchanged:: 2015.8.0
Added vpc_name argument
CLI Examples:
.. code-block:: bash
salt my... | Creates a route table.
.. versionchanged:: 2015.8.0
Added vpc_name argument
CLI Examples:
.. code-block:: bash
salt myminion boto_vpc.create_route_table vpc_id='vpc-6b1fe402' \\
route_table_name='myroutetable'
salt myminion boto_vpc.create_route_table vpc_name='my... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2048-L2071 | [
"def check_vpc(vpc_id=None, vpc_name=None, region=None, key=None,\n keyid=None, profile=None):\n '''\n Check whether a VPC with the given name or id exists.\n Returns the vpc_id or None. Raises SaltInvocationError if\n both vpc_id and vpc_name are None. Optionally raise a\n CommandExecut... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | delete_route_table | python | def delete_route_table(route_table_id=None, route_table_name=None,
region=None, key=None, keyid=None, profile=None):
'''
Deletes a route table.
CLI Examples:
.. code-block:: bash
salt myminion boto_vpc.delete_route_table route_table_id='rtb-1f382e7d'
salt mymini... | Deletes a route table.
CLI Examples:
.. code-block:: bash
salt myminion boto_vpc.delete_route_table route_table_id='rtb-1f382e7d'
salt myminion boto_vpc.delete_route_table route_table_name='myroutetable' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2074-L2089 | [
"def _delete_resource(resource, name=None, resource_id=None, region=None,\n key=None, keyid=None, profile=None, **kwargs):\n '''\n Delete a VPC resource. Returns True if successful, otherwise False.\n '''\n\n if not _exactly_one((name, resource_id)):\n raise SaltInvocationErro... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | route_table_exists | python | def route_table_exists(route_table_id=None, name=None, route_table_name=None,
tags=None, region=None, key=None, keyid=None, profile=None):
'''
Checks if a route table exists.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.route_table_exists route_table_id='rtb... | Checks if a route table exists.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.route_table_exists route_table_id='rtb-1f382e7d' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2092-L2113 | [
"def resource_exists(resource, name=None, resource_id=None, tags=None,\n region=None, key=None, keyid=None, profile=None):\n '''\n Given a resource type and name, return {exists: true} if it exists,\n {exists: false} if it does not exist, or {error: {message: error text}\n on error.\n... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | route_exists | python | def route_exists(destination_cidr_block, route_table_name=None, route_table_id=None,
gateway_id=None, instance_id=None, interface_id=None, tags=None,
region=None, key=None, keyid=None, profile=None, vpc_peering_connection_id=None):
'''
Checks if a route exists.
.. versiona... | Checks if a route exists.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.route_exists destination_cidr_block='10.0.0.0/20' gateway_id='local' route_table_name='test' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2116-L2181 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | associate_route_table | python | def associate_route_table(route_table_id=None, subnet_id=None,
route_table_name=None, subnet_name=None,
region=None, key=None, keyid=None,
profile=None):
'''
Given a route table and subnet name or id, associates the route table with t... | Given a route table and subnet name or id, associates the route table with the subnet.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.associate_route_table 'rtb-1f382e7d' 'subnet-6a1fe403'
.. code-block:: bash
salt myminion boto_vpc.associate_route_table route_table_name='myrt... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2184-L2233 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | disassociate_route_table | python | def disassociate_route_table(association_id, region=None, key=None, keyid=None, profile=None):
'''
Dissassociates a route table.
association_id
The Route Table Association ID to disassociate
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.disassociate_route_table 'rtbass... | Dissassociates a route table.
association_id
The Route Table Association ID to disassociate
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.disassociate_route_table 'rtbassoc-d8ccddba' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2236-L2260 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | replace_route_table_association | python | def replace_route_table_association(association_id, route_table_id, region=None, key=None, keyid=None, profile=None):
'''
Replaces a route table association.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.replace_route_table_association 'rtbassoc-d8ccddba' 'rtb-1f382e7d'
'''
... | Replaces a route table association.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.replace_route_table_association 'rtbassoc-d8ccddba' 'rtb-1f382e7d' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2263-L2282 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | create_route | python | def create_route(route_table_id=None, destination_cidr_block=None,
route_table_name=None, gateway_id=None,
internet_gateway_name=None,
instance_id=None, interface_id=None,
vpc_peering_connection_id=None, vpc_peering_connection_name=None,
... | Creates a route.
If a nat gateway is specified, boto3 must be installed
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.create_route 'rtb-1f382e7d' '10.0.0.0/16' gateway_id='vgw-a1b2c3' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2285-L2379 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | delete_route | python | def delete_route(route_table_id=None, destination_cidr_block=None,
route_table_name=None, region=None, key=None,
keyid=None, profile=None):
'''
Deletes a route.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.delete_route 'rtb-1f382e7d' '10.0.0.0/16'... | Deletes a route.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.delete_route 'rtb-1f382e7d' '10.0.0.0/16' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2382-L2417 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | replace_route | python | def replace_route(route_table_id=None, destination_cidr_block=None,
route_table_name=None, gateway_id=None,
instance_id=None, interface_id=None,
region=None, key=None, keyid=None, profile=None,
vpc_peering_connection_id=None):
'''
Replaces ... | Replaces a route.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.replace_route 'rtb-1f382e7d' '10.0.0.0/16' gateway_id='vgw-a1b2c3' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2420-L2468 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | describe_route_table | python | def describe_route_table(route_table_id=None, route_table_name=None,
tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Given route table properties, return route table details if matching table(s) exist.
.. versionadded:: 2015.8.0
CLI Ex... | Given route table properties, return route table details if matching table(s) exist.
.. versionadded:: 2015.8.0
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.describe_route_table route_table_id='rtb-1f382e7d' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2471-L2529 | [
"def warn_until(version,\n message,\n category=DeprecationWarning,\n stacklevel=None,\n _version_info_=None,\n _dont_call_warnings=False):\n '''\n Helper function to raise a warning, by default, a ``DeprecationWarning``,\n until the prov... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | describe_route_tables | python | def describe_route_tables(route_table_id=None, route_table_name=None,
vpc_id=None,
tags=None, region=None, key=None, keyid=None,
profile=None):
'''
Given route table properties, return details of all matching route tables.
This func... | Given route table properties, return details of all matching route tables.
This function requires boto3 to be installed.
.. versionadded:: 2016.11.0
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.describe_route_tables vpc_id='vpc-a6a9efc3' | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2532-L2615 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | _get_subnet_explicit_route_table | python | def _get_subnet_explicit_route_table(subnet_id, vpc_id, conn=None, region=None, key=None, keyid=None, profile=None):
'''
helper function to find subnet explicit route table associations
.. versionadded:: 2016.11.0
'''
if not conn:
conn = _get_conn(region=region, key=key, keyid=keyid, profil... | helper function to find subnet explicit route table associations
.. versionadded:: 2016.11.0 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2694-L2708 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | request_vpc_peering_connection | python | def request_vpc_peering_connection(requester_vpc_id=None, requester_vpc_name=None,
peer_vpc_id=None, peer_vpc_name=None, name=None,
peer_owner_id=None, peer_region=None, region=None,
key=None, keyid=None, profile=No... | Request a VPC peering connection between two VPCs.
.. versionadded:: 2016.11.0
requester_vpc_id
ID of the requesting VPC. Exclusive with requester_vpc_name.
requester_vpc_name
Name tag of the requesting VPC. Exclusive with requester_vpc_id.
peer_vpc_id
ID of the VPC to creat... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2711-L2826 | [
"def _vpc_peering_conn_id_for_name(name, conn):\n '''\n Get the ID associated with this name\n '''\n log.debug('Retrieving VPC peering connection id')\n ids = _get_peering_connection_ids(name, conn)\n if not ids:\n ids = [None] # Let callers handle the case where we have no id\n elif le... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | _get_peering_connection_ids | python | def _get_peering_connection_ids(name, conn):
'''
:param name: The name of the VPC peering connection.
:type name: String
:param conn: The boto aws ec2 connection.
:return: The id associated with this peering connection
Returns the VPC peering connection ids
given the VPC peering connection ... | :param name: The name of the VPC peering connection.
:type name: String
:param conn: The boto aws ec2 connection.
:return: The id associated with this peering connection
Returns the VPC peering connection ids
given the VPC peering connection name. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2829-L2850 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | describe_vpc_peering_connection | python | def describe_vpc_peering_connection(name,
region=None,
key=None,
keyid=None,
profile=None):
'''
Returns any VPC peering connection id(s) for the given VPC
peering c... | Returns any VPC peering connection id(s) for the given VPC
peering connection name.
VPC peering connection ids are only returned for connections that
are in the ``active``, ``pending-acceptance`` or ``provisioning``
state.
.. versionadded:: 2016.11.0
:param name: The string name for this VPC ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2853-L2888 | [
"def _get_peering_connection_ids(name, conn):\n '''\n :param name: The name of the VPC peering connection.\n :type name: String\n :param conn: The boto aws ec2 connection.\n :return: The id associated with this peering connection\n\n Returns the VPC peering connection ids\n given the VPC peerin... | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | accept_vpc_peering_connection | python | def accept_vpc_peering_connection( # pylint: disable=too-many-arguments
conn_id='',
name='',
region=None,
key=None,
keyid=None,
... | Request a VPC peering connection between two VPCs.
.. versionadded:: 2016.11.0
:param conn_id: The ID to use. String type.
:param name: The name of this VPC peering connection. String type.
:param region: The AWS region to use. Type string.
:param key: The key to use for this connection. Type stri... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2891-L2953 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | _vpc_peering_conn_id_for_name | python | def _vpc_peering_conn_id_for_name(name, conn):
'''
Get the ID associated with this name
'''
log.debug('Retrieving VPC peering connection id')
ids = _get_peering_connection_ids(name, conn)
if not ids:
ids = [None] # Let callers handle the case where we have no id
elif len(ids) > 1:
... | Get the ID associated with this name | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2956-L2972 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | delete_vpc_peering_connection | python | def delete_vpc_peering_connection(conn_id=None, conn_name=None, region=None,
key=None, keyid=None, profile=None, dry_run=False):
'''
Delete a VPC peering connection.
.. versionadded:: 2016.11.0
conn_id
The connection ID to check. Exclusive with conn_name.
... | Delete a VPC peering connection.
.. versionadded:: 2016.11.0
conn_id
The connection ID to check. Exclusive with conn_name.
conn_name
The connection name to check. Exclusive with conn_id.
region
Region to connect to.
key
Secret key to be used.
keyid
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2975-L3033 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | is_peering_connection_pending | python | def is_peering_connection_pending(conn_id=None, conn_name=None, region=None,
key=None, keyid=None, profile=None):
'''
Check if a VPC peering connection is in the pending state.
.. versionadded:: 2016.11.0
conn_id
The connection ID to check. Exclusive with con... | Check if a VPC peering connection is in the pending state.
.. versionadded:: 2016.11.0
conn_id
The connection ID to check. Exclusive with conn_name.
conn_name
The connection name to check. Exclusive with conn_id.
region
Region to connect to.
key
Secret key to b... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L3036-L3094 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/modules/boto_vpc.py | peering_connection_pending_from_vpc | python | def peering_connection_pending_from_vpc(conn_id=None, conn_name=None, vpc_id=None,
vpc_name=None, region=None, key=None,
keyid=None, profile=None):
'''
Check if a VPC peering connection is in the pending state, and requested from th... | Check if a VPC peering connection is in the pending state, and requested from the given VPC.
.. versionadded:: 2016.11.0
conn_id
The connection ID to check. Exclusive with conn_name.
conn_name
The connection name to check. Exclusive with conn_id.
vpc_id
Is this the ID of th... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L3097-L3168 | null | # -*- coding: utf-8 -*-
'''
Connection module for Amazon VPC
.. versionadded:: 2014.7.0
:depends:
- boto >= 2.8.0
- boto3 >= 1.2.6
:configuration: This module accepts explicit VPC credentials but can also
utilize IAM roles assigned to the instance through Instance Profiles.
Dynamic credentials are then auto... |
saltstack/salt | salt/utils/botomod.py | cache_id | python | def cache_id(service, name, sub_resource=None, resource_id=None,
invalidate=False, region=None, key=None, keyid=None,
profile=None):
'''
Cache, invalidate, or retrieve an AWS resource id keyed by name.
.. code-block:: python
__utils__['boto.cache_id']('ec2', 'myinstance',... | Cache, invalidate, or retrieve an AWS resource id keyed by name.
.. code-block:: python
__utils__['boto.cache_id']('ec2', 'myinstance',
'i-a1b2c3',
profile='custom_profile') | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L115-L150 | [
"def _get_profile(service, region, key, keyid, profile):\n if profile:\n if isinstance(profile, six.string_types):\n _profile = __salt__['config.option'](profile)\n elif isinstance(profile, dict):\n _profile = profile\n key = _profile.get('key', None)\n keyid = _... | # -*- coding: utf-8 -*-
'''
Boto Common Utils
=================
Note: This module depends on the dicts packed by the loader and,
therefore, must be accessed via the loader or from the __utils__ dict.
The __utils__ dict will not be automatically available to execution modules
until 2015.8.0. The `salt.utils.compat.pac... |
saltstack/salt | salt/utils/botomod.py | get_connection | python | def get_connection(service, module=None, region=None, key=None, keyid=None,
profile=None):
'''
Return a boto connection for the service.
.. code-block:: python
conn = __utils__['boto.get_connection']('ec2', profile='custom_profile')
'''
# future lint: disable=blackliste... | Return a boto connection for the service.
.. code-block:: python
conn = __utils__['boto.get_connection']('ec2', profile='custom_profile') | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L166-L201 | [
"def _get_profile(service, region, key, keyid, profile):\n if profile:\n if isinstance(profile, six.string_types):\n _profile = __salt__['config.option'](profile)\n elif isinstance(profile, dict):\n _profile = profile\n key = _profile.get('key', None)\n keyid = _... | # -*- coding: utf-8 -*-
'''
Boto Common Utils
=================
Note: This module depends on the dicts packed by the loader and,
therefore, must be accessed via the loader or from the __utils__ dict.
The __utils__ dict will not be automatically available to execution modules
until 2015.8.0. The `salt.utils.compat.pac... |
saltstack/salt | salt/utils/botomod.py | exactly_n | python | def exactly_n(l, n=1):
'''
Tests that exactly N items in an iterable are "truthy" (neither None,
False, nor 0).
'''
i = iter(l)
return all(any(i) for j in range(n)) and not any(i) | Tests that exactly N items in an iterable are "truthy" (neither None,
False, nor 0). | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L243-L249 | null | # -*- coding: utf-8 -*-
'''
Boto Common Utils
=================
Note: This module depends on the dicts packed by the loader and,
therefore, must be accessed via the loader or from the __utils__ dict.
The __utils__ dict will not be automatically available to execution modules
until 2015.8.0. The `salt.utils.compat.pac... |
saltstack/salt | salt/utils/botomod.py | assign_funcs | python | def assign_funcs(modname, service, module=None, pack=None):
'''
Assign _get_conn and _cache_id functions to the named module.
.. code-block:: python
__utils__['boto.assign_partials'](__name__, 'ec2')
'''
if pack:
global __salt__ # pylint: disable=W0601
__salt__ = pack
... | Assign _get_conn and _cache_id functions to the named module.
.. code-block:: python
__utils__['boto.assign_partials'](__name__, 'ec2') | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L256-L273 | [
"def cache_id_func(service):\n '''\n Returns a partial ``cache_id`` function for the provided service.\n\n .. code-block:: python\n\n cache_id = __utils__['boto.cache_id_func']('ec2')\n cache_id('myinstance', 'i-a1b2c3')\n instance_id = cache_id('myinstance')\n '''\n return parti... | # -*- coding: utf-8 -*-
'''
Boto Common Utils
=================
Note: This module depends on the dicts packed by the loader and,
therefore, must be accessed via the loader or from the __utils__ dict.
The __utils__ dict will not be automatically available to execution modules
until 2015.8.0. The `salt.utils.compat.pac... |
saltstack/salt | salt/matchers/ipcidr_match.py | match | python | def match(tgt, opts=None):
'''
Matches based on IP address or CIDR notation
'''
if not opts:
opts = __opts__
try:
# Target is an address?
tgt = ipaddress.ip_address(tgt)
except: # pylint: disable=bare-except
try:
# Target is a network?
tg... | Matches based on IP address or CIDR notation | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/ipcidr_match.py#L20-L48 | [
"def ip_address(address):\n \"\"\"Take an IP string/int and return an object of the correct type.\n\n Args:\n address: A string or integer, the IP address. Either IPv4 or\n IPv6 addresses may be supplied; integers less than 2**32 will\n be considered to be IPv4 by default.\n\n Ret... | # -*- coding: utf-8 -*-
'''
This is the default ipcidr matcher.
'''
from __future__ import absolute_import, print_function, unicode_literals
import logging
from salt.ext import six # pylint: disable=3rd-party-module-not-gated
import salt.utils.network # pylint: disable=3rd-party-module-not-gated
if six.PY3:
im... |
saltstack/salt | salt/utils/dictupdate.py | update | python | def update(dest, upd, recursive_update=True, merge_lists=False):
'''
Recursive version of the default dict.update
Merges upd recursively into dest
If recursive_update=False, will use the classic dict.update, or fall back
on a manual merge (helpful for non-dict types like FunctionWrapper)
If m... | Recursive version of the default dict.update
Merges upd recursively into dest
If recursive_update=False, will use the classic dict.update, or fall back
on a manual merge (helpful for non-dict types like FunctionWrapper)
If merge_lists=True, will aggregate list object types instead of replace.
The... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L30-L82 | null | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/utils/dictupdate.py | ensure_dict_key | python | def ensure_dict_key(
in_dict,
keys,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more key... | Ensures that in_dict contains the series of recursive keys defined in keys.
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more keys.
:param str delimiter: The delimiter to use in `keys`. Defaults to ':'.
:param bool ordered_dict: Create OrderedDicts if ke... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L142-L166 | null | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/utils/dictupdate.py | _dict_rpartition | python | def _dict_rpartition(
in_dict,
keys,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Helper function to:
- Ensure all but the last key in `keys` exist recursively in `in_dict`.
- Return the dict at the one-to-last key, and the last key
:param dict in_dict: T... | Helper function to:
- Ensure all but the last key in `keys` exist recursively in `in_dict`.
- Return the dict at the one-to-last key, and the last key
:param dict in_dict: The dict to work with.
:param str keys: The delimited string with one or more keys.
:param str delimiter: The delimiter to use ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L169-L200 | [
"def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM):\n '''\n Traverse a dict using a colon-delimited (or otherwise delimited, using the\n 'delimiter' param) target string. The target 'foo:bar:baz' will return\n data['foo']['bar']['baz'] if this value exists, and will otherwise re... | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/utils/dictupdate.py | set_dict_key_value | python | def set_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also sets whatever is at the end of `in_dict` traversed with `keys` to `value`.
:par... | Ensures that in_dict contains the series of recursive keys defined in keys.
Also sets whatever is at the end of `in_dict` traversed with `keys` to `value`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The value to assign... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L204-L228 | [
"def _dict_rpartition(\n in_dict,\n keys,\n delimiter=DEFAULT_TARGET_DELIM,\n ordered_dict=False):\n '''\n Helper function to:\n - Ensure all but the last key in `keys` exist recursively in `in_dict`.\n - Return the dict at the one-to-last key, and the last key\n\n :param ... | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/utils/dictupdate.py | update_dict_key_value | python | def update_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also updates the dict, that is at the end of `in_dict` traversed with `keys`,
with... | Ensures that in_dict contains the series of recursive keys defined in keys.
Also updates the dict, that is at the end of `in_dict` traversed with `keys`,
with `value`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L232-L266 | [
"def _dict_rpartition(\n in_dict,\n keys,\n delimiter=DEFAULT_TARGET_DELIM,\n ordered_dict=False):\n '''\n Helper function to:\n - Ensure all but the last key in `keys` exist recursively in `in_dict`.\n - Return the dict at the one-to-last key, and the last key\n\n :param ... | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/utils/dictupdate.py | append_dict_key_value | python | def append_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also appends `value` to the list that is at the end of `in_dict` traversed
with `k... | Ensures that in_dict contains the series of recursive keys defined in keys.
Also appends `value` to the list that is at the end of `in_dict` traversed
with `keys`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The val... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L270-L301 | [
"def _dict_rpartition(\n in_dict,\n keys,\n delimiter=DEFAULT_TARGET_DELIM,\n ordered_dict=False):\n '''\n Helper function to:\n - Ensure all but the last key in `keys` exist recursively in `in_dict`.\n - Return the dict at the one-to-last key, and the last key\n\n :param ... | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/utils/dictupdate.py | extend_dict_key_value | python | def extend_dict_key_value(
in_dict,
keys,
value,
delimiter=DEFAULT_TARGET_DELIM,
ordered_dict=False):
'''
Ensures that in_dict contains the series of recursive keys defined in keys.
Also extends the list, that is at the end of `in_dict` traversed with `keys`,
with... | Ensures that in_dict contains the series of recursive keys defined in keys.
Also extends the list, that is at the end of `in_dict` traversed with `keys`,
with `value`.
:param dict in_dict: The dictionary to work with
:param str keys: The delimited string with one or more keys.
:param any value: The... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L305-L340 | [
"def _dict_rpartition(\n in_dict,\n keys,\n delimiter=DEFAULT_TARGET_DELIM,\n ordered_dict=False):\n '''\n Helper function to:\n - Ensure all but the last key in `keys` exist recursively in `in_dict`.\n - Return the dict at the one-to-last key, and the last key\n\n :param ... | # -*- coding: utf-8 -*-
'''
Alex Martelli's soulution for recursive dict update from
http://stackoverflow.com/a/3233356
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping... |
saltstack/salt | salt/cli/batch.py | get_bnum | python | def get_bnum(opts, minions, quiet):
'''
Return the active number of minions to maintain
'''
partition = lambda x: float(x) / 100.0 * len(minions)
try:
if '%' in opts['batch']:
res = partition(float(opts['batch'].strip('%')))
if res < 1:
return int(math... | Return the active number of minions to maintain | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L29-L46 | [
"def print_cli(msg, retries=10, step=0.01):\n '''\n Wrapper around print() that suppresses tracebacks on broken pipes (i.e.\n when salt output is piped to less and less is stopped prematurely).\n '''\n while retries:\n try:\n try:\n print(msg)\n except Unic... | # -*- coding: utf-8 -*-
'''
Execute batch runs
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import math
import time
import copy
from datetime import datetime, timedelta
# Import salt libs
import salt.utils.stringutils
import salt.client
import salt.output
import sa... |
saltstack/salt | salt/cli/batch.py | Batch.__gather_minions | python | def __gather_minions(self):
'''
Return a list of minions to use for the batch run
'''
args = [self.opts['tgt'],
'test.ping',
[],
self.opts['timeout'],
]
selected_target_option = self.opts.get('selected_target_option... | Return a list of minions to use for the batch run | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L115-L153 | [
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n",
"def print_cli(msg, retries=10, step=0.01):\n '''\n Wrapper around print() that suppresses tracebacks on broken pipes (i.e.\n when salt output is piped to less and less is stopped prematurely).\n '''\n while retries:\n try:\n ... | class Batch(object):
'''
Manage the execution of batch runs
'''
def __init__(self, opts, eauth=None, quiet=False, parser=None):
self.opts = opts
self.eauth = eauth if eauth else {}
self.pub_kwargs = eauth if eauth else {}
self.quiet = quiet
self.local = salt.clien... |
saltstack/salt | salt/cli/batch.py | Batch.run | python | def run(self):
'''
Execute the batch run
'''
args = [[],
self.opts['fun'],
self.opts['arg'],
self.opts['timeout'],
'list',
]
bnum = self.get_bnum()
# No targets to run
if not self.mini... | Execute the batch run | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L166-L349 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n",
"def display_output(data, out=None, opts=None, **kwargs):\n '''\n Print the passed data using the desired output\n '''\n if opts is None:\n opts = {}\n display_data = try_pri... | class Batch(object):
'''
Manage the execution of batch runs
'''
def __init__(self, opts, eauth=None, quiet=False, parser=None):
self.opts = opts
self.eauth = eauth if eauth else {}
self.pub_kwargs = eauth if eauth else {}
self.quiet = quiet
self.local = salt.clien... |
saltstack/salt | salt/modules/dummyproxy_service.py | status | python | def status(name, sig=None):
'''
Return the status for a service via dummy, returns a bool
whether the service is running.
.. versionadded:: 2016.11.3
CLI Example:
.. code-block:: bash
salt '*' service.status <service name>
'''
proxy_fn = 'dummy.service_status'
resp = __p... | Return the status for a service via dummy, returns a bool
whether the service is running.
.. versionadded:: 2016.11.3
CLI Example:
.. code-block:: bash
salt '*' service.status <service name> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dummyproxy_service.py#L127-L146 | null |
# -*- coding: utf-8 -*-
'''
Provide the service module for the dummy proxy used in integration tests
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
import salt.utils.platform
log = logging.getLogger(__name__)
__func_alias__ = {
... |
saltstack/salt | salt/states/xmpp.py | send_msg | python | def send_msg(name, recipient, profile):
'''
Send a message to an XMPP user
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipient: admins@xmpp.example.com/salt
... | Send a message to an XMPP user
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipient: admins@xmpp.example.com/salt
name
The message to send to the XMPP user | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xmpp.py#L31-L63 | null | # -*- coding: utf-8 -*-
'''
Sending Messages over XMPP
==========================
.. versionadded:: 2014.1.0
This state is useful for firing messages during state runs, using the XMPP
protocol
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
... |
saltstack/salt | salt/states/xmpp.py | send_msg_multi | python | def send_msg_multi(name,
profile,
recipients=None,
rooms=None):
'''
Send a message to an list of recipients or rooms
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'... | Send a message to an list of recipients or rooms
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
- profile: my-xmpp-account
- recipients:
- admins@xmpp.example.com/salt
- rooms:
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xmpp.py#L66-L116 | null | # -*- coding: utf-8 -*-
'''
Sending Messages over XMPP
==========================
.. versionadded:: 2014.1.0
This state is useful for firing messages during state runs, using the XMPP
protocol
.. code-block:: yaml
server-warning-message:
xmpp.send_msg:
- name: 'This is a server warning message'
... |
saltstack/salt | salt/states/libcloud_dns.py | zone_present | python | def zone_present(domain, type, profile):
'''
Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str``
... | Ensures a record is present.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param type: Zone type (master / slave), defaults to master
:type type: ``str``
:param profile: The profile key
:type profile: ``str`` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L74-L95 | [
"def state_result(result, message, name, changes=None):\n if changes is None:\n changes = {}\n return {'result': result,\n 'comment': message,\n 'name': name,\n 'changes': changes}\n"
] | # -*- coding: utf-8 -*-
'''
Manage DNS records and zones using libcloud
:codeauthor: Anthony Shaw <anthonyshaw@apache.org>
.. versionadded:: 2016.11.0
Create and delete DNS records or zones through Libcloud. Libcloud's DNS system supports over 20 DNS
providers including Amazon, Google, GoDaddy, Softlayer
This m... |
saltstack/salt | salt/states/libcloud_dns.py | zone_absent | python | def zone_absent(domain, profile):
'''
Ensures a record is absent.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
'''
zones = __salt__['libcloud_dns.list_zones'](profile)
matching_zone = [z for z in zones... | Ensures a record is absent.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param profile: The profile key
:type profile: ``str`` | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L98-L114 | [
"def state_result(result, message, name, changes=None):\n if changes is None:\n changes = {}\n return {'result': result,\n 'comment': message,\n 'name': name,\n 'changes': changes}\n"
] | # -*- coding: utf-8 -*-
'''
Manage DNS records and zones using libcloud
:codeauthor: Anthony Shaw <anthonyshaw@apache.org>
.. versionadded:: 2016.11.0
Create and delete DNS records or zones through Libcloud. Libcloud's DNS system supports over 20 DNS
providers including Amazon, Google, GoDaddy, Softlayer
This m... |
saltstack/salt | salt/states/libcloud_dns.py | record_present | python | def record_present(name, zone, type, data, profile):
'''
Ensures a record is present.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
ar... | Ensures a record is present.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argument.
:type name: ``str``
:param zone: Zone where the... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L117-L155 | [
"def state_result(result, message, name, changes=None):\n if changes is None:\n changes = {}\n return {'result': result,\n 'comment': message,\n 'name': name,\n 'changes': changes}\n"
] | # -*- coding: utf-8 -*-
'''
Manage DNS records and zones using libcloud
:codeauthor: Anthony Shaw <anthonyshaw@apache.org>
.. versionadded:: 2016.11.0
Create and delete DNS records or zones through Libcloud. Libcloud's DNS system supports over 20 DNS
providers including Amazon, Google, GoDaddy, Softlayer
This m... |
saltstack/salt | salt/states/libcloud_dns.py | record_absent | python | def record_absent(name, zone, type, data, profile):
'''
Ensures a record is absent.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argu... | Ensures a record is absent.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argument.
:type name: ``str``
:param zone: Zone where the ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L158-L199 | [
"def state_result(result, message, name, changes=None):\n if changes is None:\n changes = {}\n return {'result': result,\n 'comment': message,\n 'name': name,\n 'changes': changes}\n"
] | # -*- coding: utf-8 -*-
'''
Manage DNS records and zones using libcloud
:codeauthor: Anthony Shaw <anthonyshaw@apache.org>
.. versionadded:: 2016.11.0
Create and delete DNS records or zones through Libcloud. Libcloud's DNS system supports over 20 DNS
providers including Amazon, Google, GoDaddy, Softlayer
This m... |
saltstack/salt | salt/modules/mod_random.py | hash | python | def hash(value, algorithm='sha512'):
'''
.. versionadded:: 2014.7.0
Encodes a value with the specified encoder.
value
The value to be hashed.
algorithm : sha512
The algorithm to use. May be any valid algorithm supported by
hashlib.
CLI Example:
.. code-block:: ba... | .. versionadded:: 2014.7.0
Encodes a value with the specified encoder.
value
The value to be hashed.
algorithm : sha512
The algorithm to use. May be any valid algorithm supported by
hashlib.
CLI Example:
.. code-block:: bash
salt '*' random.hash 'I am a string' ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L46-L80 | null | # -*- coding: utf-8 -*-
'''
Provides access to randomness generators.
=========================================
.. versionadded:: 2014.7.0
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import base64
import hashlib
import random
# Import salt libs
import salt.utils.... |
saltstack/salt | salt/modules/mod_random.py | str_encode | python | def str_encode(value, encoder='base64'):
'''
.. versionadded:: 2014.7.0
value
The value to be encoded.
encoder : base64
The encoder to use on the subsequent string.
CLI Example:
.. code-block:: bash
salt '*' random.str_encode 'I am a new string' base64
'''
if... | .. versionadded:: 2014.7.0
value
The value to be encoded.
encoder : base64
The encoder to use on the subsequent string.
CLI Example:
.. code-block:: bash
salt '*' random.str_encode 'I am a new string' base64 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L83-L122 | null | # -*- coding: utf-8 -*-
'''
Provides access to randomness generators.
=========================================
.. versionadded:: 2014.7.0
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import base64
import hashlib
import random
# Import salt libs
import salt.utils.... |
saltstack/salt | salt/modules/mod_random.py | shadow_hash | python | def shadow_hash(crypt_salt=None, password=None, algorithm='sha512'):
'''
Generates a salted hash suitable for /etc/shadow.
crypt_salt : None
Salt to be used in the generation of the hash. If one is not
provided, a random salt will be generated.
password : None
Value to be salte... | Generates a salted hash suitable for /etc/shadow.
crypt_salt : None
Salt to be used in the generation of the hash. If one is not
provided, a random salt will be generated.
password : None
Value to be salted and hashed. If one is not provided, a random
password will be generated... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L143-L164 | [
"def gen_hash(crypt_salt=None, password=None, algorithm='sha512'):\n '''\n Generate /etc/shadow hash\n '''\n if not HAS_CRYPT:\n raise SaltInvocationError('No crypt module for windows')\n\n hash_algorithms = dict(\n md5='$1$', blowfish='$2a$', sha256='$5$', sha512='$6$'\n )\n if a... | # -*- coding: utf-8 -*-
'''
Provides access to randomness generators.
=========================================
.. versionadded:: 2014.7.0
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import base64
import hashlib
import random
# Import salt libs
import salt.utils.... |
saltstack/salt | salt/modules/mod_random.py | rand_int | python | def rand_int(start=1, end=10, seed=None):
'''
Returns a random integer number between the start and end number.
.. versionadded: 2015.5.3
start : 1
Any valid integer number
end : 10
Any valid integer number
seed :
Optional hashable object
.. versionchanged:: 2019... | Returns a random integer number between the start and end number.
.. versionadded: 2015.5.3
start : 1
Any valid integer number
end : 10
Any valid integer number
seed :
Optional hashable object
.. versionchanged:: 2019.2.0
Added seed argument. Will return the same... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L167-L194 | null | # -*- coding: utf-8 -*-
'''
Provides access to randomness generators.
=========================================
.. versionadded:: 2014.7.0
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import base64
import hashlib
import random
# Import salt libs
import salt.utils.... |
saltstack/salt | salt/modules/mod_random.py | seed | python | def seed(range=10, hash=None):
'''
Returns a random number within a range. Optional hash argument can
be any hashable object. If hash is omitted or None, the id of the minion is used.
.. versionadded: 2015.8.0
hash: None
Any hashable object.
range: 10
Any valid integer number
... | Returns a random number within a range. Optional hash argument can
be any hashable object. If hash is omitted or None, the id of the minion is used.
.. versionadded: 2015.8.0
hash: None
Any hashable object.
range: 10
Any valid integer number
CLI Example:
.. code-block:: bash... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L197-L220 | null | # -*- coding: utf-8 -*-
'''
Provides access to randomness generators.
=========================================
.. versionadded:: 2014.7.0
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import base64
import hashlib
import random
# Import salt libs
import salt.utils.... |
saltstack/salt | salt/auth/mysql.py | __get_connection_info | python | def __get_connection_info():
'''
Grab MySQL Connection Details
'''
conn_info = {}
try:
conn_info['hostname'] = __opts__['mysql_auth']['hostname']
conn_info['username'] = __opts__['mysql_auth']['username']
conn_info['password'] = __opts__['mysql_auth']['password']
con... | Grab MySQL Connection Details | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/mysql.py#L83-L100 | null | # -*- coding: utf-8 -*-
'''
Provide authentication using MySQL.
When using MySQL as an authentication backend, you will need to create or
use an existing table that has a username and a password column.
To get started, create a simple table that holds just a username and
a password. The password field will hold a SH... |
saltstack/salt | salt/auth/mysql.py | auth | python | def auth(username, password):
'''
Authenticate using a MySQL user table
'''
_info = __get_connection_info()
if _info is None:
return False
try:
conn = MySQLdb.connect(_info['hostname'],
_info['username'],
_info['pass... | Authenticate using a MySQL user table | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/mysql.py#L103-L127 | [
"def __get_connection_info():\n '''\n Grab MySQL Connection Details\n '''\n conn_info = {}\n\n try:\n conn_info['hostname'] = __opts__['mysql_auth']['hostname']\n conn_info['username'] = __opts__['mysql_auth']['username']\n conn_info['password'] = __opts__['mysql_auth']['password... | # -*- coding: utf-8 -*-
'''
Provide authentication using MySQL.
When using MySQL as an authentication backend, you will need to create or
use an existing table that has a username and a password column.
To get started, create a simple table that holds just a username and
a password. The password field will hold a SH... |
saltstack/salt | salt/modules/uptime.py | create | python | def create(name, **params):
'''Create a check on a given URL.
Additional parameters can be used and are passed to API (for
example interval, maxTime, etc). See the documentation
https://github.com/fzaninotto/uptime for a full list of the
parameters.
CLI Example:
.. code-block:: bash
... | Create a check on a given URL.
Additional parameters can be used and are passed to API (for
example interval, maxTime, etc). See the documentation
https://github.com/fzaninotto/uptime for a full list of the
parameters.
CLI Example:
.. code-block:: bash
salt '*' uptime.create http://e... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L32-L60 | [
"def check_exists(name):\n '''\n Check if a given URL is in being monitored by uptime\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' uptime.check_exists http://example.org\n '''\n if name in checks_list():\n log.debug('[uptime] found %s in checks', name)\n return True\... | # -*- coding: utf-8 -*-
'''
Wrapper around uptime API
=========================
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
from salt.exceptions import CommandExecutionError
try:
import requests
ENABLED = True
except Impo... |
saltstack/salt | salt/modules/uptime.py | delete | python | def delete(name):
'''
Delete a check on a given URL
CLI Example:
.. code-block:: bash
salt '*' uptime.delete http://example.org
'''
if not check_exists(name):
msg = "Trying to delete check that doesn't exists : {0}".format(name)
log.error(msg)
raise CommandExec... | Delete a check on a given URL
CLI Example:
.. code-block:: bash
salt '*' uptime.delete http://example.org | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L63-L87 | [
"def check_exists(name):\n '''\n Check if a given URL is in being monitored by uptime\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' uptime.check_exists http://example.org\n '''\n if name in checks_list():\n log.debug('[uptime] found %s in checks', name)\n return True\... | # -*- coding: utf-8 -*-
'''
Wrapper around uptime API
=========================
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
from salt.exceptions import CommandExecutionError
try:
import requests
ENABLED = True
except Impo... |
saltstack/salt | salt/modules/uptime.py | checks_list | python | def checks_list():
'''
List URL checked by uptime
CLI Example:
.. code-block:: bash
salt '*' uptime.checks_list
'''
application_url = _get_application_url()
log.debug('[uptime] get checks')
jcontent = requests.get('{0}/api/checks'.format(application_url)).json()
return [x[... | List URL checked by uptime
CLI Example:
.. code-block:: bash
salt '*' uptime.checks_list | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L103-L116 | [
"def _get_application_url():\n '''\n Helper function to get application url from pillar\n '''\n application_url = __salt__['pillar.get']('uptime:application_url')\n if application_url is None:\n log.error('Could not load uptime:application_url pillar')\n raise CommandExecutionError(\n ... | # -*- coding: utf-8 -*-
'''
Wrapper around uptime API
=========================
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt libs
from salt.exceptions import CommandExecutionError
try:
import requests
ENABLED = True
except Impo... |
saltstack/salt | salt/states/acme.py | cert | python | def cert(name,
aliases=None,
email=None,
webroot=None,
test_cert=False,
renew=None,
keysize=None,
server=None,
owner='root',
group='root',
mode='0640',
certname=None,
preferred_challenges=None,
tls_sni_0... | Obtain/renew a certificate from an ACME CA, probably Let's Encrypt.
:param name: Common Name of the certificate (DNS name of certificate)
:param aliases: subjectAltNames (Additional DNS names on certificate)
:param email: e-mail address for interaction with ACME provider
:param webroot: True or a full ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/acme.py#L42-L161 | null | # -*- coding: utf-8 -*-
'''
ACME / Let's Encrypt certificate management state
=================================================
.. versionadded: 2016.3
See also the module documentation
.. code-block:: yaml
reload-gitlab:
cmd.run:
- name: gitlab-ctl hup
dev.example.com:
acme.cert:
... |
saltstack/salt | salt/states/vagrant.py | _vagrant_call | python | def _vagrant_call(node, function, section, comment, status_when_done=None, **kwargs):
'''
Helper to call the vagrant functions. Wildcards supported.
:param node: The Salt-id or wildcard
:param function: the vagrant submodule to call
:param section: the name for the state call.
:param comment: w... | Helper to call the vagrant functions. Wildcards supported.
:param node: The Salt-id or wildcard
:param function: the vagrant submodule to call
:param section: the name for the state call.
:param comment: what the state reply should say
:param status_when_done: the Vagrant status expected for this s... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L77-L127 | null | # -*- coding: utf-8 -*-
r'''
Manage Vagrant VMs
==================
Manange execution of Vagrant virtual machines on Salt minions.
Vagrant_ is a tool for building and managing virtual machine environments.
It can use various providers, such as VirtualBox_, Docker_, or VMware_, to run its VMs.
Vagrant provides some of ... |
saltstack/salt | salt/states/vagrant.py | running | python | def running(name, **kwargs):
r'''
Defines and starts a new VM with specified arguments, or restart a
VM (or group of VMs). (Runs ``vagrant up``.)
:param name: the Salt_id node name you wish your VM to have.
If ``name`` contains a "?" or "*" then it will re-start a group of VMs
which have been... | r'''
Defines and starts a new VM with specified arguments, or restart a
VM (or group of VMs). (Runs ``vagrant up``.)
:param name: the Salt_id node name you wish your VM to have.
If ``name`` contains a "?" or "*" then it will re-start a group of VMs
which have been paused or stopped.
Each mac... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L130-L194 | [
"def _vagrant_call(node, function, section, comment, status_when_done=None, **kwargs):\n '''\n Helper to call the vagrant functions. Wildcards supported.\n\n :param node: The Salt-id or wildcard\n :param function: the vagrant submodule to call\n :param section: the name for the state call.\n :para... | # -*- coding: utf-8 -*-
r'''
Manage Vagrant VMs
==================
Manange execution of Vagrant virtual machines on Salt minions.
Vagrant_ is a tool for building and managing virtual machine environments.
It can use various providers, such as VirtualBox_, Docker_, or VMware_, to run its VMs.
Vagrant provides some of ... |
saltstack/salt | salt/states/vagrant.py | _find_init_change | python | def _find_init_change(name, ret, **kwargs):
'''
look for changes from any previous init of machine.
:return: modified ret and kwargs
'''
kwargs = salt.utils.args.clean_kwargs(**kwargs)
if 'vm' in kwargs:
kwargs.update(kwargs.pop('vm'))
# the state processing eats 'runas' so we renam... | look for changes from any previous init of machine.
:return: modified ret and kwargs | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L197-L223 | [
"def clean_kwargs(**kwargs):\n '''\n Return a dict without any of the __pub* keys (or any other keys starting\n with a dunder) from the kwargs dict passed into the execution module\n functions. These keys are useful for tracking what was used to invoke\n the function call, but they may not be desirab... | # -*- coding: utf-8 -*-
r'''
Manage Vagrant VMs
==================
Manange execution of Vagrant virtual machines on Salt minions.
Vagrant_ is a tool for building and managing virtual machine environments.
It can use various providers, such as VirtualBox_, Docker_, or VMware_, to run its VMs.
Vagrant provides some of ... |
saltstack/salt | salt/states/vagrant.py | initialized | python | def initialized(name, **kwargs):
r'''
Defines a new VM with specified arguments, but does not start it.
:param name: the Salt_id node name you wish your VM to have.
Each machine must be initialized individually using this function
or the "vagrant.running" function, or the vagrant.init execution mo... | r'''
Defines a new VM with specified arguments, but does not start it.
:param name: the Salt_id node name you wish your VM to have.
Each machine must be initialized individually using this function
or the "vagrant.running" function, or the vagrant.init execution module call.
This command will not... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L226-L280 | [
"def _find_init_change(name, ret, **kwargs):\n '''\n look for changes from any previous init of machine.\n\n :return: modified ret and kwargs\n '''\n kwargs = salt.utils.args.clean_kwargs(**kwargs)\n if 'vm' in kwargs:\n kwargs.update(kwargs.pop('vm'))\n # the state processing eats 'runa... | # -*- coding: utf-8 -*-
r'''
Manage Vagrant VMs
==================
Manange execution of Vagrant virtual machines on Salt minions.
Vagrant_ is a tool for building and managing virtual machine environments.
It can use various providers, such as VirtualBox_, Docker_, or VMware_, to run its VMs.
Vagrant provides some of ... |
saltstack/salt | salt/modules/pw_user.py | _get_gecos | python | def _get_gecos(name):
'''
Retrieve GECOS field info and return it in dictionary form
'''
try:
gecos_field = pwd.getpwnam(name).pw_gecos.split(',', 3)
except KeyError:
raise CommandExecutionError(
'User \'{0}\' does not exist'.format(name)
)
if not gecos_field:... | Retrieve GECOS field info and return it in dictionary form | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L70-L89 | null | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | add | python | def add(name,
uid=None,
gid=None,
groups=None,
home=None,
shell=None,
unique=True,
fullname='',
roomnumber='',
workphone='',
homephone='',
createhome=True,
loginclass=None,
**kwargs):
'''
Add a user to the mi... | Add a user to the minion
CLI Example:
.. code-block:: bash
salt '*' user.add name <uid> <gid> <groups> <home> <shell> | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L122-L176 | [
"def is_true(value=None):\n '''\n Returns a boolean value representing the \"truth\" of the value passed. The\n rules for what is a \"True\" value are:\n\n 1. Integer/float values greater than 0\n 2. The string values \"True\" and \"true\"\n 3. Any object for which bool(obj) returns Tr... | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | getent | python | def getent(refresh=False):
'''
Return the list of all info for all users
CLI Example:
.. code-block:: bash
salt '*' user.getent
'''
if 'user.getent' in __context__ and not refresh:
return __context__['user.getent']
ret = []
for data in pwd.getpwall():
ret.appe... | Return the list of all info for all users
CLI Example:
.. code-block:: bash
salt '*' user.getent | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L199-L216 | [
"def info(name):\n '''\n Return user information\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' user.info root\n '''\n ret = {}\n try:\n data = pwd.getpwnam(name)\n ret['gid'] = data.pw_gid\n ret['groups'] = list_groups(name)\n ret['home'] = data.pw_di... | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | chuid | python | def chuid(name, uid):
'''
Change the uid for a named user
CLI Example:
.. code-block:: bash
salt '*' user.chuid foo 4376
'''
pre_info = info(name)
if not pre_info:
raise CommandExecutionError(
'User \'{0}\' does not exist'.format(name)
)
if uid == p... | Change the uid for a named user
CLI Example:
.. code-block:: bash
salt '*' user.chuid foo 4376 | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L219-L238 | [
"def info(name):\n '''\n Return user information\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' user.info root\n '''\n ret = {}\n try:\n data = pwd.getpwnam(name)\n ret['gid'] = data.pw_gid\n ret['groups'] = list_groups(name)\n ret['home'] = data.pw_di... | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | chloginclass | python | def chloginclass(name, loginclass, root=None):
'''
Change the default login class of the user
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt '*' user.chloginclass foo staff
'''
if loginclass == get_loginclass(name):
return True
cmd = ['pw', 'usermo... | Change the default login class of the user
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt '*' user.chloginclass foo staff | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L405-L425 | [
"def get_loginclass(name):\n '''\n Get the login class of the user\n\n .. versionadded:: 2016.3.0\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' user.get_loginclass foo\n\n '''\n\n userinfo = __salt__['cmd.run_stdout'](['pw', 'usershow', '-n', name])\n userinfo = userinfo.spli... | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | info | python | def info(name):
'''
Return user information
CLI Example:
.. code-block:: bash
salt '*' user.info root
'''
ret = {}
try:
data = pwd.getpwnam(name)
ret['gid'] = data.pw_gid
ret['groups'] = list_groups(name)
ret['home'] = data.pw_dir
ret['name'... | Return user information
CLI Example:
.. code-block:: bash
salt '*' user.info root | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L428-L459 | [
"def list_groups(name):\n '''\n Return a list of groups the named user belongs to\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' user.list_groups foo\n '''\n return salt.utils.user.get_group_list(name)\n"
] | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | get_loginclass | python | def get_loginclass(name):
'''
Get the login class of the user
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' user.get_loginclass foo
'''
userinfo = __salt__['cmd.run_stdout'](['pw', 'usershow', '-n', name])
userinfo = userinfo.split(':')
return u... | Get the login class of the user
.. versionadded:: 2016.3.0
CLI Example:
.. code-block:: bash
salt '*' user.get_loginclass foo | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L462-L479 | null | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/modules/pw_user.py | rename | python | def rename(name, new_name):
'''
Change the username for a named user
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name
'''
current_info = info(name)
if not current_info:
raise CommandExecutionError('User \'{0}\' does not exist'.format(name))
new_info... | Change the username for a named user
CLI Example:
.. code-block:: bash
salt '*' user.rename name new_name | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L508-L531 | [
"def info(name):\n '''\n Return user information\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' user.info root\n '''\n ret = {}\n try:\n data = pwd.getpwnam(name)\n ret['gid'] = data.pw_gid\n ret['groups'] = list_groups(name)\n ret['home'] = data.pw_di... | # -*- coding: utf-8 -*-
'''
Manage users with the pw command
.. important::
If you feel that Salt should be using this module to manage users on a
minion, and it is using a different module (or gives an error similar to
*'user.info' is not available*), see :ref:`here
<module-provider-override>`.
'''
#... |
saltstack/salt | salt/proxy/nxos_api.py | init | python | def init(opts):
'''
Open the connection to the Nexsu switch over the NX-API.
As the communication is HTTP based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock``)
... | Open the connection to the Nexsu switch over the NX-API.
As the communication is HTTP based, there is no connection to maintain,
however, in order to test the connectivity and make sure we are able to
bring up this Minion, we are executing a very simple command (``show clock``)
which doesn't come with ... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos_api.py#L142-L167 | null | # -*- coding: utf-8 -*-
'''
Proxy Minion to manage Cisco Nexus Switches (NX-OS) over the NX-API
.. versionadded:: 2019.2.0
Proxy module for managing Cisco Nexus switches via the NX-API.
:codeauthor: Mircea Ulinic <ping@mirceaulinic.net>
:maturity: new
:platform: any
Usage
=====
.. note::
To be able to use... |
saltstack/salt | salt/proxy/nxos_api.py | rpc | python | def rpc(commands, method='cli', **kwargs):
'''
Executes an RPC request over the NX-API.
'''
conn_args = nxos_device['conn_args']
conn_args.update(kwargs)
return __utils__['nxos_api.rpc'](commands, method=method, **conn_args) | Executes an RPC request over the NX-API. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos_api.py#L203-L209 | null | # -*- coding: utf-8 -*-
'''
Proxy Minion to manage Cisco Nexus Switches (NX-OS) over the NX-API
.. versionadded:: 2019.2.0
Proxy module for managing Cisco Nexus switches via the NX-API.
:codeauthor: Mircea Ulinic <ping@mirceaulinic.net>
:maturity: new
:platform: any
Usage
=====
.. note::
To be able to use... |
saltstack/salt | salt/cloud/__init__.py | communicator | python | def communicator(func):
'''Warning, this is a picklable decorator !'''
def _call(queue, args, kwargs):
'''called with [queue, args, kwargs] as first optional arg'''
kwargs['queue'] = queue
ret = None
try:
ret = func(*args, **kwargs)
queue.put('END')
... | Warning, this is a picklable decorator ! | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L60-L85 | null | # -*- coding: utf-8 -*-
'''
The top level interface used to translate configuration data back to the
correct cloud modules
'''
# Import python libs
from __future__ import absolute_import, print_function, generators, unicode_literals
import os
import copy
import glob
import time
import signal
import logging
import trac... |
saltstack/salt | salt/cloud/__init__.py | enter_mainloop | python | def enter_mainloop(target,
mapped_args=None,
args=None,
kwargs=None,
pool=None,
pool_size=None,
callback=None,
queue=None):
'''
Manage a multiprocessing pool
- If the queue d... | Manage a multiprocessing pool
- If the queue does not output anything, the pool runs indefinitely
- If the queue returns KEYBOARDINT or ERROR, this will kill the pool
totally calling terminate & join and ands with a SaltCloudSystemExit
exception notifying callers from the abnormal termination
... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L88-L182 | null | # -*- coding: utf-8 -*-
'''
The top level interface used to translate configuration data back to the
correct cloud modules
'''
# Import python libs
from __future__ import absolute_import, print_function, generators, unicode_literals
import os
import copy
import glob
import time
import signal
import logging
import trac... |
saltstack/salt | salt/cloud/__init__.py | create_multiprocessing | python | def create_multiprocessing(parallel_data, queue=None):
'''
This function will be called from another process when running a map in
parallel mode. The result from the create is always a json object.
'''
salt.utils.crypt.reinit_crypto()
parallel_data['opts']['output'] = 'json'
cloud = Cloud(p... | This function will be called from another process when running a map in
parallel mode. The result from the create is always a json object. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2304-L2330 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | # -*- coding: utf-8 -*-
'''
The top level interface used to translate configuration data back to the
correct cloud modules
'''
# Import python libs
from __future__ import absolute_import, print_function, generators, unicode_literals
import os
import copy
import glob
import time
import signal
import logging
import trac... |
saltstack/salt | salt/cloud/__init__.py | destroy_multiprocessing | python | def destroy_multiprocessing(parallel_data, queue=None):
'''
This function will be called from another process when running a map in
parallel mode. The result from the destroy is always a json object.
'''
salt.utils.crypt.reinit_crypto()
parallel_data['opts']['output'] = 'json'
clouds = salt... | This function will be called from another process when running a map in
parallel mode. The result from the destroy is always a json object. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2333-L2363 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | # -*- coding: utf-8 -*-
'''
The top level interface used to translate configuration data back to the
correct cloud modules
'''
# Import python libs
from __future__ import absolute_import, print_function, generators, unicode_literals
import os
import copy
import glob
import time
import signal
import logging
import trac... |
saltstack/salt | salt/cloud/__init__.py | run_parallel_map_providers_query | python | def run_parallel_map_providers_query(data, queue=None):
'''
This function will be called from another process when building the
providers map.
'''
salt.utils.crypt.reinit_crypto()
cloud = Cloud(data['opts'])
try:
with salt.utils.context.func_globals_inject(
cloud.clouds[... | This function will be called from another process when building the
providers map. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2366-L2395 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | # -*- coding: utf-8 -*-
'''
The top level interface used to translate configuration data back to the
correct cloud modules
'''
# Import python libs
from __future__ import absolute_import, print_function, generators, unicode_literals
import os
import copy
import glob
import time
import signal
import logging
import trac... |
saltstack/salt | salt/cloud/__init__.py | CloudClient._opts_defaults | python | def _opts_defaults(self, **kwargs):
'''
Set the opts dict to defaults and allow for opts to be overridden in
the kwargs
'''
# Let's start with the default salt cloud configuration
opts = salt.config.DEFAULT_CLOUD_OPTS.copy()
# Update it with the loaded configurati... | Set the opts dict to defaults and allow for opts to be overridden in
the kwargs | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L219-L257 | [
"def itervalues(d, **kw):\n return d.itervalues(**kw)\n"
] | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.low | python | def low(self, fun, low):
'''
Pass the cloud function and low data structure to run
'''
l_fun = getattr(self, fun)
f_call = salt.utils.args.format_call(l_fun, low)
return l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {})) | Pass the cloud function and low data structure to run | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L259-L265 | [
"def format_call(fun,\n data,\n initial_ret=None,\n expected_extra_kws=(),\n is_class_method=None):\n '''\n Build the required arguments and keyword arguments required for the passed\n function.\n\n :param fun: The function to get the argspec f... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.list_sizes | python | def list_sizes(self, provider=None):
'''
List all available sizes in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.size_list(provider)
) | List all available sizes in configured cloud systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L267-L274 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.list_images | python | def list_images(self, provider=None):
'''
List all available images in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.image_list(provider)
) | List all available images in configured cloud systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L276-L283 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.list_locations | python | def list_locations(self, provider=None):
'''
List all available locations in configured cloud systems
'''
mapper = salt.cloud.Map(self._opts_defaults())
return salt.utils.data.simple_types_filter(
mapper.location_list(provider)
) | List all available locations in configured cloud systems | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L285-L292 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.min_query | python | def min_query(self, query_type='list_nodes_min'):
'''
Query select instance information
'''
mapper = salt.cloud.Map(self._opts_defaults())
mapper.opts['selected_query_option'] = 'list_nodes_min'
return mapper.map_providers_parallel(query_type) | Query select instance information | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L318-L324 | [
"def _opts_defaults(self, **kwargs):\n '''\n Set the opts dict to defaults and allow for opts to be overridden in\n the kwargs\n '''\n # Let's start with the default salt cloud configuration\n opts = salt.config.DEFAULT_CLOUD_OPTS.copy()\n # Update it with the loaded configuration\n opts.upd... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.profile | python | def profile(self, profile, names, vm_overrides=None, **kwargs):
'''
Pass in a profile to create, names is a list of vm names to allocate
vm_overrides is a special dict that will be per node options
overrides
Example:
.. code-block:: python
>>> clie... | Pass in a profile to create, names is a list of vm names to allocate
vm_overrides is a special dict that will be per node options
overrides
Example:
.. code-block:: python
>>> client= salt.cloud.CloudClient(path='/etc/salt/cloud')
>>> client.profile('d... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L326-L366 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.map_run | python | def map_run(self, path=None, **kwargs):
'''
To execute a map
'''
kwarg = {}
if path:
kwarg['map'] = path
kwarg.update(kwargs)
mapper = salt.cloud.Map(self._opts_defaults(**kwarg))
dmap = mapper.map_data()
return salt.utils.data.simple_t... | To execute a map | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L368-L380 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.destroy | python | def destroy(self, names):
'''
Destroy the named VMs
'''
mapper = salt.cloud.Map(self._opts_defaults(destroy=True))
if isinstance(names, six.string_types):
names = names.split(',')
return salt.utils.data.simple_types_filter(
mapper.destroy(names)
... | Destroy the named VMs | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L382-L391 | [
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool)\n simpletypes_values = tuple... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.create | python | def create(self, provider, names, **kwargs):
'''
Create the named VMs, without using a profile
Example:
.. code-block:: python
client.create(provider='my-ec2-config', names=['myinstance'],
image='ami-1624987f', size='t1.micro', ssh_username='ec2-user',
... | Create the named VMs, without using a profile
Example:
.. code-block:: python
client.create(provider='my-ec2-config', names=['myinstance'],
image='ami-1624987f', size='t1.micro', ssh_username='ec2-user',
securitygroup='default', delvol_on_destroy=True) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L393-L430 | [
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n",
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.extra_action | python | def extra_action(self, names, provider, action, **kwargs):
'''
Perform actions with block storage devices
Example:
.. code-block:: python
client.extra_action(names=['myblock'], action='volume_create',
provider='my-nova', kwargs={'voltype': 'SSD', 'size': 10... | Perform actions with block storage devices
Example:
.. code-block:: python
client.extra_action(names=['myblock'], action='volume_create',
provider='my-nova', kwargs={'voltype': 'SSD', 'size': 1000}
)
client.extra_action(names=['salt-net'], action='n... | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L432-L466 | [
"def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n",
"def simple_types_filter(data):\n '''\n Convert the data list, dictionary into simple types, i.e., int, float, string,\n bool, etc.\n '''\n if data is None:\n return data\n\n simpletypes_keys = (six.string_types, six.text_type, six.... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | CloudClient.action | python | def action(
self,
fun=None,
cloudmap=None,
names=None,
provider=None,
instance=None,
kwargs=None
):
'''
Execute a single action via the cloud plugin backend
Examples:
.. code-block:: python
client.action(fun='show... | Execute a single action via the cloud plugin backend
Examples:
.. code-block:: python
client.action(fun='show_instance', names=['myinstance'])
client.action(fun='show_image', provider='my-ec2-config',
kwargs={'image': 'ami-10314d79'}
) | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L468-L518 | [
"def _opts_defaults(self, **kwargs):\n '''\n Set the opts dict to defaults and allow for opts to be overridden in\n the kwargs\n '''\n # Let's start with the default salt cloud configuration\n opts = salt.config.DEFAULT_CLOUD_OPTS.copy()\n # Update it with the loaded configuration\n opts.upd... | class CloudClient(object):
'''
The client class to wrap cloud interactions
'''
def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
if opts:
self.opts = opts
elif path:
self.opts = salt.config.cloud_config(path)
else:
self.o... |
saltstack/salt | salt/cloud/__init__.py | Cloud.get_configured_providers | python | def get_configured_providers(self):
'''
Return the configured providers
'''
providers = set()
for alias, drivers in six.iteritems(self.opts['providers']):
if len(drivers) > 1:
for driver in drivers:
providers.add('{0}:{1}'.format(al... | Return the configured providers | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L532-L543 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | class Cloud(object):
'''
An object for the creation of new VMs
'''
def __init__(self, opts):
self.opts = opts
self.client = CloudClient(opts=self.opts)
self.clouds = salt.loader.clouds(self.opts)
self.__filter_non_working_providers()
self.__cached_provider_queries... |
saltstack/salt | salt/cloud/__init__.py | Cloud.lookup_providers | python | def lookup_providers(self, lookup):
'''
Get a dict describing the configured providers
'''
if lookup is None:
lookup = 'all'
if lookup == 'all':
providers = set()
for alias, drivers in six.iteritems(self.opts['providers']):
for ... | Get a dict describing the configured providers | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L545-L587 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def get_configured_providers(self):\n '''\n Return the configured providers\n '''\n providers = set()\n for alias, drivers in six.iteritems(self.opts['providers']):\n if len(drivers) > 1:\n for driver in drivers:\n ... | class Cloud(object):
'''
An object for the creation of new VMs
'''
def __init__(self, opts):
self.opts = opts
self.client = CloudClient(opts=self.opts)
self.clouds = salt.loader.clouds(self.opts)
self.__filter_non_working_providers()
self.__cached_provider_queries... |
saltstack/salt | salt/cloud/__init__.py | Cloud.lookup_profiles | python | def lookup_profiles(self, provider, lookup):
'''
Return a dictionary describing the configured profiles
'''
if provider is None:
provider = 'all'
if lookup is None:
lookup = 'all'
if lookup == 'all':
profiles = set()
provid... | Return a dictionary describing the configured profiles | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L589-L621 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | class Cloud(object):
'''
An object for the creation of new VMs
'''
def __init__(self, opts):
self.opts = opts
self.client = CloudClient(opts=self.opts)
self.clouds = salt.loader.clouds(self.opts)
self.__filter_non_working_providers()
self.__cached_provider_queries... |
saltstack/salt | salt/cloud/__init__.py | Cloud.map_providers | python | def map_providers(self, query='list_nodes', cached=False):
'''
Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
'''
if cached is True and query in self.__cached_provider_queries:
retur... | Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L623-L657 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | class Cloud(object):
'''
An object for the creation of new VMs
'''
def __init__(self, opts):
self.opts = opts
self.client = CloudClient(opts=self.opts)
self.clouds = salt.loader.clouds(self.opts)
self.__filter_non_working_providers()
self.__cached_provider_queries... |
saltstack/salt | salt/cloud/__init__.py | Cloud.map_providers_parallel | python | def map_providers_parallel(self, query='list_nodes', cached=False):
'''
Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
Same as map_providers but query in parallel.
'''
if cached is True... | Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs
Same as map_providers but query in parallel. | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L659-L715 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n",
"def enter_mainloop(target,\n mapped_args=None,\n args=None,\n kwargs=None,\n pool=None,\n pool_size=None,\n callback=None,\n que... | class Cloud(object):
'''
An object for the creation of new VMs
'''
def __init__(self, opts):
self.opts = opts
self.client = CloudClient(opts=self.opts)
self.clouds = salt.loader.clouds(self.opts)
self.__filter_non_working_providers()
self.__cached_provider_queries... |
saltstack/salt | salt/cloud/__init__.py | Cloud._optimize_providers | python | def _optimize_providers(self, providers):
'''
Return an optimized mapping of available providers
'''
new_providers = {}
provider_by_driver = {}
for alias, driver in six.iteritems(providers):
for name, data in six.iteritems(driver):
if name not... | Return an optimized mapping of available providers | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L763-L795 | [
"def iteritems(d, **kw):\n return d.iteritems(**kw)\n"
] | class Cloud(object):
'''
An object for the creation of new VMs
'''
def __init__(self, opts):
self.opts = opts
self.client = CloudClient(opts=self.opts)
self.clouds = salt.loader.clouds(self.opts)
self.__filter_non_working_providers()
self.__cached_provider_queries... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.