INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Remove the named file or directory
def remove(path, force=False): ''' Remove the named file or directory Args: path (str): The path to the file or directory to remove. force (bool): Remove even if marked Read-Only. Default is False Returns: bool: True if successful, False if unsuccessful CLI Example: ....
Create a symbolic link to a file
def symlink(src, link): ''' Create a symbolic link to a file This is only supported with Windows Vista or later and must be executed by a user with the SeCreateSymbolicLink privilege. The behavior of this function matches the Unix equivalent, with one exception - invalid symlinks cannot be cre...
Check if the path is a symlink
def is_link(path): ''' Check if the path is a symlink This is only supported on Windows Vista or later. Inline with Unix behavior, this function will raise an error if the path is not a symlink, however, the error raised will be a SaltInvocationError, not an OSError. Args: path (s...
Return the path that a symlink points to
def readlink(path): ''' Return the path that a symlink points to This is only supported on Windows Vista or later. Inline with Unix behavior, this function will raise an error if the path is not a symlink, however, the error raised will be a SaltInvocationError, not an OSError. Args: ...
Ensure that the directory is available and permissions are set.
def mkdir(path, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=False): ''' Ensure that the directory is available and permissions are set. Args: path (str): The full path to the directory. owner (str): ...
Ensure that the parent directory containing this path is available.
def makedirs_(path, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=False): ''' Ensure that the parent directory containing this path is available. Args: path (str): The full path to the direct...
Set owner and permissions for each directory created.
def makedirs_perms(path, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=True): ''' Set owner and permissions for each directory created. Args: path (str): The full pat...
Check owner and permissions for the passed directory. This function checks the permissions and sets them returning the changes made. Used by the file state to populate the return dict
def check_perms(path, ret=None, owner=None, grant_perms=None, deny_perms=None, inheritance=True, reset=False): ''' Check owner and permissions for the passed directory. This function checks the permissions and se...
Set permissions for the given path
def set_perms(path, grant_perms=None, deny_perms=None, inheritance=True, reset=False): ''' Set permissions for the given path Args: path (str): The full path to the directory. grant_perms (dict): A dictionary ...
Validate the beacon configuration
def validate(config): ''' Validate the beacon configuration ''' if not isinstance(config, list): return False, ('Configuration for haproxy beacon must ' 'be a list.') else: _config = {} list(map(_config.update, config)) if 'backends' not in _co...
Check if current number of sessions of a server for a specific haproxy backend is over a defined threshold.
def beacon(config): ''' Check if current number of sessions of a server for a specific haproxy backend is over a defined threshold. .. code-block:: yaml beacons: haproxy: - backends: www-backend: threshold: 45 server...
Given a thing type name check to see if the given thing type exists
def thing_type_exists(thingTypeName, region=None, key=None, keyid=None, profile=None): ''' Given a thing type name, check to see if the given thing type exists Returns True if the given thing type exists and returns False if the given thing type does not exist. .. versionadded:: 2016.1...
Given a thing type name describe its properties.
def describe_thing_type(thingTypeName, region=None, key=None, keyid=None, profile=None): ''' Given a thing type name describe its properties. Returns a dictionary of interesting properties. .. versionadded:: 2016.11.0 CLI Example: .. code-block:: bash salt myminion boto_iot.desc...
Given a valid config create a thing type.
def create_thing_type(thingTypeName, thingTypeDescription, searchableAttributesList, region=None, key=None, keyid=None, profile=None): ''' Given a valid config, create a thing type. Returns {created: true} if the thing type was created and returns {created: False} if the thing type was not crea...
Given a thing type name deprecate it when undoDeprecate is False and undeprecate it when undoDeprecate is True.
def deprecate_thing_type(thingTypeName, undoDeprecate=False, region=None, key=None, keyid=None, profile=None): ''' Given a thing type name, deprecate it when undoDeprecate is False and undeprecate it when undoDeprecate is True. Returns {deprecated: true} if the thing type was deprecated and returns...
Given a thing type name delete it.
def delete_thing_type(thingTypeName, region=None, key=None, keyid=None, profile=None): ''' Given a thing type name, delete it. Returns {deleted: true} if the thing type was deleted and returns {deleted: false} if the thing type was not deleted. .. versionadded:: 2016.11.0 CLI Exam...
Given a policy name check to see if the given policy exists.
def policy_exists(policyName, region=None, key=None, keyid=None, profile=None): ''' Given a policy name, check to see if the given policy exists. Returns True if the given policy exists and returns False if the given policy does not exist. CLI Example: .. code-block:: bash ...
Given a valid config create a policy.
def create_policy(policyName, policyDocument, region=None, key=None, keyid=None, profile=None): ''' Given a valid config, create a policy. Returns {created: true} if the policy was created and returns {created: False} if the policy was not created. CLI Example: .. code-block:: bas...
Given a policy name describe its properties.
def describe_policy(policyName, region=None, key=None, keyid=None, profile=None): ''' Given a policy name describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_iot.describe_policy mypolicy ''' ...
Given a policy name and version ID check to see if the given policy version exists.
def policy_version_exists(policyName, policyVersionId, region=None, key=None, keyid=None, profile=None): ''' Given a policy name and version ID, check to see if the given policy version exists. Returns True if the given policy version exists and returns False if the given policy version does...
Given a policy name and version delete it.
def delete_policy_version(policyName, policyVersionId, region=None, key=None, keyid=None, profile=None): ''' Given a policy name and version, delete it. Returns {deleted: true} if the policy version was deleted and returns {deleted: false} if the policy version was not deleted. CLI Exa...
Given a policy name and version describe its properties.
def describe_policy_version(policyName, policyVersionId, region=None, key=None, keyid=None, profile=None): ''' Given a policy name and version describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_iot.de...
List all policies
def list_policies(region=None, key=None, keyid=None, profile=None): ''' List all policies Returns list of policies CLI Example: .. code-block:: bash salt myminion boto_iot.list_policies Example Return: .. code-block:: yaml policies: - {...} - {...} ...
List the versions available for the given policy.
def list_policy_versions(policyName, region=None, key=None, keyid=None, profile=None): ''' List the versions available for the given policy. CLI Example: .. code-block:: bash salt myminion boto_iot.list_policy_versions mypolicy Example Return: .. code-block:: yaml ...
Given a rule name check to see if the given rule exists.
def topic_rule_exists(ruleName, region=None, key=None, keyid=None, profile=None): ''' Given a rule name, check to see if the given rule exists. Returns True if the given rule exists and returns False if the given rule does not exist. CLI Example: .. code-block:: bash salt ...
Given a valid config create a topic rule.
def create_topic_rule(ruleName, sql, actions, description, ruleDisabled=False, region=None, key=None, keyid=None, profile=None): ''' Given a valid config, create a topic rule. Returns {created: true} if the rule was created and returns {created: False} if the rule was not create...
Given a rule name delete it.
def delete_topic_rule(ruleName, region=None, key=None, keyid=None, profile=None): ''' Given a rule name, delete it. Returns {deleted: true} if the rule was deleted and returns {deleted: false} if the rule was not deleted. CLI Example: .. code-block:: bash salt myminion bo...
Given a topic rule name describe its properties.
def describe_topic_rule(ruleName, region=None, key=None, keyid=None, profile=None): ''' Given a topic rule name describe its properties. Returns a dictionary of interesting properties. CLI Example: .. code-block:: bash salt myminion boto_iot.describe_topic_rule myrule '...
List all rules ( for a given topic if specified )
def list_topic_rules(topic=None, ruleDisabled=None, region=None, key=None, keyid=None, profile=None): ''' List all rules (for a given topic, if specified) Returns list of rules CLI Example: .. code-block:: bash salt myminion boto_iot.list_topic_rules Example Return: ...
Returns a unique service status
def _get_svc(rcd, service_status): ''' Returns a unique service status ''' ena = None lines = __salt__['cmd.run']('{0} rcvar'.format(rcd)).splitlines() for rcvar in lines: if rcvar.startswith('$') and '={0}'.format(service_status) in rcvar: ena = 'yes' elif rcvar.star...
Returns all service statuses
def _get_svc_list(service_status): ''' Returns all service statuses ''' prefix = '/etc/rc.d/' ret = set() lines = glob.glob('{0}*'.format(prefix)) for line in lines: svc = _get_svc(line, service_status) if svc is not None: ret.add(svc) return sorted(ret)
Modifies/ etc/ rc. conf so a service is started or not at boot time and can be started via/ etc/ rc. d/ <service >
def _rcconf_status(name, service_status): ''' Modifies /etc/rc.conf so a service is started or not at boot time and can be started via /etc/rc.d/<service> ''' rcconf = '/etc/rc.conf' rxname = '^{0}=.*'.format(name) newstatus = '{0}={1}'.format(name, service_status) ret = __salt__['cmd.re...
Return a conn object for the passed VM data
def get_conn(): ''' Return a conn object for the passed VM data ''' return ProfitBricksService( username=config.get_cloud_config_value( 'username', get_configured_provider(), __opts__, search_global=False ), password=config.get_clou...
Return a dict of all available VM locations on the cloud provider with relevant data
def avail_locations(call=None): ''' Return a dict of all available VM locations on the cloud provider with relevant data ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-location...
Return a list of the images that are on the provider
def avail_images(call=None): ''' Return a list of the images that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-images option' ) ret = {} conn...
List all the images with alias by location
def list_images(call=None, kwargs=None): ''' List all the images with alias by location CLI Example: .. code-block:: bash salt-cloud -f list_images my-profitbricks-config location=us/las ''' if call != 'function': raise SaltCloudSystemExit( 'The list_images functio...
Return the VM s size object
def get_size(vm_): ''' Return the VM's size object ''' vm_size = config.get_cloud_config_value('size', vm_, __opts__) sizes = avail_sizes() if not vm_size: return sizes['Small Instance'] for size in sizes: combinations = (six.text_type(sizes[size]['id']), six.text_type(size...
Return datacenter ID from provider configuration
def get_datacenter_id(): ''' Return datacenter ID from provider configuration ''' datacenter_id = config.get_cloud_config_value( 'datacenter_id', get_configured_provider(), __opts__, search_global=False ) conn = get_conn() try: conn.get_datacenter(da...
Return a list of the loadbalancers that are on the provider
def list_loadbalancers(call=None): ''' Return a list of the loadbalancers that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the --list-loadbalancers option' ) ...
Creates a loadbalancer within the datacenter from the provider config.
def create_loadbalancer(call=None, kwargs=None): ''' Creates a loadbalancer within the datacenter from the provider config. CLI Example: .. code-block:: bash salt-cloud -f create_loadbalancer profitbricks name=mylb ''' if call != 'function': raise SaltCloudSystemExit( ...
Return the datacenter from the config provider datacenter ID
def get_datacenter(conn): ''' Return the datacenter from the config provider datacenter ID ''' datacenter_id = get_datacenter_id() for item in conn.list_datacenters()['items']: if item['id'] == datacenter_id: return item raise SaltCloudNotFound( 'The specified datac...
Creates a virtual datacenter based on supplied parameters.
def create_datacenter(call=None, kwargs=None): ''' Creates a virtual datacenter based on supplied parameters. CLI Example: .. code-block:: bash salt-cloud -f create_datacenter profitbricks name=mydatacenter location=us/las description="my description" ''' if call != 'function'...
List all the data centers
def list_datacenters(conn=None, call=None): ''' List all the data centers CLI Example: .. code-block:: bash salt-cloud -f list_datacenters my-profitbricks-config ''' if call != 'function': raise SaltCloudSystemExit( 'The list_datacenters function must be called wit...
Return a list of VMs that are on the provider
def list_nodes(conn=None, call=None): ''' Return a list of VMs that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes function must be called with -f or --function.' ) if not conn: conn = get_conn() ret = {} datacent...
Return a list of the VMs that are on the provider with all fields
def list_nodes_full(conn=None, call=None): ''' Return a list of the VMs that are on the provider, with all fields ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes_full function must be called with -f or ' '--function.' ) if not conn: ...
Reserve the IP Block
def reserve_ipblock(call=None, kwargs=None): ''' Reserve the IP Block ''' if call == 'action': raise SaltCloudSystemExit( 'The reserve_ipblock function must be called with -f or ' '--function.' ) conn = get_conn() if kwargs is None: kwargs = {} ...
Return a node for the named VM
def get_node(conn, name): ''' Return a node for the named VM ''' datacenter_id = get_datacenter_id() for item in conn.list_servers(datacenter_id)['items']: if item['properties']['name'] == name: node = {'id': item['id']} node.update(item['properties']) re...
Create network interfaces on appropriate LANs as defined in cloud profile.
def _get_nics(vm_): ''' Create network interfaces on appropriate LANs as defined in cloud profile. ''' nics = [] if 'public_lan' in vm_: firewall_rules = [] # Set LAN to public if it already exists, otherwise create a new # public LAN. if 'public_firewall_rules' in vm...
Enables public Internet access for the specified public_lan. If no public LAN is available then a new public LAN is created.
def set_public_lan(lan_id): ''' Enables public Internet access for the specified public_lan. If no public LAN is available, then a new public LAN is created. ''' conn = get_conn() datacenter_id = get_datacenter_id() try: lan = conn.get_lan(datacenter_id=datacenter_id, lan_id=lan_id)...
Retrieve list of SSH public keys.
def get_public_keys(vm_): ''' Retrieve list of SSH public keys. ''' key_filename = config.get_cloud_config_value( 'ssh_public_key', vm_, __opts__, search_global=False, default=None ) if key_filename is not None: key_filename = os.path.expanduser(key_filename) if not os.pa...
Check SSH private key file and return absolute path if exists.
def get_key_filename(vm_): ''' Check SSH private key file and return absolute path if exists. ''' key_filename = config.get_cloud_config_value( 'ssh_private_key', vm_, __opts__, search_global=False, default=None ) if key_filename is not None: key_filename = os.path.expanduser(key...
Create a single VM from a data dict
def create(vm_): ''' Create a single VM from a data dict ''' try: # Check for required profile parameters before sending any API calls. if (vm_['profile'] and config.is_profile_configured(__opts__, (__active_provider_name__ or ...
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 ''' datacenter_id = get_datacenter_i...
stop 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 stop(name, call=None): ''' stop 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 stop vm_name ''' datacenter_id = get_datacenter_id() ...
start 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 start(name, call=None): ''' start 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 start vm_name ''' datacenter_id = get_datacenter_id(...
Apply any extra component overrides to VM from the cloud profile.
def _override_size(vm_): ''' Apply any extra component overrides to VM from the cloud profile. ''' vm_size = get_size(vm_) if 'cores' in vm_: vm_size['cores'] = vm_['cores'] if 'ram' in vm_: vm_size['ram'] = vm_['ram'] return vm_size
Construct server instance from cloud profile config
def _get_server(vm_, volumes, nics): ''' Construct server instance from cloud profile config ''' # Apply component overrides to the size from the cloud profile config vm_size = _override_size(vm_) # Set the server availability zone from the cloud profile config availability_zone = config.ge...
Construct VM system volume list from cloud profile config
def _get_system_volume(vm_): ''' Construct VM system volume list from cloud profile config ''' # Override system volume size if 'disk_size' is defined in cloud profile disk_size = get_size(vm_)['disk'] if 'disk_size' in vm_: disk_size = vm_['disk_size'] # Construct the system volum...
Construct a list of optional data volumes from the cloud profile
def _get_data_volumes(vm_): ''' Construct a list of optional data volumes from the cloud profile ''' ret = [] volumes = vm_['volumes'] for key, value in six.iteritems(volumes): # Verify the required 'disk_size' property is present in the cloud # profile config if 'disk_si...
Construct a list of optional firewall rules from the cloud profile.
def _get_firewall_rules(firewall_rules): ''' Construct a list of optional firewall rules from the cloud profile. ''' ret = [] for key, value in six.iteritems(firewall_rules): # Verify the required 'protocol' property is present in the cloud # profile config if 'protocol' not ...
Poll request status until resource is provisioned.
def _wait_for_completion(conn, promise, wait_timeout, msg): ''' Poll request status until resource is provisioned. ''' if not promise: return wait_timeout = time.time() + wait_timeout while wait_timeout > time.time(): time.sleep(5) operation_result = conn.get_request( ...
Determine if a package or runtime is installed.
def is_installed(name): ''' Determine if a package or runtime is installed. Args: name (str): The name of the package or the runtime. Returns: bool: True if the specified package or runtime is installed. CLI Example: .. code-block:: bash salt '*' flatpak.is_installed...
Uninstall the specified package.
def uninstall(pkg): ''' Uninstall the specified package. Args: pkg (str): The package name. Returns: dict: The ``result`` and ``output``. CLI Example: .. code-block:: bash salt '*' flatpak.uninstall org.gimp.GIMP ''' ret = {'result': None, 'output': ''} ...
Adds a new location to install flatpak packages from.
def add_remote(name, location): ''' Adds a new location to install flatpak packages from. Args: name (str): The repository's name. location (str): The location of the repository. Returns: dict: The ``result`` and ``output``. CLI Example: .. code-block:: bash ...
Determines if a remote exists.
def is_remote_added(remote): ''' Determines if a remote exists. Args: remote (str): The remote's name. Returns: bool: True if the remote has already been added. CLI Example: .. code-block:: bash salt '*' flatpak.is_remote_added flathub ''' out = __salt__['cmd...
Compatibility helper function to make __utils__ available on demand.
def pack_dunder(name): ''' Compatibility helper function to make __utils__ available on demand. ''' # TODO: Deprecate starting with Beryllium mod = sys.modules[name] if not hasattr(mod, '__utils__'): setattr(mod, '__utils__', salt.loader.utils(mod.__opts__))
Compatibility helper function to allow copy. deepcopy copy bound methods which is broken on Python 2. 6 due to the following bug: https:// bugs. python. org/ issue1515
def deepcopy_bound(name): ''' Compatibility helper function to allow copy.deepcopy copy bound methods which is broken on Python 2.6, due to the following bug: https://bugs.python.org/issue1515 Warnings: - This method will mutate the global deepcopy dispatcher, which means that this ...
Check if there is an upgrade available for a certain package
def upgrade_available(name): ''' Check if there is an upgrade available for a certain package CLI Example: .. code-block:: bash salt '*' pkgutil.upgrade_available CSWpython ''' version_num = None cmd = '/opt/csw/bin/pkgutil -c --parse --single {0}'.format( name) out = ...
List all available package upgrades on this system
def list_upgrades(refresh=True, **kwargs): # pylint: disable=W0613 ''' List all available package upgrades on this system CLI Example: .. code-block:: bash salt '*' pkgutil.list_upgrades ''' if salt.utils.data.is_true(refresh): refresh_db() upgrades = {} lines = __sal...
Upgrade all of the packages to the latest available version.
def upgrade(refresh=True): ''' Upgrade all of the packages to the latest available version. Returns a dict containing the changes:: {'<package>': {'old': '<old-version>', 'new': '<new-version>'}} CLI Example: .. code-block:: bash salt '*' pkgutil.upgrade ...
Install packages using the pkgutil tool.
def install(name=None, refresh=False, version=None, pkgs=None, **kwargs): ''' Install packages using the pkgutil tool. CLI Example: .. code-block:: bash salt '*' pkg.install <package_name> salt '*' pkg.install SMClgcc346 Multiple Package Installation Options: pkgs A...
Remove a package and all its dependencies which are not in use by other packages.
def remove(name=None, pkgs=None, **kwargs): ''' Remove a package and all its dependencies which are not in use by other packages. name The name of the package to be deleted. Multiple Package Options: pkgs A list of packages to delete. Must be passed as a python list. The ...
Ensure a device is monitored. The name given will be used for Zenoss device name and should be resolvable.
def monitored(name, device_class=None, collector='localhost', prod_state=None): ''' Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable. .. code-block:: yaml enable_monitoring: zenoss.monitored: - name: web01.example.com...
Find volume by name on minion
def _find_volume(name): ''' Find volume by name on minion ''' docker_volumes = __salt__['docker.volumes']()['Volumes'] if docker_volumes: volumes = [v for v in docker_volumes if v['Name'] == name] if volumes: return volumes[0] return None
Ensure that a volume is present.
def present(name, driver=None, driver_opts=None, force=False): ''' Ensure that a volume is present. .. versionadded:: 2015.8.4 .. versionchanged:: 2015.8.6 This state no longer deletes and re-creates a volume if the existing volume's driver does not match the ``driver`` parameter (unles...
Ensure that a volume is absent.
def absent(name, driver=None): ''' Ensure that a volume is absent. .. versionadded:: 2015.8.4 .. versionchanged:: 2017.7.0 This state was renamed from **docker.volume_absent** to **docker_volume.absent** name Name of the volume Usage Examples: .. code-block:: yaml ...
Generates a list of salt:// <formula >/ defaults. ( json|yaml ) files and fetches them from the Salt master.
def _load(formula): ''' Generates a list of salt://<formula>/defaults.(json|yaml) files and fetches them from the Salt master. Returns first defaults file as python dict. ''' # Compute possibilities _mk_client() paths = [] for ext in ('yaml', 'json'): source_url = salt.util...
defaults. get is used much like pillar. get except that it will read a default value for a pillar from defaults. json or defaults. yaml files that are stored in the root of a salt formula.
def get(key, default=''): ''' defaults.get is used much like pillar.get except that it will read a default value for a pillar from defaults.json or defaults.yaml files that are stored in the root of a salt formula. CLI Example: .. code-block:: bash salt '*' defaults.get core:users:roo...
defaults. merge Allows deep merging of dicts in formulas.
def merge(dest, src, merge_lists=False, in_place=True): ''' defaults.merge Allows deep merging of dicts in formulas. merge_lists : False If True, it will also merge lists instead of replace their items. in_place : True If True, it will merge into dest dict, if not it wi...
defaults. update Allows to set defaults for group of data set e. g. group for nodes.
def update(dest, defaults, merge_lists=True, in_place=True): ''' defaults.update Allows to set defaults for group of data set e.g. group for nodes. This function is a combination of defaults.merge and defaults.deepcopy to avoid redundant in jinja. Example: .. code-bloc...
Copied from win_system. py ( _get_date_time_format )
def _get_date_time_format(dt_string): ''' Copied from win_system.py (_get_date_time_format) Function that detects the date/time format for the string passed. :param str dt_string: A date/time string :return: The format of the passed dt_string :rtype: str ''' valid_formats = [ ...
Lookup the key in a dictionary by it s value. Will return the first match.
def _reverse_lookup(dictionary, value): ''' Lookup the key in a dictionary by it's value. Will return the first match. :param dict dictionary: The dictionary to search :param str value: The value to search for. :return: Returns the first key to match the value :rtype: str ''' value_in...
Lookup the first value given a key. Returns the first value if the key refers to a list or the value itself.
def _lookup_first(dictionary, key): ''' Lookup the first value given a key. Returns the first value if the key refers to a list or the value itself. :param dict dictionary: The dictionary to search :param str key: The key to get :return: Returns the first value available for the key :rtyp...
Internal function to save the task definition.
def _save_task_definition(name, task_folder, task_definition, user_name, password, logon_type): ''' Internal function to save the task definition. :param str name: The name of t...
r List all tasks located in a specific location in the task scheduler.
def list_tasks(location='\\'): r''' List all tasks located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
r List all folders located in a specific location in the task scheduler.
def list_folders(location='\\'): r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
r List all triggers that pertain to a task in the specified location.
def list_triggers(name, location='\\'): r''' List all triggers that pertain to a task in the specified location. :param str name: The name of the task for which list triggers. :param str location: A string value representing the location of the task from which to list triggers. Default is '\\'...
r List all actions that pertain to a task in the specified location.
def list_actions(name, location='\\'): r''' List all actions that pertain to a task in the specified location. :param str name: The name of the task for which list actions. :param str location: A string value representing the location of the task from which to list actions. Default is '\\' whi...
r Create a new task in the designated location. This function has many keyword arguments that are not listed here. For additional arguments see:
def create_task(name, location='\\', user_name='System', password=None, force=False, **kwargs): r''' Create a new task in the designated location. This function has many keyword arguments that are not listed here. For additional...
r Create a task based on XML. Source can be a file or a string of XML.
def create_task_from_xml(name, location='\\', xml_text=None, xml_path=None, user_name='System', password=None): r''' Create a task based on XML. Source can be a file or a string of XML. ...
r Create a folder in which to create tasks.
def create_folder(name, location='\\'): r''' Create a folder in which to create tasks. :param str name: The name of the folder. This will be displayed in the task scheduler. :param str location: A string value representing the location in which to create the folder. Default is '\\' whi...
r Edit the parameters of a task. Triggers and Actions cannot be edited yet.
def edit_task(name=None, location='\\', # General Tab user_name=None, password=None, description=None, enabled=None, hidden=None, # Conditions Tab run_if_idle=None, idle_duration=N...
r Delete a task from the task scheduler.
def delete_task(name, location='\\'): r''' Delete a task from the task scheduler. :param str name: The name of the task to delete. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\ta...
r Run a scheduled task manually.
def run(name, location='\\'): r''' Run a scheduled task manually. :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return:...
r Run a scheduled task and return when the task finishes
def run_wait(name, location='\\'): r''' Run a scheduled task and return when the task finishes :param str name: The name of the task to run. :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler (C:\Windows\S...
r Determine the status of a task. Is it Running Queued Ready etc.
def status(name, location='\\'): r''' Determine the status of a task. Is it Running, Queued, Ready, etc. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the tas...
r Get the details about a task in the task scheduler.
def info(name, location='\\'): r''' Get the details about a task in the task scheduler. :param str name: The name of the task for which to return the status :param str location: A string value representing the location of the task. Default is '\\' which is the root for the task scheduler ...
r Add an action to a task.
def add_action(name=None, location='\\', action_type='Execute', **kwargs): r''' Add an action to a task. :param str name: The name of the task to which to add the action. :param str location: A string value representing the location of the task. Def...
r: param str name: The name of the task to which to add the trigger.
def add_trigger(name=None, location='\\', trigger_type=None, trigger_enabled=True, start_date=None, start_time=None, end_date=None, end_time=None, random_delay=None, repeat_int...