repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
saltstack/salt | salt/modules/boto_vpc.py | route_table_exists | 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... | 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... | [
"def",
"route_table_exists",
"(",
"route_table_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"route_table_name",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"... | Checks if a route table exists.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.route_table_exists route_table_id='rtb-1f382e7d' | [
"Checks",
"if",
"a",
"route",
"table",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2092-L2113 | train |
saltstack/salt | salt/modules/boto_vpc.py | route_exists | 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... | 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... | [
"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",
",",
... | 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' | [
"Checks",
"if",
"a",
"route",
"exists",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2116-L2181 | train |
saltstack/salt | salt/modules/boto_vpc.py | associate_route_table | 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... | 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... | [
"def",
"associate_route_table",
"(",
"route_table_id",
"=",
"None",
",",
"subnet_id",
"=",
"None",
",",
"route_table_name",
"=",
"None",
",",
"subnet_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
... | 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... | [
"Given",
"a",
"route",
"table",
"and",
"subnet",
"name",
"or",
"id",
"associates",
"the",
"route",
"table",
"with",
"the",
"subnet",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2184-L2233 | train |
saltstack/salt | salt/modules/boto_vpc.py | disassociate_route_table | 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... | 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... | [
"def",
"disassociate_route_table",
"(",
"association_id",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"region",
"=",
"region",
",",
"k... | 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' | [
"Dissassociates",
"a",
"route",
"table",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2236-L2260 | train |
saltstack/salt | salt/modules/boto_vpc.py | replace_route_table_association | 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'
'''
... | 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'
'''
... | [
"def",
"replace_route_table_association",
"(",
"association_id",
",",
"route_table_id",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"try",
":",
"conn",
"=",
"_get_conn",
"(",
"regio... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2263-L2282 | train |
saltstack/salt | salt/modules/boto_vpc.py | create_route | 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,
... | 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,
... | [
"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",
",",
"interfa... | 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' | [
"Creates",
"a",
"route",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2285-L2379 | train |
saltstack/salt | salt/modules/boto_vpc.py | delete_route | 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'... | 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'... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2382-L2417 | train |
saltstack/salt | salt/modules/boto_vpc.py | replace_route | 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 ... | 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 ... | [
"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",
"=",... | 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' | [
"Replaces",
"a",
"route",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2420-L2468 | train |
saltstack/salt | salt/modules/boto_vpc.py | describe_route_table | 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... | 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... | [
"def",
"describe_route_table",
"(",
"route_table_id",
"=",
"None",
",",
"route_table_name",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"s... | 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' | [
"Given",
"route",
"table",
"properties",
"return",
"route",
"table",
"details",
"if",
"matching",
"table",
"(",
"s",
")",
"exist",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2471-L2529 | train |
saltstack/salt | salt/modules/boto_vpc.py | describe_route_tables | 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... | 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... | [
"def",
"describe_route_tables",
"(",
"route_table_id",
"=",
"None",
",",
"route_table_name",
"=",
"None",
",",
"vpc_id",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile"... | 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' | [
"Given",
"route",
"table",
"properties",
"return",
"details",
"of",
"all",
"matching",
"route",
"tables",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2532-L2615 | train |
saltstack/salt | salt/modules/boto_vpc.py | _get_subnet_explicit_route_table | 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... | 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... | [
"def",
"_get_subnet_explicit_route_table",
"(",
"subnet_id",
",",
"vpc_id",
",",
"conn",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"if",
"not",
"conn",
":",
"conn... | helper function to find subnet explicit route table associations
.. versionadded:: 2016.11.0 | [
"helper",
"function",
"to",
"find",
"subnet",
"explicit",
"route",
"table",
"associations"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2694-L2708 | train |
saltstack/salt | salt/modules/boto_vpc.py | request_vpc_peering_connection | 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... | 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... | [
"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_reg... | 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... | [
"Request",
"a",
"VPC",
"peering",
"connection",
"between",
"two",
"VPCs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2711-L2826 | train |
saltstack/salt | salt/modules/boto_vpc.py | _get_peering_connection_ids | 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 ... | 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 ... | [
"def",
"_get_peering_connection_ids",
"(",
"name",
",",
"conn",
")",
":",
"filters",
"=",
"[",
"{",
"'Name'",
":",
"'tag:Name'",
",",
"'Values'",
":",
"[",
"name",
"]",
",",
"}",
",",
"{",
"'Name'",
":",
"'status-code'",
",",
"'Values'",
":",
"[",
"ACT... | :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. | [
":",
"param",
"name",
":",
"The",
"name",
"of",
"the",
"VPC",
"peering",
"connection",
".",
":",
"type",
"name",
":",
"String",
":",
"param",
"conn",
":",
"The",
"boto",
"aws",
"ec2",
"connection",
".",
":",
"return",
":",
"The",
"id",
"associated",
... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2829-L2850 | train |
saltstack/salt | salt/modules/boto_vpc.py | describe_vpc_peering_connection | 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... | 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... | [
"def",
"describe_vpc_peering_connection",
"(",
"name",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"conn",
"=",
"_get_conn3",
"(",
"region",
"=",
"region",
",",
"key",
"=",
"key... | 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 ... | [
"Returns",
"any",
"VPC",
"peering",
"connection",
"id",
"(",
"s",
")",
"for",
"the",
"given",
"VPC",
"peering",
"connection",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2853-L2888 | train |
saltstack/salt | salt/modules/boto_vpc.py | accept_vpc_peering_connection | def accept_vpc_peering_connection( # pylint: disable=too-many-arguments
conn_id='',
name='',
region=None,
key=None,
keyid=None,
... | python | def accept_vpc_peering_connection( # pylint: disable=too-many-arguments
conn_id='',
name='',
region=None,
key=None,
keyid=None,
... | [
"def",
"accept_vpc_peering_connection",
"(",
"# pylint: disable=too-many-arguments",
"conn_id",
"=",
"''",
",",
"name",
"=",
"''",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"dry_run",
"=... | 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... | [
"Request",
"a",
"VPC",
"peering",
"connection",
"between",
"two",
"VPCs",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2891-L2953 | train |
saltstack/salt | salt/modules/boto_vpc.py | _vpc_peering_conn_id_for_name | 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:
... | 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:
... | [
"def",
"_vpc_peering_conn_id_for_name",
"(",
"name",
",",
"conn",
")",
":",
"log",
".",
"debug",
"(",
"'Retrieving VPC peering connection id'",
")",
"ids",
"=",
"_get_peering_connection_ids",
"(",
"name",
",",
"conn",
")",
"if",
"not",
"ids",
":",
"ids",
"=",
... | Get the ID associated with this name | [
"Get",
"the",
"ID",
"associated",
"with",
"this",
"name"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2956-L2972 | train |
saltstack/salt | salt/modules/boto_vpc.py | delete_vpc_peering_connection | 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.
... | 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.
... | [
"def",
"delete_vpc_peering_connection",
"(",
"conn_id",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
",",
"dry_run",
"=",
"False",
")",
":",
"if... | 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
... | [
"Delete",
"a",
"VPC",
"peering",
"connection",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L2975-L3033 | train |
saltstack/salt | salt/modules/boto_vpc.py | is_peering_connection_pending | 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... | 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... | [
"def",
"is_peering_connection_pending",
"(",
"conn_id",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"if",
"not",
"_exactly_one",
"(",
... | 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... | [
"Check",
"if",
"a",
"VPC",
"peering",
"connection",
"is",
"in",
"the",
"pending",
"state",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L3036-L3094 | train |
saltstack/salt | salt/modules/boto_vpc.py | peering_connection_pending_from_vpc | 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... | 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... | [
"def",
"peering_connection_pending_from_vpc",
"(",
"conn_id",
"=",
"None",
",",
"conn_name",
"=",
"None",
",",
"vpc_id",
"=",
"None",
",",
"vpc_name",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"prof... | 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... | [
"Check",
"if",
"a",
"VPC",
"peering",
"connection",
"is",
"in",
"the",
"pending",
"state",
"and",
"requested",
"from",
"the",
"given",
"VPC",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_vpc.py#L3097-L3168 | train |
saltstack/salt | salt/utils/botomod.py | cache_id | 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',... | 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',... | [
"def",
"cache_id",
"(",
"service",
",",
"name",
",",
"sub_resource",
"=",
"None",
",",
"resource_id",
"=",
"None",
",",
"invalidate",
"=",
"False",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"... | 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') | [
"Cache",
"invalidate",
"or",
"retrieve",
"an",
"AWS",
"resource",
"id",
"keyed",
"by",
"name",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L115-L150 | train |
saltstack/salt | salt/utils/botomod.py | get_connection | 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... | 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... | [
"def",
"get_connection",
"(",
"service",
",",
"module",
"=",
"None",
",",
"region",
"=",
"None",
",",
"key",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"# future lint: disable=blacklisted-function",
"module",
"=",
"str",
... | Return a boto connection for the service.
.. code-block:: python
conn = __utils__['boto.get_connection']('ec2', profile='custom_profile') | [
"Return",
"a",
"boto",
"connection",
"for",
"the",
"service",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L166-L201 | train |
saltstack/salt | salt/utils/botomod.py | exactly_n | 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) | 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) | [
"def",
"exactly_n",
"(",
"l",
",",
"n",
"=",
"1",
")",
":",
"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). | [
"Tests",
"that",
"exactly",
"N",
"items",
"in",
"an",
"iterable",
"are",
"truthy",
"(",
"neither",
"None",
"False",
"nor",
"0",
")",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L243-L249 | train |
saltstack/salt | salt/utils/botomod.py | assign_funcs | 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
... | 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
... | [
"def",
"assign_funcs",
"(",
"modname",
",",
"service",
",",
"module",
"=",
"None",
",",
"pack",
"=",
"None",
")",
":",
"if",
"pack",
":",
"global",
"__salt__",
"# pylint: disable=W0601",
"__salt__",
"=",
"pack",
"mod",
"=",
"sys",
".",
"modules",
"[",
"m... | Assign _get_conn and _cache_id functions to the named module.
.. code-block:: python
__utils__['boto.assign_partials'](__name__, 'ec2') | [
"Assign",
"_get_conn",
"and",
"_cache_id",
"functions",
"to",
"the",
"named",
"module",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/botomod.py#L256-L273 | train |
saltstack/salt | salt/matchers/ipcidr_match.py | match | 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... | 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... | [
"def",
"match",
"(",
"tgt",
",",
"opts",
"=",
"None",
")",
":",
"if",
"not",
"opts",
":",
"opts",
"=",
"__opts__",
"try",
":",
"# Target is an address?",
"tgt",
"=",
"ipaddress",
".",
"ip_address",
"(",
"tgt",
")",
"except",
":",
"# pylint: disable=bare-ex... | Matches based on IP address or CIDR notation | [
"Matches",
"based",
"on",
"IP",
"address",
"or",
"CIDR",
"notation"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/matchers/ipcidr_match.py#L20-L48 | train |
saltstack/salt | salt/utils/dictupdate.py | update | 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... | 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... | [
"def",
"update",
"(",
"dest",
",",
"upd",
",",
"recursive_update",
"=",
"True",
",",
"merge_lists",
"=",
"False",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"dest",
",",
"Mapping",
")",
")",
"or",
"(",
"not",
"isinstance",
"(",
"upd",
",",
"Mappi... | 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... | [
"Recursive",
"version",
"of",
"the",
"default",
"dict",
".",
"update"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L30-L82 | train |
saltstack/salt | salt/utils/dictupdate.py | ensure_dict_key | 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... | 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... | [
"def",
"ensure_dict_key",
"(",
"in_dict",
",",
"keys",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"if",
"delimiter",
"in",
"keys",
":",
"a_keys",
"=",
"keys",
".",
"split",
"(",
"delimiter",
")",
"else",
":"... | 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... | [
"Ensures",
"that",
"in_dict",
"contains",
"the",
"series",
"of",
"recursive",
"keys",
"defined",
"in",
"keys",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L142-L166 | train |
saltstack/salt | salt/utils/dictupdate.py | _dict_rpartition | 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... | 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... | [
"def",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"if",
"delimiter",
"in",
"keys",
":",
"all_but_last_keys",
",",
"_",
",",
"last_key",
"=",
"keys",
".",
"rpart... | 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 ... | [
"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",
"ke... | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L169-L200 | train |
saltstack/salt | salt/utils/dictupdate.py | set_dict_key_value | 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... | 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... | [
"def",
"set_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"del... | 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... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L204-L228 | train |
saltstack/salt | salt/utils/dictupdate.py | update_dict_key_value | 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... | 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... | [
"def",
"update_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"... | 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... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L232-L266 | train |
saltstack/salt | salt/utils/dictupdate.py | append_dict_key_value | 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... | 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... | [
"def",
"append_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"... | 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... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L270-L301 | train |
saltstack/salt | salt/utils/dictupdate.py | extend_dict_key_value | 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... | 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... | [
"def",
"extend_dict_key_value",
"(",
"in_dict",
",",
"keys",
",",
"value",
",",
"delimiter",
"=",
"DEFAULT_TARGET_DELIM",
",",
"ordered_dict",
"=",
"False",
")",
":",
"dict_pointer",
",",
"last_key",
"=",
"_dict_rpartition",
"(",
"in_dict",
",",
"keys",
",",
"... | 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... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dictupdate.py#L305-L340 | train |
saltstack/salt | salt/cli/batch.py | get_bnum | 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... | 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... | [
"def",
"get_bnum",
"(",
"opts",
",",
"minions",
",",
"quiet",
")",
":",
"partition",
"=",
"lambda",
"x",
":",
"float",
"(",
"x",
")",
"/",
"100.0",
"*",
"len",
"(",
"minions",
")",
"try",
":",
"if",
"'%'",
"in",
"opts",
"[",
"'batch'",
"]",
":",
... | Return the active number of minions to maintain | [
"Return",
"the",
"active",
"number",
"of",
"minions",
"to",
"maintain"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L29-L46 | train |
saltstack/salt | salt/cli/batch.py | Batch.__gather_minions | 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... | 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... | [
"def",
"__gather_minions",
"(",
"self",
")",
":",
"args",
"=",
"[",
"self",
".",
"opts",
"[",
"'tgt'",
"]",
",",
"'test.ping'",
",",
"[",
"]",
",",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
",",
"]",
"selected_target_option",
"=",
"self",
".",
"opt... | Return a list of minions to use for the batch run | [
"Return",
"a",
"list",
"of",
"minions",
"to",
"use",
"for",
"the",
"batch",
"run"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L115-L153 | train |
saltstack/salt | salt/cli/batch.py | Batch.run | 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... | 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... | [
"def",
"run",
"(",
"self",
")",
":",
"args",
"=",
"[",
"[",
"]",
",",
"self",
".",
"opts",
"[",
"'fun'",
"]",
",",
"self",
".",
"opts",
"[",
"'arg'",
"]",
",",
"self",
".",
"opts",
"[",
"'timeout'",
"]",
",",
"'list'",
",",
"]",
"bnum",
"=",
... | Execute the batch run | [
"Execute",
"the",
"batch",
"run"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cli/batch.py#L166-L349 | train |
saltstack/salt | salt/modules/dummyproxy_service.py | status | 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... | 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... | [
"def",
"status",
"(",
"name",
",",
"sig",
"=",
"None",
")",
":",
"proxy_fn",
"=",
"'dummy.service_status'",
"resp",
"=",
"__proxy__",
"[",
"proxy_fn",
"]",
"(",
"name",
")",
"if",
"resp",
"[",
"'comment'",
"]",
"==",
"'stopped'",
":",
"return",
"False",
... | 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> | [
"Return",
"the",
"status",
"for",
"a",
"service",
"via",
"dummy",
"returns",
"a",
"bool",
"whether",
"the",
"service",
"is",
"running",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dummyproxy_service.py#L127-L146 | train |
saltstack/salt | salt/states/xmpp.py | send_msg | 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
... | 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
... | [
"def",
"send_msg",
"(",
"name",
",",
"recipient",
",",
"profile",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
"''",
"}",
"if",
"__opts__",
"[",
"'test'",
"]... | 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 | [
"Send",
"a",
"message",
"to",
"an",
"XMPP",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xmpp.py#L31-L63 | train |
saltstack/salt | salt/states/xmpp.py | send_msg_multi | 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'... | 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'... | [
"def",
"send_msg_multi",
"(",
"name",
",",
"profile",
",",
"recipients",
"=",
"None",
",",
"rooms",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"None",
",",
"'comment'",
":",
... | 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:
... | [
"Send",
"a",
"message",
"to",
"an",
"list",
"of",
"recipients",
"or",
"rooms"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/xmpp.py#L66-L116 | train |
saltstack/salt | salt/states/libcloud_dns.py | zone_present | 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``
... | 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``
... | [
"def",
"zone_present",
"(",
"domain",
",",
"type",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"if",
"not",
"type",
":",
"type",
"=",
"'master'",
"matching_zone",
"=",
"[",
"z",
"for",
"... | 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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L74-L95 | train |
saltstack/salt | salt/states/libcloud_dns.py | zone_absent | 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... | 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... | [
"def",
"zone_absent",
"(",
"domain",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"matching_zone",
"=",
"[",
"z",
"for",
"z",
"in",
"zones",
"if",
"z",
"[",
"'domain'",
"]",
"==",
"domain... | 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`` | [
"Ensures",
"a",
"record",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L98-L114 | train |
saltstack/salt | salt/states/libcloud_dns.py | record_present | 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... | 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... | [
"def",
"record_present",
"(",
"name",
",",
"zone",
",",
"type",
",",
"data",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"try",
":",
"matching_zone",
"=",
"[",
"z",
"for",
"z",
"in",
"... | 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... | [
"Ensures",
"a",
"record",
"is",
"present",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L117-L155 | train |
saltstack/salt | salt/states/libcloud_dns.py | record_absent | 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... | 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... | [
"def",
"record_absent",
"(",
"name",
",",
"zone",
",",
"type",
",",
"data",
",",
"profile",
")",
":",
"zones",
"=",
"__salt__",
"[",
"'libcloud_dns.list_zones'",
"]",
"(",
"profile",
")",
"try",
":",
"matching_zone",
"=",
"[",
"z",
"for",
"z",
"in",
"z... | 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 ... | [
"Ensures",
"a",
"record",
"is",
"absent",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/libcloud_dns.py#L158-L199 | train |
saltstack/salt | salt/modules/mod_random.py | hash | 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... | 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... | [
"def",
"hash",
"(",
"value",
",",
"algorithm",
"=",
"'sha512'",
")",
":",
"if",
"six",
".",
"PY3",
"and",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"# Under Python 3 we must work with bytes",
"value",
"=",
"value",
".",
"encode",... | .. 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' ... | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L46-L80 | train |
saltstack/salt | salt/modules/mod_random.py | str_encode | 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... | 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... | [
"def",
"str_encode",
"(",
"value",
",",
"encoder",
"=",
"'base64'",
")",
":",
"if",
"six",
".",
"PY2",
":",
"try",
":",
"out",
"=",
"value",
".",
"encode",
"(",
"encoder",
")",
"except",
"LookupError",
":",
"raise",
"SaltInvocationError",
"(",
"'You must... | .. 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 | [
"..",
"versionadded",
"::",
"2014",
".",
"7",
".",
"0"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L83-L122 | train |
saltstack/salt | salt/modules/mod_random.py | shadow_hash | 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... | 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... | [
"def",
"shadow_hash",
"(",
"crypt_salt",
"=",
"None",
",",
"password",
"=",
"None",
",",
"algorithm",
"=",
"'sha512'",
")",
":",
"return",
"salt",
".",
"utils",
".",
"pycrypto",
".",
"gen_hash",
"(",
"crypt_salt",
",",
"password",
",",
"algorithm",
")"
] | 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... | [
"Generates",
"a",
"salted",
"hash",
"suitable",
"for",
"/",
"etc",
"/",
"shadow",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L143-L164 | train |
saltstack/salt | salt/modules/mod_random.py | rand_int | 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... | 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... | [
"def",
"rand_int",
"(",
"start",
"=",
"1",
",",
"end",
"=",
"10",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"not",
"None",
":",
"random",
".",
"seed",
"(",
"seed",
")",
"return",
"random",
".",
"randint",
"(",
"start",
",",
"end",
... | 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... | [
"Returns",
"a",
"random",
"integer",
"number",
"between",
"the",
"start",
"and",
"end",
"number",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L167-L194 | train |
saltstack/salt | salt/modules/mod_random.py | seed | 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
... | 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
... | [
"def",
"seed",
"(",
"range",
"=",
"10",
",",
"hash",
"=",
"None",
")",
":",
"if",
"hash",
"is",
"None",
":",
"hash",
"=",
"__grains__",
"[",
"'id'",
"]",
"random",
".",
"seed",
"(",
"hash",
")",
"return",
"random",
".",
"randrange",
"(",
"range",
... | 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... | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mod_random.py#L197-L220 | train |
saltstack/salt | salt/auth/mysql.py | __get_connection_info | 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... | 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... | [
"def",
"__get_connection_info",
"(",
")",
":",
"conn_info",
"=",
"{",
"}",
"try",
":",
"conn_info",
"[",
"'hostname'",
"]",
"=",
"__opts__",
"[",
"'mysql_auth'",
"]",
"[",
"'hostname'",
"]",
"conn_info",
"[",
"'username'",
"]",
"=",
"__opts__",
"[",
"'mysq... | Grab MySQL Connection Details | [
"Grab",
"MySQL",
"Connection",
"Details"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/mysql.py#L83-L100 | train |
saltstack/salt | salt/auth/mysql.py | auth | 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... | 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... | [
"def",
"auth",
"(",
"username",
",",
"password",
")",
":",
"_info",
"=",
"__get_connection_info",
"(",
")",
"if",
"_info",
"is",
"None",
":",
"return",
"False",
"try",
":",
"conn",
"=",
"MySQLdb",
".",
"connect",
"(",
"_info",
"[",
"'hostname'",
"]",
"... | Authenticate using a MySQL user table | [
"Authenticate",
"using",
"a",
"MySQL",
"user",
"table"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/auth/mysql.py#L103-L127 | train |
saltstack/salt | salt/modules/uptime.py | create | 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
... | 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
... | [
"def",
"create",
"(",
"name",
",",
"*",
"*",
"params",
")",
":",
"if",
"check_exists",
"(",
"name",
")",
":",
"msg",
"=",
"'Trying to create check that already exists : {0}'",
".",
"format",
"(",
"name",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
... | 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... | [
"Create",
"a",
"check",
"on",
"a",
"given",
"URL",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L32-L60 | train |
saltstack/salt | salt/modules/uptime.py | delete | 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... | 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... | [
"def",
"delete",
"(",
"name",
")",
":",
"if",
"not",
"check_exists",
"(",
"name",
")",
":",
"msg",
"=",
"\"Trying to delete check that doesn't exists : {0}\"",
".",
"format",
"(",
"name",
")",
"log",
".",
"error",
"(",
"msg",
")",
"raise",
"CommandExecutionErr... | Delete a check on a given URL
CLI Example:
.. code-block:: bash
salt '*' uptime.delete http://example.org | [
"Delete",
"a",
"check",
"on",
"a",
"given",
"URL"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L63-L87 | train |
saltstack/salt | salt/modules/uptime.py | checks_list | 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[... | 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[... | [
"def",
"checks_list",
"(",
")",
":",
"application_url",
"=",
"_get_application_url",
"(",
")",
"log",
".",
"debug",
"(",
"'[uptime] get checks'",
")",
"jcontent",
"=",
"requests",
".",
"get",
"(",
"'{0}/api/checks'",
".",
"format",
"(",
"application_url",
")",
... | List URL checked by uptime
CLI Example:
.. code-block:: bash
salt '*' uptime.checks_list | [
"List",
"URL",
"checked",
"by",
"uptime"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/uptime.py#L103-L116 | train |
saltstack/salt | salt/states/acme.py | cert | 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... | 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... | [
"def",
"cert",
"(",
"name",
",",
"aliases",
"=",
"None",
",",
"email",
"=",
"None",
",",
"webroot",
"=",
"None",
",",
"test_cert",
"=",
"False",
",",
"renew",
"=",
"None",
",",
"keysize",
"=",
"None",
",",
"server",
"=",
"None",
",",
"owner",
"=",
... | 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 ... | [
"Obtain",
"/",
"renew",
"a",
"certificate",
"from",
"an",
"ACME",
"CA",
"probably",
"Let",
"s",
"Encrypt",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/acme.py#L42-L161 | train |
saltstack/salt | salt/states/vagrant.py | _vagrant_call | 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... | 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... | [
"def",
"_vagrant_call",
"(",
"node",
",",
"function",
",",
"section",
",",
"comment",
",",
"status_when_done",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"node",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
"... | 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... | [
"Helper",
"to",
"call",
"the",
"vagrant",
"functions",
".",
"Wildcards",
"supported",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L77-L127 | train |
saltstack/salt | salt/states/vagrant.py | running | 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... | 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... | [
"def",
"running",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'*'",
"in",
"name",
"or",
"'?'",
"in",
"name",
":",
"return",
"_vagrant_call",
"(",
"name",
",",
"'start'",
",",
"'restarted'",
",",
"\"Machine has been restarted\"",
",",
"\"running\... | 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... | [
"r",
"Defines",
"and",
"starts",
"a",
"new",
"VM",
"with",
"specified",
"arguments",
"or",
"restart",
"a",
"VM",
"(",
"or",
"group",
"of",
"VMs",
")",
".",
"(",
"Runs",
"vagrant",
"up",
".",
")"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L130-L194 | train |
saltstack/salt | salt/states/vagrant.py | _find_init_change | 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... | 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... | [
"def",
"_find_init_change",
"(",
"name",
",",
"ret",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"clean_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"if",
"'vm'",
"in",
"kwargs",
":",
"kwargs",
".",
"update",
... | look for changes from any previous init of machine.
:return: modified ret and kwargs | [
"look",
"for",
"changes",
"from",
"any",
"previous",
"init",
"of",
"machine",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L197-L223 | train |
saltstack/salt | salt/states/vagrant.py | initialized | 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... | 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... | [
"def",
"initialized",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'result'",
":",
"True",
",",
"'comment'",
":",
"'The VM is already correctly defined'",
"}",
"# define a ma... | 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... | [
"r",
"Defines",
"a",
"new",
"VM",
"with",
"specified",
"arguments",
"but",
"does",
"not",
"start",
"it",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/vagrant.py#L226-L280 | train |
saltstack/salt | salt/modules/pw_user.py | _get_gecos | 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:... | 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:... | [
"def",
"_get_gecos",
"(",
"name",
")",
":",
"try",
":",
"gecos_field",
"=",
"pwd",
".",
"getpwnam",
"(",
"name",
")",
".",
"pw_gecos",
".",
"split",
"(",
"','",
",",
"3",
")",
"except",
"KeyError",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0... | Retrieve GECOS field info and return it in dictionary form | [
"Retrieve",
"GECOS",
"field",
"info",
"and",
"return",
"it",
"in",
"dictionary",
"form"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L70-L89 | train |
saltstack/salt | salt/modules/pw_user.py | add | 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... | 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... | [
"def",
"add",
"(",
"name",
",",
"uid",
"=",
"None",
",",
"gid",
"=",
"None",
",",
"groups",
"=",
"None",
",",
"home",
"=",
"None",
",",
"shell",
"=",
"None",
",",
"unique",
"=",
"True",
",",
"fullname",
"=",
"''",
",",
"roomnumber",
"=",
"''",
... | Add a user to the minion
CLI Example:
.. code-block:: bash
salt '*' user.add name <uid> <gid> <groups> <home> <shell> | [
"Add",
"a",
"user",
"to",
"the",
"minion"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L122-L176 | train |
saltstack/salt | salt/modules/pw_user.py | getent | 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... | 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... | [
"def",
"getent",
"(",
"refresh",
"=",
"False",
")",
":",
"if",
"'user.getent'",
"in",
"__context__",
"and",
"not",
"refresh",
":",
"return",
"__context__",
"[",
"'user.getent'",
"]",
"ret",
"=",
"[",
"]",
"for",
"data",
"in",
"pwd",
".",
"getpwall",
"(",... | Return the list of all info for all users
CLI Example:
.. code-block:: bash
salt '*' user.getent | [
"Return",
"the",
"list",
"of",
"all",
"info",
"for",
"all",
"users"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L199-L216 | train |
saltstack/salt | salt/modules/pw_user.py | chuid | 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... | 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... | [
"def",
"chuid",
"(",
"name",
",",
"uid",
")",
":",
"pre_info",
"=",
"info",
"(",
"name",
")",
"if",
"not",
"pre_info",
":",
"raise",
"CommandExecutionError",
"(",
"'User \\'{0}\\' does not exist'",
".",
"format",
"(",
"name",
")",
")",
"if",
"uid",
"==",
... | Change the uid for a named user
CLI Example:
.. code-block:: bash
salt '*' user.chuid foo 4376 | [
"Change",
"the",
"uid",
"for",
"a",
"named",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L219-L238 | train |
saltstack/salt | salt/modules/pw_user.py | chloginclass | 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... | 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... | [
"def",
"chloginclass",
"(",
"name",
",",
"loginclass",
",",
"root",
"=",
"None",
")",
":",
"if",
"loginclass",
"==",
"get_loginclass",
"(",
"name",
")",
":",
"return",
"True",
"cmd",
"=",
"[",
"'pw'",
",",
"'usermod'",
",",
"'-L'",
",",
"'{0}'",
".",
... | Change the default login class of the user
.. versionadded:: 2016.3.5
CLI Example:
.. code-block:: bash
salt '*' user.chloginclass foo staff | [
"Change",
"the",
"default",
"login",
"class",
"of",
"the",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L405-L425 | train |
saltstack/salt | salt/modules/pw_user.py | info | 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'... | 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'... | [
"def",
"info",
"(",
"name",
")",
":",
"ret",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"pwd",
".",
"getpwnam",
"(",
"name",
")",
"ret",
"[",
"'gid'",
"]",
"=",
"data",
".",
"pw_gid",
"ret",
"[",
"'groups'",
"]",
"=",
"list_groups",
"(",
"name",
"... | Return user information
CLI Example:
.. code-block:: bash
salt '*' user.info root | [
"Return",
"user",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L428-L459 | train |
saltstack/salt | salt/modules/pw_user.py | get_loginclass | 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... | 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... | [
"def",
"get_loginclass",
"(",
"name",
")",
":",
"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 | [
"Get",
"the",
"login",
"class",
"of",
"the",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L462-L479 | train |
saltstack/salt | salt/modules/pw_user.py | rename | 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... | 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... | [
"def",
"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 | [
"Change",
"the",
"username",
"for",
"a",
"named",
"user"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pw_user.py#L508-L531 | train |
saltstack/salt | salt/proxy/nxos_api.py | init | 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``)
... | 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``)
... | [
"def",
"init",
"(",
"opts",
")",
":",
"proxy_dict",
"=",
"opts",
".",
"get",
"(",
"'proxy'",
",",
"{",
"}",
")",
"conn_args",
"=",
"copy",
".",
"deepcopy",
"(",
"proxy_dict",
")",
"conn_args",
".",
"pop",
"(",
"'proxytype'",
",",
"None",
")",
"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``)
which doesn't come with ... | [
"Open",
"the",
"connection",
"to",
"the",
"Nexsu",
"switch",
"over",
"the",
"NX",
"-",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos_api.py#L142-L167 | train |
saltstack/salt | salt/proxy/nxos_api.py | rpc | 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) | 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) | [
"def",
"rpc",
"(",
"commands",
",",
"method",
"=",
"'cli'",
",",
"*",
"*",
"kwargs",
")",
":",
"conn_args",
"=",
"nxos_device",
"[",
"'conn_args'",
"]",
"conn_args",
".",
"update",
"(",
"kwargs",
")",
"return",
"__utils__",
"[",
"'nxos_api.rpc'",
"]",
"(... | Executes an RPC request over the NX-API. | [
"Executes",
"an",
"RPC",
"request",
"over",
"the",
"NX",
"-",
"API",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/nxos_api.py#L203-L209 | train |
saltstack/salt | salt/cloud/__init__.py | communicator | 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')
... | 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')
... | [
"def",
"communicator",
"(",
"func",
")",
":",
"def",
"_call",
"(",
"queue",
",",
"args",
",",
"kwargs",
")",
":",
"'''called with [queue, args, kwargs] as first optional arg'''",
"kwargs",
"[",
"'queue'",
"]",
"=",
"queue",
"ret",
"=",
"None",
"try",
":",
"ret... | Warning, this is a picklable decorator ! | [
"Warning",
"this",
"is",
"a",
"picklable",
"decorator",
"!"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L60-L85 | train |
saltstack/salt | salt/cloud/__init__.py | enter_mainloop | 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... | 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... | [
"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 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
... | [
"Manage",
"a",
"multiprocessing",
"pool"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L88-L182 | train |
saltstack/salt | salt/cloud/__init__.py | create_multiprocessing | 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... | 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... | [
"def",
"create_multiprocessing",
"(",
"parallel_data",
",",
"queue",
"=",
"None",
")",
":",
"salt",
".",
"utils",
".",
"crypt",
".",
"reinit_crypto",
"(",
")",
"parallel_data",
"[",
"'opts'",
"]",
"[",
"'output'",
"]",
"=",
"'json'",
"cloud",
"=",
"Cloud",... | 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. | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2304-L2330 | train |
saltstack/salt | salt/cloud/__init__.py | destroy_multiprocessing | 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... | 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... | [
"def",
"destroy_multiprocessing",
"(",
"parallel_data",
",",
"queue",
"=",
"None",
")",
":",
"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. | [
"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",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2333-L2363 | train |
saltstack/salt | salt/cloud/__init__.py | run_parallel_map_providers_query | 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[... | 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[... | [
"def",
"run_parallel_map_providers_query",
"(",
"data",
",",
"queue",
"=",
"None",
")",
":",
"salt",
".",
"utils",
".",
"crypt",
".",
"reinit_crypto",
"(",
")",
"cloud",
"=",
"Cloud",
"(",
"data",
"[",
"'opts'",
"]",
")",
"try",
":",
"with",
"salt",
".... | This function will be called from another process when building the
providers map. | [
"This",
"function",
"will",
"be",
"called",
"from",
"another",
"process",
"when",
"building",
"the",
"providers",
"map",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L2366-L2395 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient._opts_defaults | 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... | 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... | [
"def",
"_opts_defaults",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Let's start with the default salt cloud configuration",
"opts",
"=",
"salt",
".",
"config",
".",
"DEFAULT_CLOUD_OPTS",
".",
"copy",
"(",
")",
"# Update it with the loaded configuration",
"opts",... | Set the opts dict to defaults and allow for opts to be overridden in
the kwargs | [
"Set",
"the",
"opts",
"dict",
"to",
"defaults",
"and",
"allow",
"for",
"opts",
"to",
"be",
"overridden",
"in",
"the",
"kwargs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L219-L257 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.low | 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', {})) | 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', {})) | [
"def",
"low",
"(",
"self",
",",
"fun",
",",
"low",
")",
":",
"l_fun",
"=",
"getattr",
"(",
"self",
",",
"fun",
")",
"f_call",
"=",
"salt",
".",
"utils",
".",
"args",
".",
"format_call",
"(",
"l_fun",
",",
"low",
")",
"return",
"l_fun",
"(",
"*",
... | Pass the cloud function and low data structure to run | [
"Pass",
"the",
"cloud",
"function",
"and",
"low",
"data",
"structure",
"to",
"run"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L259-L265 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.list_sizes | 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)
) | 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)
) | [
"def",
"list_sizes",
"(",
"self",
",",
"provider",
"=",
"None",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"simple_types_filter",
"(",
... | List all available sizes in configured cloud systems | [
"List",
"all",
"available",
"sizes",
"in",
"configured",
"cloud",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L267-L274 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.list_images | 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)
) | 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)
) | [
"def",
"list_images",
"(",
"self",
",",
"provider",
"=",
"None",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"simple_types_filter",
"(",... | List all available images in configured cloud systems | [
"List",
"all",
"available",
"images",
"in",
"configured",
"cloud",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L276-L283 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.list_locations | 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)
) | 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)
) | [
"def",
"list_locations",
"(",
"self",
",",
"provider",
"=",
"None",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"return",
"salt",
".",
"utils",
".",
"data",
".",
"simple_types_filter",
"... | List all available locations in configured cloud systems | [
"List",
"all",
"available",
"locations",
"in",
"configured",
"cloud",
"systems"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L285-L292 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.min_query | 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) | 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) | [
"def",
"min_query",
"(",
"self",
",",
"query_type",
"=",
"'list_nodes_min'",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"mapper",
".",
"opts",
"[",
"'selected_query_option'",
"]",
"=",
"'... | Query select instance information | [
"Query",
"select",
"instance",
"information"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L318-L324 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.profile | 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... | 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... | [
"def",
"profile",
"(",
"self",
",",
"profile",
",",
"names",
",",
"vm_overrides",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"vm_overrides",
":",
"vm_overrides",
"=",
"{",
"}",
"kwargs",
"[",
"'profile'",
"]",
"=",
"profile",
"mapper"... | 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... | [
"Pass",
"in",
"a",
"profile",
"to",
"create",
"names",
"is",
"a",
"list",
"of",
"vm",
"names",
"to",
"allocate"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L326-L366 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.map_run | 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... | 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... | [
"def",
"map_run",
"(",
"self",
",",
"path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwarg",
"=",
"{",
"}",
"if",
"path",
":",
"kwarg",
"[",
"'map'",
"]",
"=",
"path",
"kwarg",
".",
"update",
"(",
"kwargs",
")",
"mapper",
"=",
"salt",
"... | To execute a map | [
"To",
"execute",
"a",
"map"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L368-L380 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.destroy | 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)
... | 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)
... | [
"def",
"destroy",
"(",
"self",
",",
"names",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
"destroy",
"=",
"True",
")",
")",
"if",
"isinstance",
"(",
"names",
",",
"six",
".",
"string_types",
")",... | Destroy the named VMs | [
"Destroy",
"the",
"named",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L382-L391 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.create | 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',
... | 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',
... | [
"def",
"create",
"(",
"self",
",",
"provider",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"providers",
"=",
"self",
".",
"opts",
"[",
"'provid... | 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) | [
"Create",
"the",
"named",
"VMs",
"without",
"using",
"a",
"profile"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L393-L430 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.extra_action | 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... | 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... | [
"def",
"extra_action",
"(",
"self",
",",
"names",
",",
"provider",
",",
"action",
",",
"*",
"*",
"kwargs",
")",
":",
"mapper",
"=",
"salt",
".",
"cloud",
".",
"Map",
"(",
"self",
".",
"_opts_defaults",
"(",
")",
")",
"providers",
"=",
"mapper",
".",
... | 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... | [
"Perform",
"actions",
"with",
"block",
"storage",
"devices"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L432-L466 | train |
saltstack/salt | salt/cloud/__init__.py | CloudClient.action | 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... | 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... | [
"def",
"action",
"(",
"self",
",",
"fun",
"=",
"None",
",",
"cloudmap",
"=",
"None",
",",
"names",
"=",
"None",
",",
"provider",
"=",
"None",
",",
"instance",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"kwargs",
"is",
"None",
":",
"... | 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'}
) | [
"Execute",
"a",
"single",
"action",
"via",
"the",
"cloud",
"plugin",
"backend"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L468-L518 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.get_configured_providers | 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... | 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... | [
"def",
"get_configured_providers",
"(",
"self",
")",
":",
"providers",
"=",
"set",
"(",
")",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"opts",
"[",
"'providers'",
"]",
")",
":",
"if",
"len",
"(",
"drivers",
")",
... | Return the configured providers | [
"Return",
"the",
"configured",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L532-L543 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.lookup_providers | 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 ... | 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 ... | [
"def",
"lookup_providers",
"(",
"self",
",",
"lookup",
")",
":",
"if",
"lookup",
"is",
"None",
":",
"lookup",
"=",
"'all'",
"if",
"lookup",
"==",
"'all'",
":",
"providers",
"=",
"set",
"(",
")",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iter... | Get a dict describing the configured providers | [
"Get",
"a",
"dict",
"describing",
"the",
"configured",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L545-L587 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.lookup_profiles | 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... | 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... | [
"def",
"lookup_profiles",
"(",
"self",
",",
"provider",
",",
"lookup",
")",
":",
"if",
"provider",
"is",
"None",
":",
"provider",
"=",
"'all'",
"if",
"lookup",
"is",
"None",
":",
"lookup",
"=",
"'all'",
"if",
"lookup",
"==",
"'all'",
":",
"profiles",
"... | Return a dictionary describing the configured profiles | [
"Return",
"a",
"dictionary",
"describing",
"the",
"configured",
"profiles"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L589-L621 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.map_providers | 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... | 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... | [
"def",
"map_providers",
"(",
"self",
",",
"query",
"=",
"'list_nodes'",
",",
"cached",
"=",
"False",
")",
":",
"if",
"cached",
"is",
"True",
"and",
"query",
"in",
"self",
".",
"__cached_provider_queries",
":",
"return",
"self",
".",
"__cached_provider_queries"... | Return a mapping of what named VMs are running on what VM providers
based on what providers are defined in the configuration and VMs | [
"Return",
"a",
"mapping",
"of",
"what",
"named",
"VMs",
"are",
"running",
"on",
"what",
"VM",
"providers",
"based",
"on",
"what",
"providers",
"are",
"defined",
"in",
"the",
"configuration",
"and",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L623-L657 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.map_providers_parallel | 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... | 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... | [
"def",
"map_providers_parallel",
"(",
"self",
",",
"query",
"=",
"'list_nodes'",
",",
"cached",
"=",
"False",
")",
":",
"if",
"cached",
"is",
"True",
"and",
"query",
"in",
"self",
".",
"__cached_provider_queries",
":",
"return",
"self",
".",
"__cached_provider... | 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. | [
"Return",
"a",
"mapping",
"of",
"what",
"named",
"VMs",
"are",
"running",
"on",
"what",
"VM",
"providers",
"based",
"on",
"what",
"providers",
"are",
"defined",
"in",
"the",
"configuration",
"and",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L659-L715 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud._optimize_providers | 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... | 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... | [
"def",
"_optimize_providers",
"(",
"self",
",",
"providers",
")",
":",
"new_providers",
"=",
"{",
"}",
"provider_by_driver",
"=",
"{",
"}",
"for",
"alias",
",",
"driver",
"in",
"six",
".",
"iteritems",
"(",
"providers",
")",
":",
"for",
"name",
",",
"dat... | Return an optimized mapping of available providers | [
"Return",
"an",
"optimized",
"mapping",
"of",
"available",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L763-L795 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.image_list | def image_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
fun = '{0}.avail_images'.fo... | python | def image_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
fun = '{0}.avail_images'.fo... | [
"def",
"image_list",
"(",
"self",
",",
"lookup",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_providers",
"(",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for",
"alias",
",",
"driver",
"in",
"... | Return a mapping of all image data for available providers | [
"Return",
"a",
"mapping",
"of",
"all",
"image",
"data",
"for",
"available",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L836-L872 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.provider_list | def provider_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:
... | python | def provider_list(self, lookup='all'):
'''
Return a mapping of all image data for available providers
'''
data = {}
lookups = self.lookup_providers(lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:
... | [
"def",
"provider_list",
"(",
"self",
",",
"lookup",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_providers",
"(",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for",
"alias",
",",
"driver",
"in",
... | Return a mapping of all image data for available providers | [
"Return",
"a",
"mapping",
"of",
"all",
"image",
"data",
"for",
"available",
"providers"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L912-L926 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.profile_list | def profile_list(self, provider, lookup='all'):
'''
Return a mapping of all configured profiles
'''
data = {}
lookups = self.lookup_profiles(provider, lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:... | python | def profile_list(self, provider, lookup='all'):
'''
Return a mapping of all configured profiles
'''
data = {}
lookups = self.lookup_profiles(provider, lookup)
if not lookups:
return data
for alias, driver in lookups:
if alias not in data:... | [
"def",
"profile_list",
"(",
"self",
",",
"provider",
",",
"lookup",
"=",
"'all'",
")",
":",
"data",
"=",
"{",
"}",
"lookups",
"=",
"self",
".",
"lookup_profiles",
"(",
"provider",
",",
"lookup",
")",
"if",
"not",
"lookups",
":",
"return",
"data",
"for"... | Return a mapping of all configured profiles | [
"Return",
"a",
"mapping",
"of",
"all",
"configured",
"profiles"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L928-L943 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.create_all | def create_all(self):
'''
Create/Verify the VMs in the VM data
'''
ret = []
for vm_name, vm_details in six.iteritems(self.opts['profiles']):
ret.append(
{vm_name: self.create(vm_details)}
)
return ret | python | def create_all(self):
'''
Create/Verify the VMs in the VM data
'''
ret = []
for vm_name, vm_details in six.iteritems(self.opts['profiles']):
ret.append(
{vm_name: self.create(vm_details)}
)
return ret | [
"def",
"create_all",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"vm_name",
",",
"vm_details",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"opts",
"[",
"'profiles'",
"]",
")",
":",
"ret",
".",
"append",
"(",
"{",
"vm_name",
":",
"self"... | Create/Verify the VMs in the VM data | [
"Create",
"/",
"Verify",
"the",
"VMs",
"in",
"the",
"VM",
"data"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L945-L956 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.destroy | def destroy(self, names, cached=False):
'''
Destroy the named VMs
'''
processed = {}
names = set(names)
matching = self.get_running_by_names(names, cached=cached)
vms_to_destroy = set()
parallel_data = []
for alias, drivers in six.iteritems(matchin... | python | def destroy(self, names, cached=False):
'''
Destroy the named VMs
'''
processed = {}
names = set(names)
matching = self.get_running_by_names(names, cached=cached)
vms_to_destroy = set()
parallel_data = []
for alias, drivers in six.iteritems(matchin... | [
"def",
"destroy",
"(",
"self",
",",
"names",
",",
"cached",
"=",
"False",
")",
":",
"processed",
"=",
"{",
"}",
"names",
"=",
"set",
"(",
"names",
")",
"matching",
"=",
"self",
".",
"get_running_by_names",
"(",
"names",
",",
"cached",
"=",
"cached",
... | Destroy the named VMs | [
"Destroy",
"the",
"named",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L958-L1138 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.reboot | def reboot(self, names):
'''
Reboot the named VMs
'''
ret = []
pmap = self.map_providers_parallel()
acts = {}
for prov, nodes in six.iteritems(pmap):
acts[prov] = []
for node in nodes:
if node in names:
a... | python | def reboot(self, names):
'''
Reboot the named VMs
'''
ret = []
pmap = self.map_providers_parallel()
acts = {}
for prov, nodes in six.iteritems(pmap):
acts[prov] = []
for node in nodes:
if node in names:
a... | [
"def",
"reboot",
"(",
"self",
",",
"names",
")",
":",
"ret",
"=",
"[",
"]",
"pmap",
"=",
"self",
".",
"map_providers_parallel",
"(",
")",
"acts",
"=",
"{",
"}",
"for",
"prov",
",",
"nodes",
"in",
"six",
".",
"iteritems",
"(",
"pmap",
")",
":",
"a... | Reboot the named VMs | [
"Reboot",
"the",
"named",
"VMs"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1140-L1159 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.create | def create(self, vm_, local_master=True):
'''
Create a single VM
'''
output = {}
minion_dict = salt.config.get_cloud_config_value(
'minion', vm_, self.opts, default={}
)
alias, driver = vm_['provider'].split(':')
fun = '{0}.create'.format(dri... | python | def create(self, vm_, local_master=True):
'''
Create a single VM
'''
output = {}
minion_dict = salt.config.get_cloud_config_value(
'minion', vm_, self.opts, default={}
)
alias, driver = vm_['provider'].split(':')
fun = '{0}.create'.format(dri... | [
"def",
"create",
"(",
"self",
",",
"vm_",
",",
"local_master",
"=",
"True",
")",
":",
"output",
"=",
"{",
"}",
"minion_dict",
"=",
"salt",
".",
"config",
".",
"get_cloud_config_value",
"(",
"'minion'",
",",
"vm_",
",",
"self",
".",
"opts",
",",
"defaul... | Create a single VM | [
"Create",
"a",
"single",
"VM"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1161-L1316 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.vm_config | def vm_config(name, main, provider, profile, overrides):
'''
Create vm config.
:param str name: The name of the vm
:param dict main: The main cloud config
:param dict provider: The provider config
:param dict profile: The profile config
:param dict overrides: The... | python | def vm_config(name, main, provider, profile, overrides):
'''
Create vm config.
:param str name: The name of the vm
:param dict main: The main cloud config
:param dict provider: The provider config
:param dict profile: The profile config
:param dict overrides: The... | [
"def",
"vm_config",
"(",
"name",
",",
"main",
",",
"provider",
",",
"profile",
",",
"overrides",
")",
":",
"vm",
"=",
"main",
".",
"copy",
"(",
")",
"vm",
"=",
"salt",
".",
"utils",
".",
"dictupdate",
".",
"update",
"(",
"vm",
",",
"provider",
")",... | Create vm config.
:param str name: The name of the vm
:param dict main: The main cloud config
:param dict provider: The provider config
:param dict profile: The profile config
:param dict overrides: The vm's config overrides | [
"Create",
"vm",
"config",
"."
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1319-L1334 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.extras | def extras(self, extra_):
'''
Extra actions
'''
output = {}
alias, driver = extra_['provider'].split(':')
fun = '{0}.{1}'.format(driver, extra_['action'])
if fun not in self.clouds:
log.error(
'Creating \'%s\' using \'%s\' as the provi... | python | def extras(self, extra_):
'''
Extra actions
'''
output = {}
alias, driver = extra_['provider'].split(':')
fun = '{0}.{1}'.format(driver, extra_['action'])
if fun not in self.clouds:
log.error(
'Creating \'%s\' using \'%s\' as the provi... | [
"def",
"extras",
"(",
"self",
",",
"extra_",
")",
":",
"output",
"=",
"{",
"}",
"alias",
",",
"driver",
"=",
"extra_",
"[",
"'provider'",
"]",
".",
"split",
"(",
"':'",
")",
"fun",
"=",
"'{0}.{1}'",
".",
"format",
"(",
"driver",
",",
"extra_",
"[",... | Extra actions | [
"Extra",
"actions"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1336-L1364 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.run_profile | def run_profile(self, profile, names, vm_overrides=None):
'''
Parse over the options passed on the command line and determine how to
handle them
'''
if profile not in self.opts['profiles']:
msg = 'Profile {0} is not defined'.format(profile)
log.error(msg)
... | python | def run_profile(self, profile, names, vm_overrides=None):
'''
Parse over the options passed on the command line and determine how to
handle them
'''
if profile not in self.opts['profiles']:
msg = 'Profile {0} is not defined'.format(profile)
log.error(msg)
... | [
"def",
"run_profile",
"(",
"self",
",",
"profile",
",",
"names",
",",
"vm_overrides",
"=",
"None",
")",
":",
"if",
"profile",
"not",
"in",
"self",
".",
"opts",
"[",
"'profiles'",
"]",
":",
"msg",
"=",
"'Profile {0} is not defined'",
".",
"format",
"(",
"... | Parse over the options passed on the command line and determine how to
handle them | [
"Parse",
"over",
"the",
"options",
"passed",
"on",
"the",
"command",
"line",
"and",
"determine",
"how",
"to",
"handle",
"them"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1366-L1453 | train |
saltstack/salt | salt/cloud/__init__.py | Cloud.do_action | def do_action(self, names, kwargs):
'''
Perform an action on a VM which may be specific to this cloud provider
'''
ret = {}
invalid_functions = {}
names = set(names)
for alias, drivers in six.iteritems(self.map_providers_parallel()):
if not names:
... | python | def do_action(self, names, kwargs):
'''
Perform an action on a VM which may be specific to this cloud provider
'''
ret = {}
invalid_functions = {}
names = set(names)
for alias, drivers in six.iteritems(self.map_providers_parallel()):
if not names:
... | [
"def",
"do_action",
"(",
"self",
",",
"names",
",",
"kwargs",
")",
":",
"ret",
"=",
"{",
"}",
"invalid_functions",
"=",
"{",
"}",
"names",
"=",
"set",
"(",
"names",
")",
"for",
"alias",
",",
"drivers",
"in",
"six",
".",
"iteritems",
"(",
"self",
".... | Perform an action on a VM which may be specific to this cloud provider | [
"Perform",
"an",
"action",
"on",
"a",
"VM",
"which",
"may",
"be",
"specific",
"to",
"this",
"cloud",
"provider"
] | e8541fd6e744ab0df786c0f76102e41631f45d46 | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/__init__.py#L1455-L1547 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.