text
stringlengths
81
112k
Return the configured KMS data key decrypted and encoded in urlsafe base64. Cache the result to minimize API calls to AWS. def _plaintext_data_key(): ''' Return the configured KMS data key decrypted and encoded in urlsafe base64. Cache the result to minimize API calls to AWS. ''' response = g...
Given a blob of ciphertext as a bytestring, try to decrypt the cipher and return the decrypted string. If the cipher cannot be decrypted, log the error, and return the ciphertext back out. def _decrypt_ciphertext(cipher, translate_newlines=False): ''' Given a blob of ciphertext as a bytestring, try to ...
Recursively try to decrypt any object. Recur on objects that are not strings. Decrypt strings that are valid Fernet tokens. Return the rest unchanged. def _decrypt_object(obj, translate_newlines=False): ''' Recursively try to decrypt any object. Recur on objects that are not strings. Decryp...
Decrypt the data to be rendered that was encrypted using AWS KMS envelope encryption. def render(data, saltenv='base', sls='', argline='', **kwargs): # pylint: disable=unused-argument ''' Decrypt the data to be rendered that was encrypted using AWS KMS envelope encryption. ''' translate_newlines = kwa...
Replaces the last 1/4 of a string with X's def _serial_sanitizer(instr): '''Replaces the last 1/4 of a string with X's''' length = len(instr) index = int(math.floor(length * .75)) return '{0}{1}'.format(instr[:index], 'X' * (length - index))
Attempt to retrieve the named value from grains, if the named value is not available return the passed default. The default return is an empty string. The value can also represent a value in a nested dict using a ":" delimiter for the dict. This means that if a dict in grains looks like this:: {'p...
Determine whether a key exists in the grains dictionary. Given a grains dictionary that contains the following structure:: {'pkg': {'apache': 'httpd'}} One would determine if the apache key in the pkg dict exists by:: pkg:apache CLI Example: .. code-block:: bash salt '*' g...
Return all of the minion's grains CLI Example: .. code-block:: bash salt '*' grains.items Sanitized CLI Example: .. code-block:: bash salt '*' grains.items sanitize=True def items(sanitize=False): ''' Return all of the minion's grains CLI Example: .. code-block::...
Return one or more grains CLI Example: .. code-block:: bash salt '*' grains.item os salt '*' grains.item os osrelease oscodename Sanitized CLI Example: .. code-block:: bash salt '*' grains.item host sanitize=True def item(*args, **kwargs): ''' Return one or more gr...
Set new grains values in the grains config file destructive If an operation results in a key being removed, delete the key, too. Defaults to False. CLI Example: .. code-block:: bash salt '*' grains.setvals "{'key1': 'val1', 'key2': 'val2'}" def setvals(grains, destructive=False)...
.. versionadded:: 0.17.0 Append a value to a list in the grains config file. If the grain doesn't exist, the grain key is added and the value is appended to the new grain as a list item. key The grain key to be appended to val The value to append to the grain key convert ...
.. versionadded:: 0.17.0 Remove a value from a list in the grains config file key The grain key to remove. val The value to remove. delimiter The key can be a nested dict key. Use this parameter to specify the delimiter you use, instead of the default ``:``. Y...
.. versionadded:: 0.17.0 Look up the given grain in a given dictionary for the current OS and return the result Although this may occasionally be useful at the CLI, the primary intent of this function is for use in Jinja to make short work of creating lookup tables for OS-specific data. For exampl...
Given a lookup string in the form of 'foo:bar:baz" return a nested dictionary of the appropriate depth with the final segment as a value. >>> _dict_from_path('foo:bar:baz', 'somevalue') {"foo": {"bar": {"baz": "somevalue"}} def _dict_from_path(path, val, delimiter=DEFAULT_TARGET_DELIM): ''' Given ...
Perform a one-time generation of a hash and write it to the local grains. If that grain has already been set return the value instead. This is useful for generating passwords or keys that are specific to a single minion that don't need to be stored somewhere centrally. State Example: .. code-bloc...
Set a key to an arbitrary value. It is used like setval but works with nested keys. This function is conservative. It will only overwrite an entry if its value and the given one are not a list or a dict. The ``force`` parameter is used to allow overwriting in all cases. .. versionadded:: 2015.8.0 ...
Used to make sure the minion's grain key/value matches. Returns ``True`` if matches otherwise ``False``. .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash salt '*' grains.equals fqdn <expected_fqdn> salt '*' grains.equals systemd:version 219 def equals(key, value): '...
Get a session to XenAPI. By default, use the local UNIX socket. def _get_xapi_session(): ''' Get a session to XenAPI. By default, use the local UNIX socket. ''' _xenapi = _check_xenapi() xapi_uri = __salt__['config.option']('xapi.uri') xapi_login = __salt__['config.option']('xapi.login') x...
Internal, returns xl or xm command line path def _get_xtool(): ''' Internal, returns xl or xm command line path ''' for xtool in ['xl', 'xm']: path = salt.utils.path.which(xtool) if path is not None: return path
Internal, returns label's uuid def _get_label_uuid(xapi, rectype, label): ''' Internal, returns label's uuid ''' try: return getattr(xapi, rectype).get_by_name_label(label)[0] except Exception: return False
Internal, returns a full record for uuid def _get_record_by_label(xapi, rectype, label): ''' Internal, returns a full record for uuid ''' uuid = _get_label_uuid(xapi, rectype, label) if uuid is False: return False return getattr(xapi, rectype).get_record(uuid)
Internal, returns metrics record for a rectype def _get_metrics_record(xapi, rectype, record): ''' Internal, returns metrics record for a rectype ''' metrics_id = record['metrics'] return getattr(xapi, '{0}_metrics'.format(rectype)).get_record(metrics_id)
Internal, get value from record def _get_val(record, keys): ''' Internal, get value from record ''' data = record for key in keys: if key in data: data = data[key] else: return None return data
Return a list of virtual machine names on the minion CLI Example: .. code-block:: bash salt '*' virt.list_domains def list_domains(): ''' Return a list of virtual machine names on the minion CLI Example: .. code-block:: bash salt '*' virt.list_domains ''' with _get...
Return detailed information about the vms. 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. CLI Example: .. code-block:: bash salt '*' virt.vm_info def vm_info(vm_=None): ''' Return detailed information about t...
Return list of all the vms and 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. CLI Example: .. code-block:: bash salt '*' virt.vm_state <vm name> def vm_state(vm_=None): ''' Return list of all the...
Return a dict with information about this node CLI Example: .. code-block:: bash salt '*' virt.node_info def node_info(): ''' Return a dict with information about this node CLI Example: .. code-block:: bash salt '*' virt.node_info ''' with _get_xapi_session() as xa...
Return info about the network interfaces of a named vm CLI Example: .. code-block:: bash salt '*' virt.get_nics <vm name> def get_nics(vm_): ''' Return info about the network interfaces of a named vm CLI Example: .. code-block:: bash salt '*' virt.get_nics <vm name> ''...
Return a list off MAC addresses from the named vm CLI Example: .. code-block:: bash salt '*' virt.get_macs <vm name> def get_macs(vm_): ''' Return a list off MAC addresses from the named vm CLI Example: .. code-block:: bash salt '*' virt.get_macs <vm name> ''' macs...
Return the disks of a named vm CLI Example: .. code-block:: bash salt '*' virt.get_disks <vm name> def get_disks(vm_): ''' Return the disks of a named vm CLI Example: .. code-block:: bash salt '*' virt.get_disks <vm name> ''' with _get_xapi_session() as xapi: ...
Changes the amount of memory allocated to VM. Memory is to be specified in MB CLI Example: .. code-block:: bash salt '*' virt.setmem myvm 768 def setmem(vm_, memory): ''' Changes the amount of memory allocated to VM. Memory is to be specified in MB CLI Example: .. code-bl...
Changes the amount of vcpus allocated to VM. vcpus is an int representing the number to be assigned CLI Example: .. code-block:: bash salt '*' virt.setvcpus myvm 2 def setvcpus(vm_, vcpus): ''' Changes the amount of vcpus allocated to VM. vcpus is an int representing the number to ...
Set which CPUs a VCPU can use. CLI Example: .. code-block:: bash salt 'foo' virt.vcpu_pin domU-id 2 1 salt 'foo' virt.vcpu_pin domU-id 2 2-6 def vcpu_pin(vm_, vcpu, cpus): ''' Set which CPUs a VCPU can use. CLI Example: .. code-block:: bash salt 'foo' virt.vcpu_pin...
Send a soft shutdown signal to the named vm CLI Example: .. code-block:: bash salt '*' virt.shutdown <vm name> def shutdown(vm_): ''' Send a soft shutdown signal to the named vm CLI Example: .. code-block:: bash salt '*' virt.shutdown <vm name> ''' with _get_xapi_s...
Pause the named vm CLI Example: .. code-block:: bash salt '*' virt.pause <vm name> def pause(vm_): ''' Pause the named vm CLI Example: .. code-block:: bash salt '*' virt.pause <vm name> ''' with _get_xapi_session() as xapi: vm_uuid = _get_label_uuid(xapi, '...
Resume the named vm CLI Example: .. code-block:: bash salt '*' virt.resume <vm name> def resume(vm_): ''' Resume the named vm CLI Example: .. code-block:: bash salt '*' virt.resume <vm name> ''' with _get_xapi_session() as xapi: vm_uuid = _get_label_uuid(xa...
Reboot a domain via ACPI request CLI Example: .. code-block:: bash salt '*' virt.reboot <vm name> def reboot(vm_): ''' Reboot a domain via ACPI request CLI Example: .. code-block:: bash salt '*' virt.reboot <vm name> ''' with _get_xapi_session() as xapi: vm...
Reset a VM by emulating the reset button on a physical machine CLI Example: .. code-block:: bash salt '*' virt.reset <vm name> def reset(vm_): ''' Reset a VM by emulating the reset button on a physical machine CLI Example: .. code-block:: bash salt '*' virt.reset <vm name>...
Migrates the virtual machine to another hypervisor CLI Example: .. code-block:: bash salt '*' virt.migrate <vm name> <target hypervisor> [live] [port] [node] [ssl] [change_home_server] Optional values: live Use live migration port Use a specified port node Us...
Hard power down the virtual machine, this is equivalent to pulling the power CLI Example: .. code-block:: bash salt '*' virt.stop <vm name> def stop(vm_): ''' Hard power down the virtual machine, this is equivalent to pulling the power CLI Example: .. code-block:: bash ...
Returns a bool whether or not this node is a hypervisor of any kind CLI Example: .. code-block:: bash salt '*' virt.is_hyper def is_hyper(): ''' Returns a bool whether or not this node is a hypervisor of any kind CLI Example: .. code-block:: bash salt '*' virt.is_hyper ...
Return cputime used by the vms on this hyper in a list of dicts: .. code-block:: python [ 'your-vm': { 'cputime' <int> 'cputime_percent' <int> }, ... ] If you pass a VM name in as an argument then it will return i...
Return combined network counters used by the vms on this hyper in a list of dicts: .. code-block:: python [ 'your-vm': { 'io_read_kbs' : 0, 'io_total_read_kbs' : 0, 'io_total_write_kbs' : 0, 'io_write_kbs' ...
Return disk usage counters used by the vms on this hyper in a list of dicts: .. code-block:: python [ 'your-vm': { 'io_read_kbs' : 0, 'io_write_kbs' : 0 }, ... ] If you pass a VM name in as an argument then it ...
Internal helper to sanitize message output def _clean_message(message): '''Internal helper to sanitize message output''' message = message.replace('zonecfg: ', '') message = message.splitlines() for line in message: if line.startswith('On line'): message.remove(line) return "\n"...
Internal helper for parsing configuration values into python values def _parse_value(value): '''Internal helper for parsing configuration values into python values''' if isinstance(value, bool): return 'true' if value else 'false' elif isinstance(value, six.string_types): # parse compacted ...
Internal helper for converting pythonic values to configuration file values def _sanitize_value(value): '''Internal helper for converting pythonic values to configuration file values''' # dump dict into compated if isinstance(value, dict): new_value = [] new_value.append('(') for k,...
Internal helper for debugging cfg files def _dump_cfg(cfg_file): '''Internal helper for debugging cfg files''' if __salt__['file.file_exists'](cfg_file): with salt.utils.files.fopen(cfg_file, 'r') as fp_: log.debug( "zonecfg - configuration file:\n%s", ""...
Create an in-memory configuration for the specified zone. zone : string name of zone brand : string brand name zonepath : string path of zone force : boolean overwrite configuration CLI Example: .. code-block:: bash salt '*' zonecfg.create deathscythe ...
Create an in-memory configuration from a template for the specified zone. zone : string name of zone template : string name of template .. warning:: existing config will be overwritten! CLI Example: .. code-block:: bash salt '*' zonecfg.create_from_template leo t...
Delete the specified configuration from memory and stable storage. zone : string name of zone CLI Example: .. code-block:: bash salt '*' zonecfg.delete epyon def delete(zone): ''' Delete the specified configuration from memory and stable storage. zone : string name ...
Export the configuration from memory to stable storage. zone : string name of zone path : string path of file to export to CLI Example: .. code-block:: bash salt '*' zonecfg.export epyon salt '*' zonecfg.export epyon /zones/epyon.cfg def export(zone, path=None): ...
Import the configuration to memory from stable storage. zone : string name of zone path : string path of file to export to CLI Example: .. code-block:: bash salt '*' zonecfg.import epyon /zones/epyon.cfg def import_(zone, path): ''' Import the configuration to memory...
internal handler for set and clear_property methode : string either set, add, or clear zone : string name of zone key : string name of property value : string value of property def _property(methode, zone, key, value): ''' internal handler for set and clear_prop...
internal resource hanlder methode : string add or update zone : string name of zone resource_type : string type of resource resource_selector : string unique resource identifier **kwargs : string|int|... resource properties def _resource(methode, zone, resou...
Add a resource zone : string name of zone resource_type : string type of resource resource_selector : string unique resource identifier kwargs : string|int|... resource properties .. note:: Set resource_selector to None for resource that do not require one. ...
Remove a resource zone : string name of zone resource_type : string type of resource resource_key : string key for resource selection resource_value : string value for resource selection .. note:: Set resource_selector to None for resource that do not requir...
Display the configuration from memory zone : string name of zone show_all : boolean also include calculated values like capped-cpu, cpu-shares, ... CLI Example: .. code-block:: bash salt '*' zonecfg.info tallgeese def info(zone, show_all=False): ''' Display the confi...
Verify and display a nag-messsage to the log if vulnerable hash-type is used. :return: def verify_hash_type(self): ''' Verify and display a nag-messsage to the log if vulnerable hash-type is used. :return: ''' if self.config['hash_type'].lower() in ['md5', 'sha1']: ...
Log environment failure for the daemon and exit with the error code. :param error: :return: def environment_failure(self, error): ''' Log environment failure for the daemon and exit with the error code. :param error: :return: ''' log.exception( ...
Run the preparation sequence required to start a salt master server. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare() def prepare(self): ''' Run the preparation sequence required to start a salt master server. If sub-classed, don't **ever*...
Start the actual master. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required code before calling `super()`. def start(self): ''' Start the actual master. If sub-classed, don't **ever** forget to run: ...
If sub-classed, run any shutdown operations on this method. def shutdown(self, exitcode=0, exitmsg=None): ''' If sub-classed, run any shutdown operations on this method. ''' self.shutdown_log_info() msg = 'The salt master is shutdown. ' if exitmsg is not None: ...
Run the preparation sequence required to start a salt minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare() def prepare(self): ''' Run the preparation sequence required to start a salt minion. If sub-classed, don't **ever** forget to ru...
Start the actual minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required code before calling `super()`. def start(self): ''' Start the actual minion. If sub-classed, don't **ever** forget to run: ...
Start the actual minion as a caller minion. cleanup_protecteds is list of yard host addresses that should not be cleaned up this is to fix race condition when salt-caller minion starts up If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE...
If sub-classed, run any shutdown operations on this method. :param exitcode :param exitmsg def shutdown(self, exitcode=0, exitmsg=None): ''' If sub-classed, run any shutdown operations on this method. :param exitcode :param exitmsg ''' self.action_log_i...
Run the preparation sequence required to start a salt proxy minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare() def prepare(self): ''' Run the preparation sequence required to start a salt proxy minion. If sub-classed, don't **ever** ...
Start the actual proxy minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required code before calling `super()`. def start(self): ''' Start the actual proxy minion. If sub-classed, don't **ever** forget to run: ...
If sub-classed, run any shutdown operations on this method. :param exitcode :param exitmsg def shutdown(self, exitcode=0, exitmsg=None): ''' If sub-classed, run any shutdown operations on this method. :param exitcode :param exitmsg ''' if hasattr(self, ...
Run the preparation sequence required to start a salt syndic minion. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).prepare() def prepare(self): ''' Run the preparation sequence required to start a salt syndic minion. If sub-classed, don't **ever*...
Start the actual syndic. If sub-classed, don't **ever** forget to run: super(YourSubClass, self).start() NOTE: Run any required code before calling `super()`. def start(self): ''' Start the actual syndic. If sub-classed, don't **ever** forget to run: ...
If sub-classed, run any shutdown operations on this method. :param exitcode :param exitmsg def shutdown(self, exitcode=0, exitmsg=None): ''' If sub-classed, run any shutdown operations on this method. :param exitcode :param exitmsg ''' self.action_log_i...
Execute rac commands def __execute_cmd(command): ''' Execute rac commands ''' cmd = __salt__['cmd.run_all']('racadm {0}'.format(command)) if cmd['retcode'] != 0: log.warning('racadm return an exit code \'%s\'.', cmd['retcode']) return False return True
Configure the nameservers on the DRAC CLI Example: .. code-block:: bash salt dell drac.nameservers [NAMESERVERS] salt dell drac.nameservers ns1.example.com ns2.example.com def nameservers(*ns): ''' Configure the nameservers on the DRAC CLI Example: .. code-block:: bash ...
Configure syslog remote logging, by default syslog will automatically be enabled if a server is specified. However, if you want to disable syslog you will need to specify a server followed by False CLI Example: .. code-block:: bash salt dell drac.syslog [SYSLOG IP] [ENABLE/DISABLE] sa...
List all DRAC users CLI Example: .. code-block:: bash salt dell drac.list_users def list_users(): ''' List all DRAC users CLI Example: .. code-block:: bash salt dell drac.list_users ''' users = {} _username = '' for idx in range(1, 17): cmd = __sal...
Delete a user CLI Example: .. code-block:: bash salt dell drac.delete_user [USERNAME] [UID - optional] salt dell drac.delete_user diana 4 def delete_user(username, uid=None): ''' Delete a user CLI Example: .. code-block:: bash salt dell drac.delete_user [USERNAME] ...
Change users password CLI Example: .. code-block:: bash salt dell drac.change_password [USERNAME] [PASSWORD] [UID - optional] salt dell drac.change_password diana secret def change_password(username, password, uid=None): ''' Change users password CLI Example: .. code-block:...
Create user accounts CLI Example: .. code-block:: bash salt dell drac.create_user [USERNAME] [PASSWORD] [PRIVILEGES] salt dell drac.create_user diana secret login,test_alerts,clear_logs DRAC Privileges * login : Login to iDRAC * drac : Con...
Configure users permissions CLI Example: .. code-block:: bash salt dell drac.set_permissions [USERNAME] [PRIVILEGES] [USER INDEX - optional] salt dell drac.set_permissions diana login,test_alerts,clear_logs 4 DRAC Privileges * login : Login to iDRAC * drac ...
Configure server to PXE perform a one off PXE boot CLI Example: .. code-block:: bash salt dell drac.server_pxe def server_pxe(): ''' Configure server to PXE perform a one off PXE boot CLI Example: .. code-block:: bash salt dell drac.server_pxe ''' if __execute_cmd(...
Get the modified time of the RPM Database. Returns: Unix ticks def _get_mtime(): """ Get the modified time of the RPM Database. Returns: Unix ticks """ return os.path.exists(RPM_PATH) and int(os.path.getmtime(RPM_PATH)) or 0
Get the checksum of the RPM Database. Returns: hexdigest def _get_checksum(): """ Get the checksum of the RPM Database. Returns: hexdigest """ digest = hashlib.sha256() with open(RPM_PATH, "rb") as rpm_db_fh: while True: buff = rpm_db_fh.read(0x1000) ...
Hook after the package installation transaction. :param conduit: :return: def posttrans_hook(conduit): """ Hook after the package installation transaction. :param conduit: :return: """ # Integrate Yum with Salt if 'SALT_RUNNING' not in os.environ: with open(CK_PATH, 'w') a...
Parse the master.cf file. This file is essentially a whitespace-delimited columnar file. The columns are: service, type, private (yes), unpriv (yes), chroot (yes), wakeup (never), maxproc (100), command + args. This function parses out the columns, leaving empty lines and comments intact. Where the val...
Set a single config value in the master.cf file. If the value does not already exist, it will be appended to the end. Because of shell parsing issues, '-' cannot be set as a value, as is normal in the master.cf file; either 'y', 'n' or a number should be used when calling this function from the command...
Format the given values into the style of line normally used in the master.cf file. def _format_master(service, conn_type, private, unpriv, chroot, wakeup, maxproc, command): '''...
Parse files in the style of main.cf. This is not just a "name = value" file; there are other rules: * Comments start with # * Any whitespace at the beginning of a line denotes that that line is a continuation from the previous line. * The whitespace rule applies to comments. * Keys defined ...
Set a single config value in the main.cf file. If the value does not already exist, it will be appended to the end. CLI Example: salt <minion> postfix.set_main mailq_path /usr/bin/mailq def set_main(key, value, path=MAIN_CF): ''' Set a single config value in the main.cf file. If the value doe...
Write out configuration file. def _write_conf(conf, path=MAIN_CF): ''' Write out configuration file. ''' with salt.utils.files.fopen(path, 'w') as fh_: for line in conf: line = salt.utils.stringutils.to_str(line) if isinstance(line, dict): fh_.write(' '.j...
Show contents of the mail queue CLI Example: .. code-block:: bash salt '*' postfix.show_queue def show_queue(): ''' Show contents of the mail queue CLI Example: .. code-block:: bash salt '*' postfix.show_queue ''' cmd = 'mailq' out = __salt__['cmd.run'](cmd).s...
Delete message(s) from the mail queue CLI Example: .. code-block:: bash salt '*' postfix.delete 5C33CA0DEA salt '*' postfix.delete ALL def delete(queue_id): ''' Delete message(s) from the mail queue CLI Example: .. code-block:: bash salt '*' postfix.delete 5C33CA0...
Get collection options Additional parameters (kwargs) may be passed, they will be proxied to http.query CLI Example: .. code-block:: bash salt '*' solrcloud.collection_get_options collection_name def collection_get_options(collection_name, **kwargs): ''' Get collection options Addi...
Change collection options Additional parameters (kwargs) may be passed, they will be proxied to http.query Note that not every parameter can be changed after collection creation CLI Example: .. code-block:: bash salt '*' solrcloud.collection_set_options collection_name options={"replication...
Lists certificates in a keytool managed keystore. :param keystore: The path to the keystore file to query :param passphrase: The passphrase to use to decode the keystore :param alias: (Optional) If found, displays details on only this key :param return_certs: (Optional) Also return certificate PEM. ...
Adds certificates to an existing keystore or creates a new one if necesssary. :param name: alias for the certificate :param keystore: The path to the keystore file to query :param passphrase: The passphrase to use to decode the keystore :param certificate: The PEM public certificate to add to keystore....
Removes a certificate from an existing keystore. Returns True if remove was successful, otherwise False :param name: alias for the certificate :param keystore: The path to the keystore file to query :param passphrase: The passphrase to use to decode the keystore CLI Example: .. code-block:: b...
Store information in a file. def store(bank, key, data, cachedir): ''' Store information in a file. ''' base = os.path.join(cachedir, os.path.normpath(bank)) try: os.makedirs(base) except OSError as exc: if exc.errno != errno.EEXIST: raise SaltCacheError( ...
Fetch information from a file. def fetch(bank, key, cachedir): ''' Fetch information from a file. ''' inkey = False key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key)) if not os.path.isfile(key_file): # The bank includes the full filename, and the key is insid...