INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Retrieves information about a registered nameserver. Returns the following information:
def get_info(sld, tld, nameserver): ''' Retrieves information about a registered nameserver. Returns the following information: - IP Address set for the nameserver - Domain name which was queried - A list of nameservers and their statuses sld SLD of the domain name tld ...
Deletes a nameserver. Returns True if the nameserver was updated successfully.
def update(sld, tld, nameserver, old_ip, new_ip): ''' Deletes a nameserver. Returns ``True`` if the nameserver was updated successfully. sld SLD of the domain name tld TLD of the domain name nameserver Nameserver to create old_ip Current ip address ne...
Deletes a nameserver. Returns True if the nameserver was deleted successfully
def delete(sld, tld, nameserver): ''' Deletes a nameserver. Returns ``True`` if the nameserver was deleted successfully sld SLD of the domain name tld TLD of the domain name nameserver Nameserver to delete CLI Example: .. code-block:: bash salt '*' n...
Creates a new nameserver. Returns True if the nameserver was created successfully.
def create(sld, tld, nameserver, ip): ''' Creates a new nameserver. Returns ``True`` if the nameserver was created successfully. sld SLD of the domain name tld TLD of the domain name nameserver Nameserver to create ip Nameserver IP address CLI Example...
Shows installed version of dnsmasq.
def version(): ''' Shows installed version of dnsmasq. CLI Example: .. code-block:: bash salt '*' dnsmasq.version ''' cmd = 'dnsmasq -v' out = __salt__['cmd.run'](cmd).splitlines() comps = out[0].split() return comps[2]
Shows installed version of dnsmasq and compile options.
def fullversion(): ''' Shows installed version of dnsmasq and compile options. CLI Example: .. code-block:: bash salt '*' dnsmasq.fullversion ''' cmd = 'dnsmasq -v' out = __salt__['cmd.run'](cmd).splitlines() comps = out[0].split() version_num = comps[2] comps = out[1]...
Sets a value or a set of values in the specified file. By default if conf - dir is configured in this file salt will attempt to set the option in any file inside the conf - dir where it has already been enabled. If it does not find it inside any files it will append it to the main config file. Setting follow to False w...
def set_config(config_file='/etc/dnsmasq.conf', follow=True, **kwargs): ''' Sets a value or a set of values in the specified file. By default, if conf-dir is configured in this file, salt will attempt to set the option in any file inside the conf-dir where it has already been enabled. If it does not...
Dumps all options from the config file.
def get_config(config_file='/etc/dnsmasq.conf'): ''' Dumps all options from the config file. config_file The location of the config file from which to obtain contents. Defaults to ``/etc/dnsmasq.conf``. CLI Examples: .. code-block:: bash salt '*' dnsmasq.get_config ...
Generic function for parsing dnsmasq files including includes.
def _parse_dnamasq(filename): ''' Generic function for parsing dnsmasq files including includes. ''' fileopts = {} if not os.path.isfile(filename): raise CommandExecutionError( 'Error: No such file \'{0}\''.format(filename) ) with salt.utils.files.fopen(filename, 'r...
Read in the dict structure generated by the salt key API methods and print the structure.
def output(data, **kwargs): # pylint: disable=unused-argument ''' Read in the dict structure generated by the salt key API methods and print the structure. ''' color = salt.utils.color.get_colors( __opts__.get('color'), __opts__.get('color_theme')) strip_colors = __opts_...
Get a boto connection to SQS.
def _get_sqs_conn(profile, region=None, key=None, keyid=None): ''' Get a boto connection to SQS. ''' if profile: if isinstance(profile, six.string_types): _profile = __opts__[profile] elif isinstance(profile, dict): _profile = profile key = _profile.get('k...
Listen to sqs and fire message on event bus
def start(queue, profile=None, tag='salt/engine/sqs', owner_acct_id=None): ''' Listen to sqs and fire message on event bus ''' if __opts__.get('__role') == 'master': fire_master = salt.utils.event.get_master_event( __opts__, __opts__['sock_dir'], listen=False)...
Send a file from the master to the location in specified
def get_file(path, dest, saltenv='base', makedirs=False, template=None, gzip=None): ''' Send a file from the master to the location in specified .. note:: gzip compression is not supported in the salt-ssh version of cp.get_fi...
Transfer a directory down
def get_dir(path, dest, saltenv='base'): ''' Transfer a directory down ''' src = __context__['fileclient'].cache_dir( path, saltenv, cachedir=os.path.join('salt-ssh', __salt__.kwargs['id_'])) src = ' '.join(src) single = salt.client.ssh.Single( __opts__, ...
Freeze python types by turning them into immutable structures.
def freeze(obj): ''' Freeze python types by turning them into immutable structures. ''' if isinstance(obj, dict): return ImmutableDict(obj) if isinstance(obj, list): return ImmutableList(obj) if isinstance(obj, set): return ImmutableSet(obj) return obj
Display alternatives settings for defined command name
def display(name): ''' Display alternatives settings for defined command name CLI Example: .. code-block:: bash salt '*' alternatives.display editor ''' cmd = [_get_cmd(), '--display', name] out = __salt__['cmd.run_all'](cmd, python_shell=False) if out['retcode'] > 0 and out['...
Display master link for the alternative
def show_link(name): ''' Display master link for the alternative .. versionadded:: 2015.8.13,2016.3.4,2016.11.0 CLI Example: .. code-block:: bash salt '*' alternatives.show_link editor ''' if __grains__['os_family'] == 'RedHat': path = '/var/lib/' elif __grains__['os...
Check if the given path is an alternative for a name.
def check_exists(name, path): ''' Check if the given path is an alternative for a name. .. versionadded:: 2015.8.4 CLI Example: .. code-block:: bash salt '*' alternatives.check_exists name path ''' cmd = [_get_cmd(), '--display', name] out = __salt__['cmd.run_all'](cmd, pytho...
Install symbolic links determining default commands
def install(name, link, path, priority): ''' Install symbolic links determining default commands CLI Example: .. code-block:: bash salt '*' alternatives.install editor /usr/bin/editor /usr/bin/emacs23 50 ''' cmd = [_get_cmd(), '--install', link, name, path, six.text_type(priority)] ...
Remove symbolic links determining the default commands.
def remove(name, path): ''' Remove symbolic links determining the default commands. CLI Example: .. code-block:: bash salt '*' alternatives.remove name path ''' cmd = [_get_cmd(), '--remove', name, path] out = __salt__['cmd.run_all'](cmd, python_shell=False) if out['retcode'] ...
Trigger alternatives to set the path for <name > as specified by priority.
def auto(name): ''' Trigger alternatives to set the path for <name> as specified by priority. CLI Example: .. code-block:: bash salt '*' alternatives.auto name ''' cmd = [_get_cmd(), '--auto', name] out = __salt__['cmd.run_all'](cmd, python_shell=False) if out['retcode'] >...
Read the link from/ etc/ alternatives
def _read_link(name): ''' Read the link from /etc/alternatives Throws an OSError if the link does not exist ''' alt_link_path = '/etc/alternatives/{0}'.format(name) return salt.utils.path.readlink(alt_link_path)
Returns a placement solver
def get_placement_solver(service_instance): ''' Returns a placement solver service_instance Service instance to the host or vCenter ''' stub = salt.utils.vmware.get_new_service_instance_stub( service_instance, ns='pbm/2.0', path='/pbm/sdk') pbm_si = pbm.ServiceInstance('ServiceI...
Returns a list of all capability definitions.
def get_capability_definitions(profile_manager): ''' Returns a list of all capability definitions. profile_manager Reference to the profile manager. ''' res_type = pbm.profile.ResourceType( resourceType=pbm.profile.ResourceTypeEnum.STORAGE) try: cap_categories = profile_...
Returns a list of policies with the specified ids.
def get_policies_by_id(profile_manager, policy_ids): ''' Returns a list of policies with the specified ids. profile_manager Reference to the profile manager. policy_ids List of policy ids to retrieve. ''' try: return profile_manager.RetrieveContent(policy_ids) excep...
Returns a list of the storage policies filtered by name.
def get_storage_policies(profile_manager, policy_names=None, get_all_policies=False): ''' Returns a list of the storage policies, filtered by name. profile_manager Reference to the profile manager. policy_names List of policy names to filter by. Default...
Creates a storage policy.
def create_storage_policy(profile_manager, policy_spec): ''' Creates a storage policy. profile_manager Reference to the profile manager. policy_spec Policy update spec. ''' try: profile_manager.Create(policy_spec) except vim.fault.NoPermission as exc: log.ex...
Updates a storage policy.
def update_storage_policy(profile_manager, policy, policy_spec): ''' Updates a storage policy. profile_manager Reference to the profile manager. policy Reference to the policy to be updated. policy_spec Policy update spec. ''' try: profile_manager.Update(po...
Returns the default storage policy reference assigned to a datastore.
def get_default_storage_policy_of_datastore(profile_manager, datastore): ''' Returns the default storage policy reference assigned to a datastore. profile_manager Reference to the profile manager. datastore Reference to the datastore. ''' # Retrieve all datastores visible h...
Assigns a storage policy as the default policy to a datastore.
def assign_default_storage_policy_to_datastore(profile_manager, policy, datastore): ''' Assigns a storage policy as the default policy to a datastore. profile_manager Reference to the profile manager. policy Reference to the policy to assi...
Set a value into the Redis SDB.
def set_(key, value, profile=None): ''' Set a value into the Redis SDB. ''' if not profile: return False redis_kwargs = profile.copy() redis_kwargs.pop('driver') redis_conn = redis.StrictRedis(**redis_kwargs) return redis_conn.set(key, value)
Get a value from the Redis SDB.
def get(key, profile=None): ''' Get a value from the Redis SDB. ''' if not profile: return False redis_kwargs = profile.copy() redis_kwargs.pop('driver') redis_conn = redis.StrictRedis(**redis_kwargs) return redis_conn.get(key)
Ensures a load balancer is present.
def balancer_present(name, port, protocol, profile, algorithm=None, members=None, **libcloud_kwargs): ''' Ensures a load balancer is present. :param name: Load Balancer name :type name: ``str`` :param port: Port the load balancer should listen on, defaults to 80 :type port: ``str`` :par...
Ensures a load balancer is absent.
def balancer_absent(name, profile, **libcloud_kwargs): ''' Ensures a load balancer is absent. :param name: Load Balancer name :type name: ``str`` :param profile: The profile key :type profile: ``str`` ''' balancers = __salt__['libcloud_loadbalancer.list_balancers'](profile) match...
Ensure a load balancer member is present
def member_present(ip, port, balancer_id, profile, **libcloud_kwargs): ''' Ensure a load balancer member is present :param ip: IP address for the new member :type ip: ``str`` :param port: Port for the new member :type port: ``int`` :param balancer_id: id of a load balancer you want to a...
Ensure a load balancer member is absent based on IP and Port
def member_absent(ip, port, balancer_id, profile, **libcloud_kwargs): ''' Ensure a load balancer member is absent, based on IP and Port :param ip: IP address for the member :type ip: ``str`` :param port: Port for the member :type port: ``int`` :param balancer_id: id of a load balancer y...
parses the output into a dictionary
def _parser(result): ''' parses the output into a dictionary ''' # regexes to match _total_time = re.compile(r'total time:\s*(\d*.\d*s)') _total_execution = re.compile(r'event execution:\s*(\d*.\d*s?)') _min_response_time = re.compile(r'min:\s*(\d*.\d*ms)') _max_response_time = re.compi...
Tests for the CPU performance of minions.
def cpu(): ''' Tests for the CPU performance of minions. CLI Examples: .. code-block:: bash salt '*' sysbench.cpu ''' # Test data max_primes = [500, 1000, 2500, 5000] # Initializing the test variables test_command = 'sysbench --test=cpu --cpu-max-prime={0} run' resul...
This tests the performance of the processor s scheduler
def threads(): ''' This tests the performance of the processor's scheduler CLI Example: .. code-block:: bash salt '*' sysbench.threads ''' # Test data thread_yields = [100, 200, 500, 1000] thread_locks = [2, 4, 8, 16] # Initializing the test variables test_command = ...
Tests the implementation of mutex
def mutex(): ''' Tests the implementation of mutex CLI Examples: .. code-block:: bash salt '*' sysbench.mutex ''' # Test options and the values they take # --mutex-num = [50,500,1000] # --mutex-locks = [10000,25000,50000] # --mutex-loops = [2500,5000,10000] # Test da...
This tests the memory for read and write operations.
def memory(): ''' This tests the memory for read and write operations. CLI Examples: .. code-block:: bash salt '*' sysbench.memory ''' # test defaults # --memory-block-size = 10M # --memory-total-size = 1G # We test memory read / write against global / local scope of mem...
This tests for the file read and write operations Various modes of operations are
def fileio(): ''' This tests for the file read and write operations Various modes of operations are * sequential write * sequential rewrite * sequential read * random read * random write * random read and write The test works with 32 files with each file being 1Gb in size T...
Return LVM version from lvm version
def version(): ''' Return LVM version from lvm version CLI Example: .. code-block:: bash salt '*' lvm.version ''' cmd = 'lvm version' out = __salt__['cmd.run'](cmd).splitlines() ret = out[0].split(': ') return ret[1].strip()
Return all version info from lvm version
def fullversion(): ''' Return all version info from lvm version CLI Example: .. code-block:: bash salt '*' lvm.fullversion ''' ret = {} cmd = 'lvm version' out = __salt__['cmd.run'](cmd).splitlines() for line in out: comps = line.split(':') ret[comps[0].str...
Return information about the physical volume ( s )
def pvdisplay(pvname='', real=False, quiet=False): ''' Return information about the physical volume(s) pvname physical device name real dereference any symlinks and report the real device .. versionadded:: 2015.8.7 quiet if the physical volume is not present, do n...
Return information about the volume group ( s )
def vgdisplay(vgname='', quiet=False): ''' Return information about the volume group(s) vgname volume group name quiet if the volume group is not present, do not show any error CLI Examples: .. code-block:: bash salt '*' lvm.vgdisplay salt '*' lvm.vgdisplay n...
Return information about the logical volume ( s )
def lvdisplay(lvname='', quiet=False): ''' Return information about the logical volume(s) lvname logical device name quiet if the logical volume is not present, do not show any error CLI Examples: .. code-block:: bash salt '*' lvm.lvdisplay salt '*' lvm.lvdis...
Set a physical device to be used as an LVM physical volume
def pvcreate(devices, override=True, **kwargs): ''' Set a physical device to be used as an LVM physical volume override Skip devices, if they are already LVM physical volumes CLI Examples: .. code-block:: bash salt mymachine lvm.pvcreate /dev/sdb1,/dev/sdb2 salt mymachine...
Remove a physical device being used as an LVM physical volume
def pvremove(devices, override=True): ''' Remove a physical device being used as an LVM physical volume override Skip devices, if they are already not used as LVM physical volumes CLI Examples: .. code-block:: bash salt mymachine lvm.pvremove /dev/sdb1,/dev/sdb2 ''' if is...
Create an LVM volume group
def vgcreate(vgname, devices, **kwargs): ''' Create an LVM volume group CLI Examples: .. code-block:: bash salt mymachine lvm.vgcreate my_vg /dev/sdb1,/dev/sdb2 salt mymachine lvm.vgcreate my_vg /dev/sdb1 clustered=y ''' if not vgname or not devices: return 'Error: vgn...
Add physical volumes to an LVM volume group
def vgextend(vgname, devices): ''' Add physical volumes to an LVM volume group CLI Examples: .. code-block:: bash salt mymachine lvm.vgextend my_vg /dev/sdb1,/dev/sdb2 salt mymachine lvm.vgextend my_vg /dev/sdb1 ''' if not vgname or not devices: return 'Error: vgname a...
Create a new logical volume with option for which physical volume to be used
def lvcreate(lvname, vgname, size=None, extents=None, snapshot=None, pv=None, thinvolume=False, thinpool=False, force=False, **kwargs): ''' Create a new logical volume, with option for which phys...
Remove an LVM volume group
def vgremove(vgname): ''' Remove an LVM volume group CLI Examples: .. code-block:: bash salt mymachine lvm.vgremove vgname salt mymachine lvm.vgremove vgname force=True ''' cmd = ['vgremove', '-f', vgname] out = __salt__['cmd.run'](cmd, python_shell=False) return out.s...
Remove a given existing logical volume from a named existing volume group
def lvremove(lvname, vgname): ''' Remove a given existing logical volume from a named existing volume group CLI Example: .. code-block:: bash salt '*' lvm.lvremove lvname vgname force=True ''' cmd = ['lvremove', '-f', '{0}/{1}'.format(vgname, lvname)] out = __salt__['cmd.run'](cmd...
Return information about the logical volume ( s )
def lvresize(size=None, lvpath=None, extents=None): ''' Return information about the logical volume(s) CLI Examples: .. code-block:: bash salt '*' lvm.lvresize +12M /dev/mapper/vg1-test salt '*' lvm.lvresize lvpath=/dev/mapper/vg1-test extents=+100%FREE ''' if size and exten...
.. versionadded:: 2019. 2. 0
def resource_groups_list(**kwargs): ''' .. versionadded:: 2019.2.0 List all resource groups within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_resource.resource_groups_list ''' result = {} resconn = __utils__['azurearm.get_client']('resource', **kwar...
.. versionadded:: 2019. 2. 0
def resource_group_check_existence(name, **kwargs): ''' .. versionadded:: 2019.2.0 Check for the existence of a named resource group in the current subscription. :param name: The resource group name to check. CLI Example: .. code-block:: bash salt-call azurearm_resource.resource_gro...
.. versionadded:: 2019. 2. 0
def resource_group_get(name, **kwargs): ''' .. versionadded:: 2019.2.0 Get a dictionary representing a resource group's properties. :param name: The resource group name to get. CLI Example: .. code-block:: bash salt-call azurearm_resource.resource_group_get testgroup ''' re...
.. versionadded:: 2019. 2. 0
def resource_group_create_or_update(name, location, **kwargs): # pylint: disable=invalid-name ''' .. versionadded:: 2019.2.0 Create or update a resource group in a given location. :param name: The name of the resource group to create or update. :param location: The location of the resource group...
.. versionadded:: 2019. 2. 0
def resource_group_delete(name, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a resource group from the subscription. :param name: The resource group name to delete. CLI Example: .. code-block:: bash salt-call azurearm_resource.resource_group_delete testgroup ''' result ...
.. versionadded:: 2019. 2. 0
def deployment_operation_get(operation, deployment, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get a deployment operation within a deployment. :param operation: The operation ID of the operation within the deployment. :param deployment: The name of the deployment containing the ope...
.. versionadded:: 2019. 2. 0
def deployment_operations_list(name, resource_group, result_limit=10, **kwargs): ''' .. versionadded:: 2019.2.0 List all deployment operations within a deployment. :param name: The name of the deployment to query. :param resource_group: The resource group name assigned to the deployment. ...
.. versionadded:: 2019. 2. 0
def deployment_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a deployment. :param name: The name of the deployment to delete. :param resource_group: The resource group name assigned to the deployment. CLI Example: .. code-block:: bash sal...
.. versionadded:: 2019. 2. 0
def deployment_check_existence(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Check the existence of a deployment. :param name: The name of the deployment to query. :param resource_group: The resource group name assigned to the deployment. CLI Example: .. code-b...
.. versionadded:: 2019. 2. 0
def deployment_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific deployment. :param name: The name of the deployment to query. :param resource_group: The resource group name assigned to the deployment. CLI Example: .. code-block:: b...
.. versionadded:: 2019. 2. 0
def deployment_cancel(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Cancel a deployment if in 'Accepted' or 'Running' state. :param name: The name of the deployment to cancel. :param resource_group: The resource group name assigned to the deployment. CLI Example: ...
.. versionadded:: 2019. 2. 0
def deployment_validate(name, resource_group, deploy_mode=None, debug_setting=None, deploy_params=None, parameters_link=None, deploy_template=None, template_link=None, **kwargs): ''' .. versionadded:: 2019.2.0 Validates whether the spe...
.. versionadded:: 2019. 2. 0
def deployment_export_template(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Exports the template used for the specified deployment. :param name: The name of the deployment to query. :param resource_group: The resource group name assigned to the deployment. CLI Exam...
.. versionadded:: 2019. 2. 0
def deployments_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all deployments within a resource group. CLI Example: .. code-block:: bash salt-call azurearm_resource.deployments_list testgroup ''' result = {} resconn = __utils__['azurearm.get_client']('r...
.. versionadded:: 2019. 2. 0
def subscriptions_list_locations(subscription_id=None, **kwargs): ''' .. versionadded:: 2019.2.0 List all locations for a subscription. :param subscription_id: The ID of the subscription to query. CLI Example: .. code-block:: bash salt-call azurearm_resource.subscriptions_list_locat...
.. versionadded:: 2019. 2. 0
def subscription_get(subscription_id=None, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a subscription. :param subscription_id: The ID of the subscription to query. CLI Example: .. code-block:: bash salt-call azurearm_resource.subscription_get XXXXXXXX ''' re...
.. versionadded:: 2019. 2. 0
def subscriptions_list(**kwargs): ''' .. versionadded:: 2019.2.0 List all subscriptions for a tenant. CLI Example: .. code-block:: bash salt-call azurearm_resource.subscriptions_list ''' result = {} subconn = __utils__['azurearm.get_client']('subscription', **kwargs) try...
.. versionadded:: 2019. 2. 0
def tenants_list(**kwargs): ''' .. versionadded:: 2019.2.0 List all tenants for your account. CLI Example: .. code-block:: bash salt-call azurearm_resource.tenants_list ''' result = {} subconn = __utils__['azurearm.get_client']('subscription', **kwargs) try: tena...
.. versionadded:: 2019. 2. 0
def policy_assignment_delete(name, scope, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a policy assignment. :param name: The name of the policy assignment to delete. :param scope: The scope of the policy assignment. CLI Example: .. code-block:: bash salt-call azurearm_resou...
.. versionadded:: 2019. 2. 0
def policy_assignment_create(name, scope, definition_name, **kwargs): ''' .. versionadded:: 2019.2.0 Create a policy assignment. :param name: The name of the policy assignment to create. :param scope: The scope of the policy assignment. :param definition_name: The name of the policy definiti...
.. versionadded:: 2019. 2. 0
def policy_assignment_get(name, scope, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific policy assignment. :param name: The name of the policy assignment to query. :param scope: The scope of the policy assignment. CLI Example: .. code-block:: bash salt-cal...
.. versionadded:: 2019. 2. 0
def policy_assignments_list_for_resource_group(resource_group, **kwargs): # pylint: disable=invalid-name ''' .. versionadded:: 2019.2.0 List all policy assignments for a resource group. :param resource_group: The resource group name to list policy assignments within. CLI Example: .. code-bl...
.. versionadded:: 2019. 2. 0
def policy_assignments_list(**kwargs): ''' .. versionadded:: 2019.2.0 List all policy assignments for a subscription. CLI Example: .. code-block:: bash salt-call azurearm_resource.policy_assignments_list ''' result = {} polconn = __utils__['azurearm.get_client']('policy', **...
.. versionadded:: 2019. 2. 0
def policy_definition_create_or_update(name, policy_rule, **kwargs): # pylint: disable=invalid-name ''' .. versionadded:: 2019.2.0 Create or update a policy definition. :param name: The name of the policy definition to create or update. :param policy_rule: A dictionary defining the `poli...
.. versionadded:: 2019. 2. 0
def policy_definition_delete(name, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a policy definition. :param name: The name of the policy definition to delete. CLI Example: .. code-block:: bash salt-call azurearm_resource.policy_definition_delete testpolicy ''' result = ...
.. versionadded:: 2019. 2. 0
def policy_definition_get(name, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific policy definition. :param name: The name of the policy definition to query. CLI Example: .. code-block:: bash salt-call azurearm_resource.policy_definition_get testpolicy ''' ...
.. versionadded:: 2019. 2. 0
def policy_definitions_list(hide_builtin=False, **kwargs): ''' .. versionadded:: 2019.2.0 List all policy definitions for a subscription. :param hide_builtin: Boolean which will filter out BuiltIn policy definitions from the result. CLI Example: .. code-block:: bash salt-call azurea...
Query an instance upon creation from the Joyent API
def query_instance(vm_=None, call=None): ''' Query an instance upon creation from the Joyent API ''' if isinstance(vm_, six.string_types) and call == 'action': vm_ = {'name': vm_, 'provider': 'joyent'} if call == 'function': # Technically this function may be called other ways too, ...
Create a single VM from a data dict
def create(vm_): ''' Create a single VM from a data dict CLI Example: .. code-block:: bash salt-cloud -p profile_name vm_name ''' try: # Check for required profile parameters before sending any API calls. if vm_['profile'] and config.is_profile_configured(__opts__, ...
convenience function to make the rest api call for node creation.
def create_node(**kwargs): ''' convenience function to make the rest api call for node creation. ''' name = kwargs['name'] size = kwargs['size'] image = kwargs['image'] location = kwargs['location'] networks = kwargs.get('networks') tag = kwargs.get('tag') locality = kwargs.get('...
destroy a machine by name
def destroy(name, call=None): ''' destroy a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: array of booleans , true if successfully stopped and true if successfully removed CLI Example: .. code-block:: bash ...
reboot a machine by name: param name: name given to the machine: param call: call value in this case is action: return: true if successful
def reboot(name, call=None): ''' reboot a machine by name :param name: name given to the machine :param call: call value in this case is 'action' :return: true if successful CLI Example: .. code-block:: bash salt-cloud -a reboot vm_name ''' node = get_node(name) ret = ...
take action call used by start stop reboot: param name: name given to the machine: param call: call value in this case is action: command: api path: data: any data to be passed to the api must be in json format: method: GET POST or DELETE: location: data center to execute the command on: return: true if successful
def take_action(name=None, call=None, command=None, data=None, method='GET', location=DEFAULT_LOCATION): ''' take action call used by start,stop, reboot :param name: name given to the machine :param call: call value in this case is 'action' :command: api path :data: any data to ...
Return the joyent data center to use in this order: - CLI parameter - VM parameter - Cloud profile setting
def get_location(vm_=None): ''' Return the joyent data center to use, in this order: - CLI parameter - VM parameter - Cloud profile setting ''' return __opts__.get( 'location', config.get_cloud_config_value( 'location', vm_ or get_configure...
List all available locations
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 = {} for key in JOYENT_L...
Find if the provided object has a specific method
def has_method(obj, method_name): ''' Find if the provided object has a specific method ''' if method_name in dir(obj): return True log.error('Method \'%s\' not yet supported!', method_name) return False
convert list to dictionary using the key as the identifier: param items: array to iterate over: return: dictionary
def key_list(items=None): ''' convert list to dictionary using the key as the identifier :param items: array to iterate over :return: dictionary ''' if items is None: items = [] ret = {} if items and isinstance(items, list): for item in items: if 'name' in it...
get details about a machine: param name: name given to the machine: param call: call value in this case is action: return: machine information
def show_instance(name, call=None): ''' get details about a machine :param name: name given to the machine :param call: call value in this case is 'action' :return: machine information CLI Example: .. code-block:: bash salt-cloud -a show_instance vm_name ''' node = get_nod...
Reformat the returned data from joyent determine public/ private IPs and strip out fields if necessary to provide either full or brief content.
def reformat_node(item=None, full=False): ''' Reformat the returned data from joyent, determine public/private IPs and strip out fields if necessary to provide either full or brief content. :param item: node dictionary :param full: full or brief output :return: dict ''' desired_keys = [...
list of nodes keeping only a brief listing
def list_nodes(full=False, call=None): ''' list of nodes, keeping only a brief listing CLI Example: .. code-block:: bash salt-cloud -Q ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes function must be called with -f or --function.' ) ...
Checks configuration to see whether the user has SSL turned on. Default is:
def _get_proto(): ''' Checks configuration to see whether the user has SSL turned on. Default is: .. code-block:: yaml use_ssl: True ''' use_ssl = config.get_cloud_config_value( 'use_ssl', get_configured_provider(), __opts__, search_global=False, def...
Get list of available images
def avail_images(call=None): ''' Get list of available images CLI Example: .. code-block:: bash salt-cloud --list-images Can use a custom URL for images. Default is: .. code-block:: yaml image_url: images.joyent.com/images ''' if call == 'action': raise Salt...
get list of available packages
def avail_sizes(call=None): ''' get list of available packages CLI Example: .. code-block:: bash salt-cloud --list-sizes ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_sizes function must be called with ' '-f or --function, or with the -...
List the keys available
def list_keys(kwargs=None, call=None): ''' List the keys available ''' if call != 'function': log.error( 'The list_keys function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} ret = {} rcode, data = query(command...
List the keys available
def show_key(kwargs=None, call=None): ''' List the keys available ''' if call != 'function': log.error( 'The list_keys function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} if 'keyname' not in kwargs: log.e...