repository_name
stringclasses
316 values
func_path_in_repository
stringlengths
6
223
func_name
stringlengths
1
134
language
stringclasses
1 value
func_code_string
stringlengths
57
65.5k
func_documentation_string
stringlengths
1
46.3k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
called_functions
listlengths
1
156
enclosing_scope
stringlengths
2
1.48M
saltstack/salt
salt/cloud/clouds/ec2.py
avail_images
python
def avail_images(kwargs=None, call=None): ''' Return a dict of all available VM images on the cloud provider. ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ...
Return a dict of all available VM images on the cloud provider.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L942-L975
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
ssh_interface
python
def ssh_interface(vm_): ''' Return the ssh_interface type to connect to. Either 'public_ips' (default) or 'private_ips'. ''' ret = config.get_cloud_config_value( 'ssh_interface', vm_, __opts__, default='public_ips', search_global=False ) if ret not in ('public_ips', 'private_...
Return the ssh_interface type to connect to. Either 'public_ips' (default) or 'private_ips'.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1034-L1050
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_ssh_gateway_config
python
def get_ssh_gateway_config(vm_): ''' Return the ssh_gateway configuration. ''' ssh_gateway = config.get_cloud_config_value( 'ssh_gateway', vm_, __opts__, default=None, search_global=False ) # Check to see if a SSH Gateway will be used. if not isinstance(ssh_gateway, six.stri...
Return the ssh_gateway configuration.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1053-L1117
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
avail_locations
python
def avail_locations(call=None): ''' List all available locations ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_locations function must be called with ' '-f or --function, or with the --list-locations option' ) ret = {} params = {'Action'...
List all available locations
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1139-L1164
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_availability_zone
python
def get_availability_zone(vm_): ''' Return the availability zone to use ''' avz = config.get_cloud_config_value( 'availability_zone', vm_, __opts__, search_global=False ) if avz is None: return None zones = _list_availability_zones(vm_) # Validate user-specified AZ ...
Return the availability zone to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1167-L1198
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_imageid
python
def get_imageid(vm_): ''' Returns the ImageId to use ''' image = config.get_cloud_config_value( 'image', vm_, __opts__, search_global=False ) if image.startswith('ami-'): return image # a poor man's cache if not hasattr(get_imageid, 'images'): get_imageid.images =...
Returns the ImageId to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1212-L1236
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_get_subnetname_id
python
def _get_subnetname_id(subnetname): ''' Returns the SubnetId of a SubnetName to use ''' params = {'Action': 'DescribeSubnets'} for subnet in aws.query(params, location=get_location(), provider=get_provider(), opts=__opts__, sigver='4'): tags = subnet.get('tagSet', {}).get('ite...
Returns the SubnetId of a SubnetName to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1239-L1256
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_subnetid
python
def get_subnetid(vm_): ''' Returns the SubnetId to use ''' subnetid = config.get_cloud_config_value( 'subnetid', vm_, __opts__, search_global=False ) if subnetid: return subnetid subnetname = config.get_cloud_config_value( 'subnetname', vm_, __opts__, search_global=F...
Returns the SubnetId to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1259-L1274
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_get_securitygroupname_id
python
def _get_securitygroupname_id(securitygroupname_list): ''' Returns the SecurityGroupId of a SecurityGroupName to use ''' securitygroupid_set = set() if not isinstance(securitygroupname_list, list): securitygroupname_list = [securitygroupname_list] params = {'Action': 'DescribeSecurityGro...
Returns the SecurityGroupId of a SecurityGroupName to use
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1277-L1293
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
securitygroupid
python
def securitygroupid(vm_): ''' Returns the SecurityGroupId ''' securitygroupid_set = set() securitygroupid_list = config.get_cloud_config_value( 'securitygroupid', vm_, __opts__, search_global=False ) # If the list is None, then the set will remain empty # ...
Returns the SecurityGroupId
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1296-L1329
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_provider
python
def get_provider(vm_=None): ''' Extract the provider name from vm ''' if vm_ is None: provider = __active_provider_name__ or 'ec2' else: provider = vm_.get('provider', 'ec2') if ':' in provider: prov_comps = provider.split(':') provider = prov_comps[0] return...
Extract the provider name from vm
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1350-L1362
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_list_availability_zones
python
def _list_availability_zones(vm_=None): ''' List all availability zones in the current region ''' ret = {} params = {'Action': 'DescribeAvailabilityZones', 'Filter.0.Name': 'region-name', 'Filter.0.Value.0': get_location(vm_)} result = aws.query(params, ...
List all availability zones in the current region
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1365-L1383
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_request_eip
python
def _request_eip(interface, vm_): ''' Request and return Elastic IP ''' params = {'Action': 'AllocateAddress'} params['Domain'] = interface.setdefault('domain', 'vpc') eips = aws.query(params, return_root=True, location=get_location(vm_), ...
Request and return Elastic IP
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1400-L1415
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_create_eni_if_necessary
python
def _create_eni_if_necessary(interface, vm_): ''' Create an Elastic Interface if necessary and return a Network Interface Specification ''' if 'NetworkInterfaceId' in interface and interface['NetworkInterfaceId'] is not None: return {'DeviceIndex': interface['DeviceIndex'], 'Netw...
Create an Elastic Interface if necessary and return a Network Interface Specification
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1418-L1515
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_list_interface_private_addrs
python
def _list_interface_private_addrs(eni_desc): ''' Returns a list of all of the private IP addresses attached to a network interface. The 'primary' address will be listed first. ''' primary = eni_desc.get('privateIpAddress') if not primary: return None addresses = [primary] lst =...
Returns a list of all of the private IP addresses attached to a network interface. The 'primary' address will be listed first.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1543-L1564
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_modify_eni_properties
python
def _modify_eni_properties(eni_id, properties=None, vm_=None): ''' Change properties of the interface with id eni_id to the values in properties dict ''' if not isinstance(properties, dict): raise SaltCloudException( 'ENI properties must be a dictionary' ) params = {...
Change properties of the interface with id eni_id to the values in properties dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1567-L1596
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_associate_eip_with_interface
python
def _associate_eip_with_interface(eni_id, eip_id, private_ip=None, vm_=None): ''' Accept the id of a network interface, and the id of an elastic ip address, and associate the two of them, such that traffic sent to the elastic ip address will be forwarded (NATted) to this network interface. Optional...
Accept the id of a network interface, and the id of an elastic ip address, and associate the two of them, such that traffic sent to the elastic ip address will be forwarded (NATted) to this network interface. Optionally specify the private (10.x.x.x) IP address that traffic should be NATted to - useful...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1599-L1636
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_param_from_config
python
def _param_from_config(key, data): ''' Return EC2 API parameters based on the given config data. Examples: 1. List of dictionaries >>> data = [ ... {'DeviceIndex': 0, 'SubnetId': 'subid0', ... 'AssociatePublicIpAddress': True}, ... {'DeviceIndex': 1, ... 'SubnetId'...
Return EC2 API parameters based on the given config data. Examples: 1. List of dictionaries >>> data = [ ... {'DeviceIndex': 0, 'SubnetId': 'subid0', ... 'AssociatePublicIpAddress': True}, ... {'DeviceIndex': 1, ... 'SubnetId': 'subid1', ... 'PrivateIpAddress': '1...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1675-L1744
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _param_from_config(key, data):\n '''\n Return EC2 API parameters based on the given config data.\n\n Examples:\n 1. List of dictionaries\n >>> data = [\n ... {'DeviceIndex': 0, 'SubnetId': 'subid0',\n ... 'AssociatePubli...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
request_instance
python
def request_instance(vm_=None, call=None): ''' Put together all of the information necessary to request an instance on EC2, and then fire off the request the instance. Returns data about the instance ''' if call == 'function': # Technically this function may be called other ways too, bu...
Put together all of the information necessary to request an instance on EC2, and then fire off the request the instance. Returns data about the instance
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L1747-L2175
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
query_instance
python
def query_instance(vm_=None, call=None): ''' Query an instance upon creation from the EC2 API ''' if call == 'function': # Technically this function may be called other ways too, but it # definitely cannot be called with --function. raise SaltCloudSystemExit( 'The que...
Query an instance upon creation from the EC2 API
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L2178-L2304
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
wait_for_instance
python
def wait_for_instance( vm_=None, data=None, ip_address=None, display_ssh_output=True, call=None, ): ''' Wait for an instance upon creation from the EC2 API, to become available ''' if call == 'function': # Technically this function may be called other ...
Wait for an instance upon creation from the EC2 API, to become available
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L2307-L2527
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
create
python
def create(vm_=None, call=None): ''' Create a single VM from a data dict ''' if call: raise SaltCloudSystemExit( 'You cannot create an instance with -a or -f.' ) try: # Check for required profile parameters before sending any API calls. if vm_['profile'] ...
Create a single VM from a data dict
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L2555-L2931
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
queue_instances
python
def queue_instances(instances): ''' Queue a set of instances to be provisioned later. Expects a list. Currently this only queries node data, and then places it in the cloud cache (if configured). If the salt-cloud-reactor is being used, these instances will be automatically provisioned using that. ...
Queue a set of instances to be provisioned later. Expects a list. Currently this only queries node data, and then places it in the cloud cache (if configured). If the salt-cloud-reactor is being used, these instances will be automatically provisioned using that. For more information about the salt-clo...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L2934-L2948
[ "def _get_node(name=None, instance_id=None, location=None):\n if location is None:\n location = get_location()\n\n params = {'Action': 'DescribeInstances'}\n\n if six.text_type(name).startswith('i-') and (len(name) == 10 or len(name) == 19):\n instance_id = name\n\n if instance_id:\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
create_attach_volumes
python
def create_attach_volumes(name, kwargs, call=None, wait_to_finish=True): ''' Create and attach volumes to created node ''' if call != 'action': raise SaltCloudSystemExit( 'The create_attach_volumes action must be called with ' '-a or --action.' ) if 'instance...
Create and attach volumes to created node
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L2951-L3034
[ "def safe_load(stream, Loader=SaltYamlSafeLoader):\n '''\n .. versionadded:: 2018.3.0\n\n Helper function which automagically uses our custom loader.\n '''\n return yaml.load(stream, Loader=Loader)\n", "def _get_node(name=None, instance_id=None, location=None):\n if location is None:\n lo...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
stop
python
def stop(name, call=None): ''' Stop a node ''' if call != 'action': raise SaltCloudSystemExit( 'The stop action must be called with -a or --action.' ) log.info('Stopping node %s', name) instance_id = _get_node(name)['instanceId'] __utils__['cloud.fire_event']( ...
Stop a node
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3037-L3067
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
set_tags
python
def set_tags(name=None, tags=None, call=None, location=None, instance_id=None, resource_id=None, kwargs=None): # pylint: disable=W0613 ''' Set tags for a resource. Normally a VM name or instance_id is passed in, but a resource_id...
Set tags for a resource. Normally a VM name or instance_id is passed in, but a resource_id may be passed instead. If both are passed in, the instance_id will be used. CLI Examples: .. code-block:: bash salt-cloud -a set_tags mymachine tag1=somestuff tag2='Other stuff' salt-cloud -a se...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3103-L3206
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_tags
python
def get_tags(name=None, instance_id=None, call=None, location=None, kwargs=None, resource_id=None): # pylint: disable=W0613 ''' Retrieve tags for a resource. Normally a VM name or instance_id is passed in, but a resource_id may be passed inst...
Retrieve tags for a resource. Normally a VM name or instance_id is passed in, but a resource_id may be passed instead. If both are passed in, the instance_id will be used. CLI Examples: .. code-block:: bash salt-cloud -a get_tags mymachine salt-cloud -a get_tags resource_id=vol-3267ab...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3209-L3250
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
del_tags
python
def del_tags(name=None, kwargs=None, call=None, instance_id=None, resource_id=None): # pylint: disable=W0613 ''' Delete tags for a resource. Normally a VM name or instance_id is passed in, but a resource_id may be passed instead. If both are passed in, th...
Delete tags for a resource. Normally a VM name or instance_id is passed in, but a resource_id may be passed instead. If both are passed in, the instance_id will be used. CLI Examples: .. code-block:: bash salt-cloud -a del_tags mymachine tags=mytag, salt-cloud -a del_tags mymachine ta...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3253-L3302
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
rename
python
def rename(name, kwargs, call=None): ''' Properly rename a node. Pass in the new name as "new name". CLI Example: .. code-block:: bash salt-cloud -a rename mymachine newname=yourmachine ''' if call != 'action': raise SaltCloudSystemExit( 'The rename action must be ...
Properly rename a node. Pass in the new name as "new name". CLI Example: .. code-block:: bash salt-cloud -a rename mymachine newname=yourmachine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3305-L3326
[ "def set_tags(name=None,\n tags=None,\n call=None,\n location=None,\n instance_id=None,\n resource_id=None,\n kwargs=None): # pylint: disable=W0613\n '''\n Set tags for a resource. Normally a VM name or instance_id is passed in,\n but...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
destroy
python
def destroy(name, call=None): ''' Destroy a node. Will check termination protection and warn if enabled. CLI Example: .. code-block:: bash salt-cloud --destroy mymachine ''' if call == 'function': raise SaltCloudSystemExit( 'The destroy action must be called with -...
Destroy a node. Will check termination protection and warn if enabled. CLI Example: .. code-block:: bash salt-cloud --destroy mymachine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3329-L3430
[ "def rename(name, kwargs, call=None):\n '''\n Properly rename a node. Pass in the new name as \"new name\".\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-cloud -a rename mymachine newname=yourmachine\n '''\n if call != 'action':\n raise SaltCloudSystemExit(\n 'The ren...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
reboot
python
def reboot(name, call=None): ''' Reboot a node. CLI Example: .. code-block:: bash salt-cloud -a reboot mymachine ''' instance_id = _get_node(name)['instanceId'] params = {'Action': 'RebootInstances', 'InstanceId.1': instance_id} result = aws.query(params, ...
Reboot a node. CLI Example: .. code-block:: bash salt-cloud -a reboot mymachine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3433-L3457
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
show_image
python
def show_image(kwargs, call=None): ''' Show the details from EC2 concerning an AMI ''' if call != 'function': raise SaltCloudSystemExit( 'The show_image action must be called with -f or --function.' ) params = {'ImageId.1': kwargs['image'], 'Action': 'Descr...
Show the details from EC2 concerning an AMI
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3460-L3479
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
show_instance
python
def show_instance(name=None, instance_id=None, call=None, kwargs=None): ''' Show the details from EC2 concerning an AMI. Can be called as an action (which requires a name): .. code-block:: bash salt-cloud -a show_instance myinstance ...or as a function (which requires either a name or in...
Show the details from EC2 concerning an AMI. Can be called as an action (which requires a name): .. code-block:: bash salt-cloud -a show_instance myinstance ...or as a function (which requires either a name or instance_id): .. code-block:: bash salt-cloud -f show_instance my-ec2 na...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3482-L3516
[ "def _get_node(name=None, instance_id=None, location=None):\n if location is None:\n location = get_location()\n\n params = {'Action': 'DescribeInstances'}\n\n if six.text_type(name).startswith('i-') and (len(name) == 10 or len(name) == 19):\n instance_id = name\n\n if instance_id:\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_extract_instance_info
python
def _extract_instance_info(instances): ''' Given an instance query, return a dict of all instance data ''' ret = {} for instance in instances: # items could be type dict or list (for stopped EC2 instances) if isinstance(instance['instancesSet']['item'], list): for item in...
Given an instance query, return a dict of all instance data
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3583-L3621
null
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_list_nodes_full
python
def _list_nodes_full(location=None): ''' Return a list of the VMs that in this location ''' provider = __active_provider_name__ or 'ec2' if ':' in provider: comps = provider.split(':') provider = comps[0] params = {'Action': 'DescribeInstances'} instances = aws.query(params,...
Return a list of the VMs that in this location
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3624-L3649
[ "def query(params=None, setname=None, requesturl=None, location=None,\n return_url=False, return_root=False, opts=None, provider=None,\n endpoint=None, product='ec2', sigver='2'):\n '''\n Perform a query against AWS services using Signature Version 2 Signing\n Process. This is documented ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
list_nodes_min
python
def list_nodes_min(location=None, call=None): ''' Return a list of the VMs that are on the provider. Only a list of VM names, and their state, is returned. This is the minimum amount of information needed to check for existing VMs. ''' if call == 'action': raise SaltCloudSystemExit( ...
Return a list of the VMs that are on the provider. Only a list of VM names, and their state, is returned. This is the minimum amount of information needed to check for existing VMs.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3652-L3688
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
list_nodes_select
python
def list_nodes_select(call=None): ''' Return a list of the VMs that are on the provider, with select fields ''' return salt.utils.cloud.list_nodes_select( list_nodes_full(get_location()), __opts__['query.selection'], call, )
Return a list of the VMs that are on the provider, with select fields
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3721-L3727
[ "def list_nodes_full(location=None, call=None):\n '''\n Return a list of the VMs that are on the provider\n '''\n if call == 'action':\n raise SaltCloudSystemExit(\n 'The list_nodes_full function must be called with -f '\n 'or --function.'\n )\n\n return _list_node...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
show_term_protect
python
def show_term_protect(name=None, instance_id=None, call=None, quiet=False): ''' Show the details from EC2 concerning an instance's termination protection state ''' if call != 'action': raise SaltCloudSystemExit( 'The show_term_protect action must be called with -a or --action.' ...
Show the details from EC2 concerning an instance's termination protection state
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3730-L3764
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
show_detailed_monitoring
python
def show_detailed_monitoring(name=None, instance_id=None, call=None, quiet=False): ''' Show the details from EC2 regarding cloudwatch detailed monitoring. ''' if call != 'action': raise SaltCloudSystemExit( 'The show_detailed_monitoring action must be called with -a or --action.' ...
Show the details from EC2 regarding cloudwatch detailed monitoring.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3767-L3789
[ "def get_location(vm_=None):\n '''\n Return the EC2 region to use, in this order:\n - CLI parameter\n - VM parameter\n - Cloud profile setting\n '''\n return __opts__.get(\n 'location',\n config.get_cloud_config_value(\n 'location',\n vm_ or get_c...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_toggle_term_protect
python
def _toggle_term_protect(name, value): ''' Enable or Disable termination protection on a node ''' instance_id = _get_node(name)['instanceId'] params = {'Action': 'ModifyInstanceAttribute', 'InstanceId': instance_id, 'DisableApiTermination.Value': value} result = aws...
Enable or Disable termination protection on a node
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3792-L3809
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
disable_detailed_monitoring
python
def disable_detailed_monitoring(name, call=None): ''' Enable/disable detailed monitoring on a node CLI Example: ''' if call != 'action': raise SaltCloudSystemExit( 'The enable_term_protect action must be called with ' '-a or --action.' ) instance_id = _g...
Enable/disable detailed monitoring on a node CLI Example:
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3850-L3873
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
show_delvol_on_destroy
python
def show_delvol_on_destroy(name, kwargs=None, call=None): ''' Do not delete all/specified EBS volumes upon instance termination CLI Example: .. code-block:: bash salt-cloud -a show_delvol_on_destroy mymachine ''' if call != 'action': raise SaltCloudSystemExit( 'Th...
Do not delete all/specified EBS volumes upon instance termination CLI Example: .. code-block:: bash salt-cloud -a show_delvol_on_destroy mymachine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3903-L3963
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
keepvol_on_destroy
python
def keepvol_on_destroy(name, kwargs=None, call=None): ''' Do not delete all/specified EBS volumes upon instance termination CLI Example: .. code-block:: bash salt-cloud -a keepvol_on_destroy mymachine ''' if call != 'action': raise SaltCloudSystemExit( 'The keepvol...
Do not delete all/specified EBS volumes upon instance termination CLI Example: .. code-block:: bash salt-cloud -a keepvol_on_destroy mymachine
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L3966-L3988
[ "def _toggle_delvol(name=None, instance_id=None, device=None, volume_id=None,\n value=None, requesturl=None):\n\n if not instance_id:\n instance_id = _get_node(name)['instanceId']\n\n if requesturl:\n data = aws.query(requesturl=requesturl,\n location=ge...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
register_image
python
def register_image(kwargs=None, call=None): ''' Create an ami from a snapshot CLI Example: .. code-block:: bash salt-cloud -f register_image my-ec2-config ami_name=my_ami description="my description" root_device_name=/dev/xvda snapshot_id=snap-xxxxxxxx ''' if call != ...
Create an ami from a snapshot CLI Example: .. code-block:: bash salt-cloud -f register_image my-ec2-config ami_name=my_ami description="my description" root_device_name=/dev/xvda snapshot_id=snap-xxxxxxxx
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4070-L4143
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
create_volume
python
def create_volume(kwargs=None, call=None, wait_to_finish=False): ''' Create a volume. zone The availability zone used to create the volume. Required. String. size The size of the volume, in GiBs. Defaults to ``10``. Integer. snapshot The snapshot-id from which to create th...
Create a volume. zone The availability zone used to create the volume. Required. String. size The size of the volume, in GiBs. Defaults to ``10``. Integer. snapshot The snapshot-id from which to create the volume. Integer. type The volume type. This can be gp2 for Gen...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4154-L4282
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
attach_volume
python
def attach_volume(name=None, kwargs=None, instance_id=None, call=None): ''' Attach a volume to an instance ''' if call != 'action': raise SaltCloudSystemExit( 'The attach_volume action must be called with -a or --action.' ) if not kwargs: kwargs = {} if 'ins...
Attach a volume to an instance
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4302-L4352
[ "def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):\n '''\n Search and return a setting in a known order:\n\n 1. In the virtual machine's configuration\n 2. In the virtual machine's profile configuration\n 3. In the virtual machine's provider configuration\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
describe_volumes
python
def describe_volumes(kwargs=None, call=None): ''' Describe a volume (or volumes) volume_id One or more volume IDs. Multiple IDs must be separated by ",". TODO: Add all of the filters. ''' if call != 'function': log.error( 'The describe_volumes function must be calle...
Describe a volume (or volumes) volume_id One or more volume IDs. Multiple IDs must be separated by ",". TODO: Add all of the filters.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4426-L4460
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
create_keypair
python
def create_keypair(kwargs=None, call=None): ''' Create an SSH keypair ''' if call != 'function': log.error( 'The create_keypair function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} if 'keyname' not in kwargs: ...
Create an SSH keypair
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4463-L4492
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
import_keypair
python
def import_keypair(kwargs=None, call=None): ''' Import an SSH public key. .. versionadded:: 2015.8.3 ''' if call != 'function': log.error( 'The import_keypair function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} ...
Import an SSH public key. .. versionadded:: 2015.8.3
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4495-L4536
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
delete_keypair
python
def delete_keypair(kwargs=None, call=None): ''' Delete an SSH keypair ''' if call != 'function': log.error( 'The delete_keypair function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} if 'keyname' not in kwargs: ...
Delete an SSH keypair
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4568-L4594
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
create_snapshot
python
def create_snapshot(kwargs=None, call=None, wait_to_finish=False): ''' Create a snapshot. volume_id The ID of the Volume from which to create a snapshot. description The optional description of the snapshot. CLI Exampe: .. code-block:: bash salt-cloud -f create_snaps...
Create a snapshot. volume_id The ID of the Volume from which to create a snapshot. description The optional description of the snapshot. CLI Exampe: .. code-block:: bash salt-cloud -f create_snapshot my-ec2-config volume_id=vol-351d8826 salt-cloud -f create_snapshot ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4597-L4662
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n ...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
copy_snapshot
python
def copy_snapshot(kwargs=None, call=None): ''' Copy a snapshot ''' if call != 'function': log.error( 'The copy_snapshot function must be called with -f or --function.' ) return False if 'source_region' not in kwargs: log.error('A source_region must be spe...
Copy a snapshot
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4696-L4736
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
describe_snapshots
python
def describe_snapshots(kwargs=None, call=None): ''' Describe a snapshot (or snapshots) snapshot_id One or more snapshot IDs. Multiple IDs must be separated by ",". owner Return the snapshots owned by the specified owner. Valid values include: self, amazon, <AWS Account ID>. Mul...
Describe a snapshot (or snapshots) snapshot_id One or more snapshot IDs. Multiple IDs must be separated by ",". owner Return the snapshots owned by the specified owner. Valid values include: self, amazon, <AWS Account ID>. Multiple values must be separated by ",". restorab...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4739-L4795
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_console_output
python
def get_console_output( name=None, location=None, instance_id=None, call=None, kwargs=None, ): ''' Show the console output from the instance. By default, returns decoded data, not the Base64-encoded data that is actually returned from the EC2 API. ''' ...
Show the console output from the instance. By default, returns decoded data, not the Base64-encoded data that is actually returned from the EC2 API.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4798-L4848
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n pr...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
get_password_data
python
def get_password_data( name=None, kwargs=None, instance_id=None, call=None, ): ''' Return password data for a Windows instance. By default only the encrypted password data will be returned. However, if a key_file is passed in, then a decrypted password will also be r...
Return password data for a Windows instance. By default only the encrypted password data will be returned. However, if a key_file is passed in, then a decrypted password will also be returned. Note that the key_file references the private key that was used to generate the keypair associated with this ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4851-L4932
[ "def iterkeys(d, **kw):\n return d.iterkeys(**kw)\n", "def itervalues(d, **kw):\n return d.itervalues(**kw)\n", "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
update_pricing
python
def update_pricing(kwargs=None, call=None): ''' Download most recent pricing information from AWS and convert to a local JSON file. CLI Examples: .. code-block:: bash salt-cloud -f update_pricing my-ec2-config salt-cloud -f update_pricing my-ec2-config type=linux .. versionad...
Download most recent pricing information from AWS and convert to a local JSON file. CLI Examples: .. code-block:: bash salt-cloud -f update_pricing my-ec2-config salt-cloud -f update_pricing my-ec2-config type=linux .. versionadded:: 2015.8.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4935-L4965
[ "def _parse_pricing(url, name):\n '''\n Download and parse an individual pricing file from AWS\n\n .. versionadded:: 2015.8.0\n '''\n price_js = http.query(url, text=True)\n\n items = []\n current_item = ''\n\n price_js = re.sub(JS_COMMENT_RE, '', price_js['text'])\n price_js = price_js.s...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
_parse_pricing
python
def _parse_pricing(url, name): ''' Download and parse an individual pricing file from AWS .. versionadded:: 2015.8.0 ''' price_js = http.query(url, text=True) items = [] current_item = '' price_js = re.sub(JS_COMMENT_RE, '', price_js['text']) price_js = price_js.strip().rstrip(');...
Download and parse an individual pricing file from AWS .. versionadded:: 2015.8.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L4968-L5021
[ "def pack(o, stream, **kwargs):\n '''\n .. versionadded:: 2018.3.4\n\n Wraps msgpack.pack and ensures that the passed object is unwrapped if it is\n a proxy.\n\n By default, this function uses the msgpack module and falls back to\n msgpack_pure, if the msgpack is not available. You can pass an alt...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
show_pricing
python
def show_pricing(kwargs=None, call=None): ''' Show pricing for a particular profile. This is only an estimate, based on unofficial pricing sources. CLI Examples: .. code-block:: bash salt-cloud -f show_pricing my-ec2-config profile=my-profile If pricing sources have not been cached, ...
Show pricing for a particular profile. This is only an estimate, based on unofficial pricing sources. CLI Examples: .. code-block:: bash salt-cloud -f show_pricing my-ec2-config profile=my-profile If pricing sources have not been cached, they will be downloaded. Once they have been cache...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L5024-L5115
[ "def unpack(stream, **kwargs):\n '''\n .. versionadded:: 2018.3.4\n\n Wraps msgpack.unpack.\n\n By default, this function uses the msgpack module and falls back to\n msgpack_pure, if the msgpack is not available. You can pass an alternate\n msgpack module using the _msgpack_module argument.\n '...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/cloud/clouds/ec2.py
ssm_create_association
python
def ssm_create_association(name=None, kwargs=None, instance_id=None, call=None): ''' Associates the specified SSM document with the specified instance http://docs.aws.amazon.com/ssm/latest/APIReference/API_CreateAssociation.html CLI Examples: .. code-block:: bash salt-cloud -a ssm_create...
Associates the specified SSM document with the specified instance http://docs.aws.amazon.com/ssm/latest/APIReference/API_CreateAssociation.html CLI Examples: .. code-block:: bash salt-cloud -a ssm_create_association ec2-instance-name ssm_document=ssm-document-name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/ec2.py#L5118-L5166
[ "def get_provider(vm_=None):\n '''\n Extract the provider name from vm\n '''\n if vm_ is None:\n provider = __active_provider_name__ or 'ec2'\n else:\n provider = vm_.get('provider', 'ec2')\n\n if ':' in provider:\n prov_comps = provider.split(':')\n provider = prov_com...
# -*- coding: utf-8 -*- ''' The EC2 Cloud Module ==================== The EC2 cloud module is used to interact with the Amazon Elastic Compute Cloud. To use the EC2 cloud module, set up the cloud configuration at ``/etc/salt/cloud.providers`` or ``/etc/salt/cloud.providers.d/ec2.conf``: .. code-block:: yaml my...
saltstack/salt
salt/modules/vagrant.py
_build_machine_uri
python
def _build_machine_uri(machine, cwd): ''' returns string used to fetch id names from the sdb store. the cwd and machine name are concatenated with '?' which should never collide with a Salt node id -- which is important since we will be storing both in the same table. ''' key = '{}?{}'.form...
returns string used to fetch id names from the sdb store. the cwd and machine name are concatenated with '?' which should never collide with a Salt node id -- which is important since we will be storing both in the same table.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L70-L79
[ "def _build_sdb_uri(key):\n '''\n returns string used to fetch data for \"key\" from the sdb store.\n\n Salt node id's are used as the key for vm_ dicts.\n\n '''\n return '{}{}'.format(VAGRANT_SDB_URL, key)\n" ]
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
_update_vm_info
python
def _update_vm_info(name, vm_): ''' store the vm_ information keyed by name ''' __utils__['sdb.sdb_set'](_build_sdb_uri(name), vm_, __opts__) # store machine-to-name mapping, too if vm_['machine']: __utils__['sdb.sdb_set']( _build_machine_uri(vm_['machine'], vm_.get('cwd', '.')), ...
store the vm_ information keyed by name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L82-L91
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
get_vm_info
python
def get_vm_info(name): ''' get the information for a VM. :param name: salt_id name :return: dictionary of {'machine': x, 'cwd': y, ...}. ''' try: vm_ = __utils__['sdb.sdb_get'](_build_sdb_uri(name), __opts__) except KeyError: raise SaltInvocationError( 'Probable ...
get the information for a VM. :param name: salt_id name :return: dictionary of {'machine': x, 'cwd': y, ...}.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L94-L109
[ "def _build_sdb_uri(key):\n '''\n returns string used to fetch data for \"key\" from the sdb store.\n\n Salt node id's are used as the key for vm_ dicts.\n\n '''\n return '{}{}'.format(VAGRANT_SDB_URL, key)\n" ]
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
get_machine_id
python
def get_machine_id(machine, cwd): ''' returns the salt_id name of the Vagrant VM :param machine: the Vagrant machine name :param cwd: the path to Vagrantfile :return: salt_id name ''' name = __utils__['sdb.sdb_get'](_build_machine_uri(machine, cwd), __opts__) return name
returns the salt_id name of the Vagrant VM :param machine: the Vagrant machine name :param cwd: the path to Vagrantfile :return: salt_id name
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L112-L121
[ "def _build_machine_uri(machine, cwd):\n '''\n returns string used to fetch id names from the sdb store.\n\n the cwd and machine name are concatenated with '?' which should\n never collide with a Salt node id -- which is important since we\n will be storing both in the same table.\n '''\n key =...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
_erase_vm_info
python
def _erase_vm_info(name): ''' erase the information for a VM the we are destroying. some sdb drivers (such as the SQLite driver we expect to use) do not have a `delete` method, so if the delete fails, we have to replace the with a blank entry. ''' try: # delete the machine record ...
erase the information for a VM the we are destroying. some sdb drivers (such as the SQLite driver we expect to use) do not have a `delete` method, so if the delete fails, we have to replace the with a blank entry.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L124-L153
[ "def get_vm_info(name):\n '''\n get the information for a VM.\n\n :param name: salt_id name\n :return: dictionary of {'machine': x, 'cwd': y, ...}.\n '''\n try:\n vm_ = __utils__['sdb.sdb_get'](_build_sdb_uri(name), __opts__)\n except KeyError:\n raise SaltInvocationError(\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
_vagrant_ssh_config
python
def _vagrant_ssh_config(vm_): ''' get the information for ssh communication from the new VM :param vm_: the VM's info as we have it now :return: dictionary of ssh stuff ''' machine = vm_['machine'] log.info('requesting vagrant ssh-config for VM %s', machine or '(default)') cmd = 'vagran...
get the information for ssh communication from the new VM :param vm_: the VM's info as we have it now :return: dictionary of ssh stuff
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L156-L176
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
list_domains
python
def list_domains(): ''' Return a list of the salt_id names of all available Vagrant VMs on this host without regard to the path where they are defined. CLI Example: .. code-block:: bash salt '*' vagrant.list_domains --log-level=info The log shows information about all known Vagrant e...
Return a list of the salt_id names of all available Vagrant VMs on this host without regard to the path where they are defined. CLI Example: .. code-block:: bash salt '*' vagrant.list_domains --log-level=info The log shows information about all known Vagrant environments on this machine....
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L193-L223
[ "def get_machine_id(machine, cwd):\n '''\n returns the salt_id name of the Vagrant VM\n\n :param machine: the Vagrant machine name\n :param cwd: the path to Vagrantfile\n :return: salt_id name\n '''\n name = __utils__['sdb.sdb_get'](_build_machine_uri(machine, cwd), __opts__)\n return name\n...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
list_active_vms
python
def list_active_vms(cwd=None): ''' Return a list of machine names for active virtual machine on the host, which are defined in the Vagrantfile at the indicated path. CLI Example: .. code-block:: bash salt '*' vagrant.list_active_vms cwd=/projects/project_1 ''' vms = [] cmd = ...
Return a list of machine names for active virtual machine on the host, which are defined in the Vagrantfile at the indicated path. CLI Example: .. code-block:: bash salt '*' vagrant.list_active_vms cwd=/projects/project_1
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L226-L246
null
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
vm_state
python
def vm_state(name='', cwd=None): ''' Return list of information for all the vms indicating their state. If you pass a VM name in as an argument then it will return info for just the named VM, otherwise it will return all VMs defined by the Vagrantfile in the `cwd` directory. CLI Example: ...
Return list of information for all the vms indicating their state. If you pass a VM name in as an argument then it will return info for just the named VM, otherwise it will return all VMs defined by the Vagrantfile in the `cwd` directory. CLI Example: .. code-block:: bash salt '*' vagran...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L273-L330
[ "def get_machine_id(machine, cwd):\n '''\n returns the salt_id name of the Vagrant VM\n\n :param machine: the Vagrant machine name\n :param cwd: the path to Vagrantfile\n :return: salt_id name\n '''\n name = __utils__['sdb.sdb_get'](_build_machine_uri(machine, cwd), __opts__)\n return name\n...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
init
python
def init(name, # Salt_id for created VM cwd=None, # path to find Vagrantfile machine='', # name of machine in Vagrantfile runas=None, # username who owns Vagrant box start=False, # start the machine when initialized vagrant_provider='', # vagrant provider (default=virt...
Initialize a new Vagrant VM. This inputs all the information needed to start a Vagrant VM. These settings are stored in a Salt sdb database on the Vagrant host minion and used to start, control, and query the guest VMs. The salt_id assigned here is the key field for that database and must be unique. ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L333-L380
[ "def _start(name, vm_): # internal call name, because \"start\" is a keyword argument to vagrant.init\n\n try:\n machine = vm_['machine']\n except KeyError:\n raise SaltInvocationError('No Vagrant machine defined for Salt_id {}'.format(name))\n\n vagrant_provider = vm_.get('vagrant_provider'...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
stop
python
def stop(name): ''' Hard shutdown the virtual machine. (vagrant halt) CLI Example: .. code-block:: bash salt <host> vagrant.stop <salt_id> ''' vm_ = get_vm_info(name) machine = vm_['machine'] cmd = 'vagrant halt {}'.format(machine) ret = __salt__['cmd.retcode'](cmd, ...
Hard shutdown the virtual machine. (vagrant halt) CLI Example: .. code-block:: bash salt <host> vagrant.stop <salt_id>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L440-L457
[ "def get_vm_info(name):\n '''\n get the information for a VM.\n\n :param name: salt_id name\n :return: dictionary of {'machine': x, 'cwd': y, ...}.\n '''\n try:\n vm_ = __utils__['sdb.sdb_get'](_build_sdb_uri(name), __opts__)\n except KeyError:\n raise SaltInvocationError(\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
reboot
python
def reboot(name, provision=False): ''' Reboot a VM. (vagrant reload) CLI Example: .. code-block:: bash salt <host> vagrant.reboot <salt_id> provision=True :param name: The salt_id name you will use to control this VM :param provision: (False) also re-run the Vagrant provisioning scri...
Reboot a VM. (vagrant reload) CLI Example: .. code-block:: bash salt <host> vagrant.reboot <salt_id> provision=True :param name: The salt_id name you will use to control this VM :param provision: (False) also re-run the Vagrant provisioning scripts.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L480-L501
[ "def get_vm_info(name):\n '''\n get the information for a VM.\n\n :param name: salt_id name\n :return: dictionary of {'machine': x, 'cwd': y, ...}.\n '''\n try:\n vm_ = __utils__['sdb.sdb_get'](_build_sdb_uri(name), __opts__)\n except KeyError:\n raise SaltInvocationError(\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
destroy
python
def destroy(name): ''' Destroy and delete a virtual machine. (vagrant destroy -f) This also removes the salt_id name defined by vagrant.init. CLI Example: .. code-block:: bash salt <host> vagrant.destroy <salt_id> ''' vm_ = get_vm_info(name) machine = vm_['machine'] cmd ...
Destroy and delete a virtual machine. (vagrant destroy -f) This also removes the salt_id name defined by vagrant.init. CLI Example: .. code-block:: bash salt <host> vagrant.destroy <salt_id>
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L504-L528
[ "def get_vm_info(name):\n '''\n get the information for a VM.\n\n :param name: salt_id name\n :return: dictionary of {'machine': x, 'cwd': y, ...}.\n '''\n try:\n vm_ = __utils__['sdb.sdb_get'](_build_sdb_uri(name), __opts__)\n except KeyError:\n raise SaltInvocationError(\n ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/modules/vagrant.py
get_ssh_config
python
def get_ssh_config(name, network_mask='', get_private_key=False): r''' Retrieve hints of how you might connect to a Vagrant VM. :param name: the salt_id of the machine :param network_mask: a CIDR mask to search for the VM's address :param get_private_key: (default: False) return the key used for ss...
r''' Retrieve hints of how you might connect to a Vagrant VM. :param name: the salt_id of the machine :param network_mask: a CIDR mask to search for the VM's address :param get_private_key: (default: False) return the key used for ssh login :return: a dict of ssh login information for the VM C...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vagrant.py#L531-L632
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Work with virtual machines managed by Vagrant. .. versionadded:: 2018.3.0 Mapping between a Salt node id and the Vagrant machine name (and the path to the Vagrantfile where it is defined) is stored in a Salt sdb database on the Vagrant host (minion) machine. In order to use this module, sd...
saltstack/salt
salt/states/esxvm.py
vm_configured
python
def vm_configured(name, vm_name, cpu, memory, image, version, interfaces, disks, scsi_devices, serial_ports, datacenter, datastore, placement, cd_dvd_drives=None, sata_controllers=None, advanced_configs=None, template=None, tools=True, power_on=Fal...
Selects the correct operation to be executed on a virtual machine, non existing machines will be created, existing ones will be updated if the config differs.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxvm.py#L227-L312
[ "def vm_registered(vm_name, datacenter, placement, vm_file, power_on=False):\n '''\n Registers a virtual machine if the machine files are available on\n the main datastore.\n '''\n result = {'name': vm_name,\n 'result': None,\n 'changes': {},\n 'comment': ''}\n\...
# -*- coding: utf-8 -*- ''' Salt state to create, update VMware ESXi Virtual Machines. Dependencies ============ - pyVmomi - jsonschema States ====== vm_configured ------------- Enforces correct virtual machine configuration. Creates, updates and registers a virtual machine. This state identifies the action which...
saltstack/salt
salt/states/esxvm.py
vm_updated
python
def vm_updated(name, vm_name, cpu, memory, image, version, interfaces, disks, scsi_devices, serial_ports, datacenter, datastore, cd_dvd_drives=None, sata_controllers=None, advanced_configs=None, power_on=False): ''' Updates a virtual machine configuration if there is...
Updates a virtual machine configuration if there is a difference between the given and deployed configuration.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxvm.py#L328-L421
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' Salt state to create, update VMware ESXi Virtual Machines. Dependencies ============ - pyVmomi - jsonschema States ====== vm_configured ------------- Enforces correct virtual machine configuration. Creates, updates and registers a virtual machine. This state identifies the action which...
saltstack/salt
salt/states/esxvm.py
vm_created
python
def vm_created(name, vm_name, cpu, memory, image, version, interfaces, disks, scsi_devices, serial_ports, datacenter, datastore, placement, ide_controllers=None, sata_controllers=None, cd_dvd_drives=None, advanced_configs=None, power_on=False): ''' Creates a virtual ...
Creates a virtual machine with the given properties if it doesn't exist.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxvm.py#L424-L484
null
# -*- coding: utf-8 -*- ''' Salt state to create, update VMware ESXi Virtual Machines. Dependencies ============ - pyVmomi - jsonschema States ====== vm_configured ------------- Enforces correct virtual machine configuration. Creates, updates and registers a virtual machine. This state identifies the action which...
saltstack/salt
salt/states/esxvm.py
vm_registered
python
def vm_registered(vm_name, datacenter, placement, vm_file, power_on=False): ''' Registers a virtual machine if the machine files are available on the main datastore. ''' result = {'name': vm_name, 'result': None, 'changes': {}, 'comment': ''} vmx_path =...
Registers a virtual machine if the machine files are available on the main datastore.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/esxvm.py#L487-L537
null
# -*- coding: utf-8 -*- ''' Salt state to create, update VMware ESXi Virtual Machines. Dependencies ============ - pyVmomi - jsonschema States ====== vm_configured ------------- Enforces correct virtual machine configuration. Creates, updates and registers a virtual machine. This state identifies the action which...
saltstack/salt
salt/states/npm.py
installed
python
def installed(name, pkgs=None, dir=None, user=None, force_reinstall=False, registry=None, env=None): ''' Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml ...
Verify that the given package is installed and is at the correct version (if specified). .. code-block:: yaml coffee-script: npm.installed: - user: someuser coffee-script@1.0.1: npm.installed: [] name The package to install .. versionchang...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/npm.py#L38-L223
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n", "def _pkg_is_installed(pkg, installed_pkgs):\n '''\n Helper function to determine if a package is installed\n\n This performs more complex comparison than just checking\n keys, such as examining source repos to see if the package\n was inst...
# -*- coding: utf-8 -*- ''' Installation of NPM Packages ============================ These states manage the installed packages for node.js using the Node Package Manager (npm). Note that npm must be installed for these states to be available, so npm states should include a requisite to a pkg.installed state for the ...
saltstack/salt
salt/states/npm.py
removed
python
def removed(name, dir=None, user=None): ''' Verify that the given package is not installed. dir The target directory in which to install the package, or None for global installation user The user to run NPM with .. versionadded:: 0.17.0 ''' ret = {'name': name,...
Verify that the given package is not installed. dir The target directory in which to install the package, or None for global installation user The user to run NPM with .. versionadded:: 0.17.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/npm.py#L226-L266
null
# -*- coding: utf-8 -*- ''' Installation of NPM Packages ============================ These states manage the installed packages for node.js using the Node Package Manager (npm). Note that npm must be installed for these states to be available, so npm states should include a requisite to a pkg.installed state for the ...
saltstack/salt
salt/states/npm.py
bootstrap
python
def bootstrap(name, user=None, silent=True): ''' Bootstraps a node.js application. Will execute 'npm install --json' on the specified directory. user The user to run NPM with .. versionadded:: 0.17.0 ''' ret = {'name': name, 'result': None, 'comment': '', 'changes': {}} i...
Bootstraps a node.js application. Will execute 'npm install --json' on the specified directory. user The user to run NPM with .. versionadded:: 0.17.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/npm.py#L269-L319
null
# -*- coding: utf-8 -*- ''' Installation of NPM Packages ============================ These states manage the installed packages for node.js using the Node Package Manager (npm). Note that npm must be installed for these states to be available, so npm states should include a requisite to a pkg.installed state for the ...
saltstack/salt
salt/states/npm.py
cache_cleaned
python
def cache_cleaned(name=None, user=None, force=False): ''' Ensure that the given package is not cached. If no package is specified, this ensures the entire cache is cleared. name The name of the package to remove from the cache, or None for all packages ...
Ensure that the given package is not cached. If no package is specified, this ensures the entire cache is cleared. name The name of the package to remove from the cache, or None for all packages user The user to run NPM with force Force cleaning of cache. Required for npm@5 ...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/npm.py#L322-L378
null
# -*- coding: utf-8 -*- ''' Installation of NPM Packages ============================ These states manage the installed packages for node.js using the Node Package Manager (npm). Note that npm must be installed for these states to be available, so npm states should include a requisite to a pkg.installed state for the ...
saltstack/salt
salt/states/splunk_search.py
present
python
def present(name, profile="splunk", **kwargs): ''' Ensure a search is present .. code-block:: yaml API Error Search: splunk_search.present: search: index=main sourcetype=blah template: alert_5min The following parameters are required: name This i...
Ensure a search is present .. code-block:: yaml API Error Search: splunk_search.present: search: index=main sourcetype=blah template: alert_5min The following parameters are required: name This is the name of the search in splunk
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/splunk_search.py#L26-L87
null
# -*- coding: utf-8 -*- ''' Splunk Search State Module .. versionadded:: 2015.5.0 This state is used to ensure presence of splunk searches. .. code-block:: yaml server-warning-message: splunk_search.present: - name: This is the splunk search name - search: index=main sourcetype= ''' from _...
saltstack/salt
salt/states/splunk_search.py
absent
python
def absent(name, profile="splunk"): ''' Ensure a search is absent .. code-block:: yaml API Error Search: splunk_search.absent The following parameters are required: name This is the name of the search in splunk ''' ret = { 'name': name, 'changes'...
Ensure a search is absent .. code-block:: yaml API Error Search: splunk_search.absent The following parameters are required: name This is the name of the search in splunk
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/splunk_search.py#L90-L126
null
# -*- coding: utf-8 -*- ''' Splunk Search State Module .. versionadded:: 2015.5.0 This state is used to ensure presence of splunk searches. .. code-block:: yaml server-warning-message: splunk_search.present: - name: This is the splunk search name - search: index=main sourcetype= ''' from _...
saltstack/salt
salt/states/modjk.py
_bulk_state
python
def _bulk_state(saltfunc, lbn, workers, profile): ''' Generic function for bulk worker operation ''' ret = {'name': lbn, 'result': True, 'changes': {}, 'comment': ''} if not isinstance(workers, list): ret['result'] = False ret['comment'] = 'workers s...
Generic function for bulk worker operation
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk.py#L24-L64
[ "def iteritems(d, **kw):\n return d.iteritems(**kw)\n" ]
# -*- coding: utf-8 -*- ''' State to control Apache modjk ''' # Python Libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import 3rd-party libs from salt.ext import six log = logging.getLogger(__name__) def __virtual__(): ''' Load this state if modjk is loaded ...
saltstack/salt
salt/states/modjk.py
worker_stopped
python
def worker_stopped(name, workers=None, profile='default'): ''' Stop all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_stopped: - workers: - app1 - app2 ''' if workers is None: w...
Stop all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_stopped: - workers: - app1 - app2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk.py#L67-L85
[ "def _bulk_state(saltfunc, lbn, workers, profile):\n '''\n Generic function for bulk worker operation\n '''\n ret = {'name': lbn,\n 'result': True,\n 'changes': {},\n 'comment': ''}\n\n if not isinstance(workers, list):\n ret['result'] = False\n ret['commen...
# -*- coding: utf-8 -*- ''' State to control Apache modjk ''' # Python Libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import 3rd-party libs from salt.ext import six log = logging.getLogger(__name__) def __virtual__(): ''' Load this state if modjk is loaded ...
saltstack/salt
salt/states/modjk.py
worker_activated
python
def worker_activated(name, workers=None, profile='default'): ''' Activate all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_activated: - workers: - app1 - app2 ''' if workers is None: ...
Activate all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_activated: - workers: - app1 - app2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk.py#L88-L106
[ "def _bulk_state(saltfunc, lbn, workers, profile):\n '''\n Generic function for bulk worker operation\n '''\n ret = {'name': lbn,\n 'result': True,\n 'changes': {},\n 'comment': ''}\n\n if not isinstance(workers, list):\n ret['result'] = False\n ret['commen...
# -*- coding: utf-8 -*- ''' State to control Apache modjk ''' # Python Libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import 3rd-party libs from salt.ext import six log = logging.getLogger(__name__) def __virtual__(): ''' Load this state if modjk is loaded ...
saltstack/salt
salt/states/modjk.py
worker_disabled
python
def worker_disabled(name, workers=None, profile='default'): ''' Disable all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_disabled: - workers: - app1 - app2 ''' if workers is None: ...
Disable all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_disabled: - workers: - app1 - app2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk.py#L109-L127
[ "def _bulk_state(saltfunc, lbn, workers, profile):\n '''\n Generic function for bulk worker operation\n '''\n ret = {'name': lbn,\n 'result': True,\n 'changes': {},\n 'comment': ''}\n\n if not isinstance(workers, list):\n ret['result'] = False\n ret['commen...
# -*- coding: utf-8 -*- ''' State to control Apache modjk ''' # Python Libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import 3rd-party libs from salt.ext import six log = logging.getLogger(__name__) def __virtual__(): ''' Load this state if modjk is loaded ...
saltstack/salt
salt/states/modjk.py
worker_recover
python
def worker_recover(name, workers=None, profile='default'): ''' Recover all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_recover: - workers: - app1 - app2 ''' if workers is None: ...
Recover all the workers in the modjk load balancer Example: .. code-block:: yaml loadbalancer: modjk.worker_recover: - workers: - app1 - app2
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/modjk.py#L130-L148
[ "def _bulk_state(saltfunc, lbn, workers, profile):\n '''\n Generic function for bulk worker operation\n '''\n ret = {'name': lbn,\n 'result': True,\n 'changes': {},\n 'comment': ''}\n\n if not isinstance(workers, list):\n ret['result'] = False\n ret['commen...
# -*- coding: utf-8 -*- ''' State to control Apache modjk ''' # Python Libs from __future__ import absolute_import, print_function, unicode_literals import logging # Import 3rd-party libs from salt.ext import six log = logging.getLogger(__name__) def __virtual__(): ''' Load this state if modjk is loaded ...
saltstack/salt
salt/states/firewalld.py
_parse_forward
python
def _parse_forward(mapping): ''' Parses a port forwarding statement in the form used by this state: from_port:to_port:protocol[:destination] and returns a ForwardingMapping object ''' if len(mapping.split(':')) > 3: (srcport, destport, protocol, destaddr) = mapping.split(':') else:...
Parses a port forwarding statement in the form used by this state: from_port:to_port:protocol[:destination] and returns a ForwardingMapping object
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/firewalld.py#L129-L142
null
# -*- coding: utf-8 -*- ''' Management of firewalld .. versionadded:: 2015.8.0 The following example applies changes to the public zone, blocks echo-reply and echo-request packets, does not set the zone to be the default, enables masquerading, and allows ports 22/tcp and 25/tcp. It will be applied permanently and dir...
saltstack/salt
salt/states/firewalld.py
present
python
def present(name, block_icmp=None, prune_block_icmp=False, default=None, masquerade=False, ports=None, prune_ports=False, port_fwd=None, prune_port_fwd=False, services=None, prune_services=False, ...
Ensure a zone has specific attributes. name The zone to modify. default : None Set this zone as the default zone if ``True``. masquerade : False Enable or disable masquerade for a zone. block_icmp : None List of ICMP types to block in the zone. prune_block_icmp :...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/firewalld.py#L155-L236
[ "def _present(name,\n block_icmp=None,\n prune_block_icmp=False,\n default=None,\n masquerade=False,\n ports=None,\n prune_ports=False,\n port_fwd=None,\n prune_port_fwd=False,\n services=None,\n # TODO: pr...
# -*- coding: utf-8 -*- ''' Management of firewalld .. versionadded:: 2015.8.0 The following example applies changes to the public zone, blocks echo-reply and echo-request packets, does not set the zone to be the default, enables masquerading, and allows ports 22/tcp and 25/tcp. It will be applied permanently and dir...
saltstack/salt
salt/states/firewalld.py
service
python
def service(name, ports=None, protocols=None): ''' Ensure the service exists and encompasses the specified ports and protocols. .. versionadded:: 2016.11.0 ''' ret = {'name': name, 'result': False, 'changes': {}, 'comment': ''} if na...
Ensure the service exists and encompasses the specified ports and protocols. .. versionadded:: 2016.11.0
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/firewalld.py#L239-L335
null
# -*- coding: utf-8 -*- ''' Management of firewalld .. versionadded:: 2015.8.0 The following example applies changes to the public zone, blocks echo-reply and echo-request packets, does not set the zone to be the default, enables masquerading, and allows ports 22/tcp and 25/tcp. It will be applied permanently and dir...
saltstack/salt
salt/states/firewalld.py
_present
python
def _present(name, block_icmp=None, prune_block_icmp=False, default=None, masquerade=False, ports=None, prune_ports=False, port_fwd=None, prune_port_fwd=False, services=None, # TODO: prune_services=Fa...
Ensure a zone has specific attributes.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/firewalld.py#L338-L766
[ "def output(ret, **kwargs):\n '''\n Display ret data\n '''\n # Prefer kwargs before opts\n retcode = kwargs.get('_retcode', 0)\n base_indent = kwargs.get('nested_indent', 0) \\\n or __opts__.get('nested_indent', 0)\n nest = NestDisplay(retcode=retcode)\n lines = nest.display(ret, base...
# -*- coding: utf-8 -*- ''' Management of firewalld .. versionadded:: 2015.8.0 The following example applies changes to the public zone, blocks echo-reply and echo-request packets, does not set the zone to be the default, enables masquerading, and allows ports 22/tcp and 25/tcp. It will be applied permanently and dir...
saltstack/salt
salt/states/firewalld.py
ForwardingMapping.todict
python
def todict(self): ''' Returns a pretty dictionary meant for command line output. ''' return { 'Source port': self.srcport, 'Destination port': self.destport, 'Protocol': self.protocol, 'Destination address': self.destaddr}
Returns a pretty dictionary meant for command line output.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/firewalld.py#L118-L126
null
class ForwardingMapping(object): ''' Represents a port forwarding statement mapping a local port to a remote port for a specific protocol (TCP or UDP) ''' def __init__(self, srcport, destport, protocol, destaddr): self.srcport = srcport self.destport = destport self.protocol ...
saltstack/salt
salt/modules/jenkinsmod.py
_connect
python
def _connect(): ''' Return server object used to interact with Jenkins. :return: server object used to interact with Jenkins ''' jenkins_url = __salt__['config.get']('jenkins.url') or \ __salt__['config.get']('jenkins:url') or \ __salt__['pillar.get']('jenkins.url') jenkins_use...
Return server object used to interact with Jenkins. :return: server object used to interact with Jenkins
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L69-L92
null
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...
saltstack/salt
salt/modules/jenkinsmod.py
_retrieve_config_xml
python
def _retrieve_config_xml(config_xml, saltenv): ''' Helper to cache the config XML and raise a CommandExecutionError if we fail to do so. If we successfully cache the file, return the cached path. ''' ret = __salt__['cp.cache_file'](config_xml, saltenv) if not ret: raise CommandExecution...
Helper to cache the config XML and raise a CommandExecutionError if we fail to do so. If we successfully cache the file, return the cached path.
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L95-L105
null
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...
saltstack/salt
salt/modules/jenkinsmod.py
job_exists
python
def job_exists(name=None): ''' Check whether the job exists in configured Jenkins jobs. :param name: The name of the job is check if it exists. :return: True if job exists, False if job does not exist. CLI Example: .. code-block:: bash salt '*' jenkins.job_exists jobname ''' ...
Check whether the job exists in configured Jenkins jobs. :param name: The name of the job is check if it exists. :return: True if job exists, False if job does not exist. CLI Example: .. code-block:: bash salt '*' jenkins.job_exists jobname
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L170-L191
[ "def _connect():\n '''\n Return server object used to interact with Jenkins.\n\n :return: server object used to interact with Jenkins\n '''\n jenkins_url = __salt__['config.get']('jenkins.url') or \\\n __salt__['config.get']('jenkins:url') or \\\n __salt__['pillar.get']('jenkins.url')\n...
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...
saltstack/salt
salt/modules/jenkinsmod.py
get_job_info
python
def get_job_info(name=None): ''' Return information about the Jenkins job. :param name: The name of the job is check if it exists. :return: Information about the Jenkins job. CLI Example: .. code-block:: bash salt '*' jenkins.get_job_info jobname ''' if not name: rai...
Return information about the Jenkins job. :param name: The name of the job is check if it exists. :return: Information about the Jenkins job. CLI Example: .. code-block:: bash salt '*' jenkins.get_job_info jobname
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L194-L219
[ "def _connect():\n '''\n Return server object used to interact with Jenkins.\n\n :return: server object used to interact with Jenkins\n '''\n jenkins_url = __salt__['config.get']('jenkins.url') or \\\n __salt__['config.get']('jenkins:url') or \\\n __salt__['pillar.get']('jenkins.url')\n...
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...
saltstack/salt
salt/modules/jenkinsmod.py
build_job
python
def build_job(name=None, parameters=None): ''' Initiate a build for the provided job. :param name: The name of the job is check if it exists. :param parameters: Parameters to send to the job. :return: True is successful, otherwise raise an exception. CLI Example: .. code-block:: bash ...
Initiate a build for the provided job. :param name: The name of the job is check if it exists. :param parameters: Parameters to send to the job. :return: True is successful, otherwise raise an exception. CLI Example: .. code-block:: bash salt '*' jenkins.build_job jobname
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L222-L251
[ "def _connect():\n '''\n Return server object used to interact with Jenkins.\n\n :return: server object used to interact with Jenkins\n '''\n jenkins_url = __salt__['config.get']('jenkins.url') or \\\n __salt__['config.get']('jenkins:url') or \\\n __salt__['pillar.get']('jenkins.url')\n...
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...
saltstack/salt
salt/modules/jenkinsmod.py
create_job
python
def create_job(name=None, config_xml=None, saltenv='base'): ''' Return the configuration file. :param name: The name of the job is check if it exists. :param config_xml: The configuration file to use to create the job. :param saltenv: The environment to look for the fi...
Return the configuration file. :param name: The name of the job is check if it exists. :param config_xml: The configuration file to use to create the job. :param saltenv: The environment to look for the file in. :return: The configuration file used for the job. CLI Example: .. code-block:: ba...
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L254-L295
[ "def fopen(*args, **kwargs):\n '''\n Wrapper around open() built-in to set CLOEXEC on the fd.\n\n This flag specifies that the file descriptor should be closed when an exec\n function is invoked;\n\n When a file descriptor is allocated (as with open or dup), this bit is\n initially cleared on the ...
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...
saltstack/salt
salt/modules/jenkinsmod.py
delete_job
python
def delete_job(name=None): ''' Return true is job is deleted successfully. :param name: The name of the job to delete. :return: Return true if job is deleted successfully. CLI Example: .. code-block:: bash salt '*' jenkins.delete_job jobname ''' if not name: raise Sa...
Return true is job is deleted successfully. :param name: The name of the job to delete. :return: Return true if job is deleted successfully. CLI Example: .. code-block:: bash salt '*' jenkins.delete_job jobname
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L339-L367
[ "def _connect():\n '''\n Return server object used to interact with Jenkins.\n\n :return: server object used to interact with Jenkins\n '''\n jenkins_url = __salt__['config.get']('jenkins.url') or \\\n __salt__['config.get']('jenkins:url') or \\\n __salt__['pillar.get']('jenkins.url')\n...
# -*- coding: utf-8 -*- ''' Module for controlling Jenkins :depends: python-jenkins .. versionadded:: 2016.3.0 :depends: python-jenkins_ Python module (not to be confused with jenkins_) .. _python-jenkins: https://pypi.python.org/pypi/python-jenkins .. _jenkins: https://pypi.python.org/pypi/jenkins :configuration:...