Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def show(commands, raw_text=True, **kwargs): ''' Execute one or more show (non-configuration) commands. commands The commands to be executed. raw_text: ``True`` Whether to return raw text or structured data. NOTE: raw_text option is ...
[ "\n INPUT ERROR: Second argument 'raw_text' must be either True or False\n Value passed: {0}\n Hint: White space separated show commands should be wrapped by double quotes\n " ]
Please provide a description of the function:def show_ver(**kwargs): ''' Shortcut to run `show version` on the NX-OS device. .. code-block:: bash salt '*' nxos.cmd show_ver ''' command = 'show version' info = '' info = show(command, **kwargs) if isinstance(info, list): ...
[]
Please provide a description of the function:def show_run(**kwargs): ''' Shortcut to run `show running-config` on the NX-OS device. .. code-block:: bash salt '*' nxos.cmd show_run ''' command = 'show running-config' info = '' info = show(command, **kwargs) if isinstance(info, l...
[]
Please provide a description of the function:def config(commands=None, config_file=None, template_engine='jinja', context=None, defaults=None, saltenv='base', **kwargs): ''' Configures the Nexus switch with the specified commands. This metho...
[]
Please provide a description of the function:def delete_config(lines, **kwargs): ''' Delete one or more config lines to the switch running config. lines Configuration lines to remove. no_save_config If True, don't save configuration commands to startup configuration. If False, ...
[]
Please provide a description of the function:def set_password(username, password, encrypted=False, role=None, crypt_salt=None, algorithm='sha256', **kwargs): ''' Set users password on switch. username ...
[]
Please provide a description of the function:def set_role(username, role, **kwargs): ''' Assign role to username. username Username for role configuration role Configure role for username no_save_config If True, don't save configuration commands to startup configuration. ...
[]
Please provide a description of the function:def unset_role(username, role, **kwargs): ''' Remove role from username. username Username for role removal role Role to remove no_save_config If True, don't save configuration commands to startup configuration. If False...
[]
Please provide a description of the function:def _configure_device(commands, **kwargs): ''' Helper function to send configuration commands to the device over a proxy minion or native minion using NX-API or SSH. ''' if salt.utils.platform.is_proxy(): return __proxy__['nxos.proxy_config'](comm...
[]
Please provide a description of the function:def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs): ''' Helper function to send configuration commands using NX-API. ''' api_kwargs = __salt__['config.get']('nxos', {}) api_kwargs.update(**kwargs) if not isinstance(commands, list)...
[]
Please provide a description of the function:def _nxapi_request(commands, method='cli_conf', **kwargs): ''' Helper function to send exec and config requests over NX-API. commands The exec or config commands to be sent. method: ``cli_show`` ``cli_sh...
[]
Please provide a description of the function:def compress(data, compresslevel=9): ''' Returns the data compressed at gzip level compression. ''' buf = BytesIO() with open_fileobj(buf, 'wb', compresslevel) as ogz: if six.PY3 and not isinstance(data, bytes): data = data.encode(__sa...
[]
Please provide a description of the function:def compress_file(fh_, compresslevel=9, chunk_size=1048576): ''' Generator that reads chunk_size bytes at a time from a file/filehandle and yields the compressed result of each read. .. note:: Each chunk is compressed separately. They cannot be stitc...
[]
Please provide a description of the function:def _root(path, root): ''' Relocate an absolute path to a new root directory. ''' if root: return os.path.join(root, os.path.relpath(path, os.path.sep)) else: return path
[]
Please provide a description of the function:def _canonical_unit_name(name): ''' Build a canonical unit name treating unit names without one of the valid suffixes as a service. ''' if not isinstance(name, six.string_types): name = six.text_type(name) if any(name.endswith(suffix) for suff...
[]
Please provide a description of the function:def _check_available(name): ''' Returns boolean telling whether or not the named service is available ''' _status = _systemctl_status(name) sd_version = salt.utils.systemd.version(__context__) if sd_version is not None and sd_version >= 231: #...
[]
Please provide a description of the function:def _check_for_unit_changes(name): ''' Check for modified/updated unit files, and run a daemon-reload if any are found. ''' contextkey = 'systemd._check_for_unit_changes.{0}'.format(name) if contextkey not in __context__: if _untracked_custom_...
[]
Please provide a description of the function:def _check_unmask(name, unmask, unmask_runtime, root=None): ''' Common code for conditionally removing masks before making changes to a service's state. ''' if unmask: unmask_(name, runtime=False, root=root) if unmask_runtime: unmask_(...
[]
Please provide a description of the function:def _clear_context(): ''' Remove context ''' # Using list() here because modifying a dictionary during iteration will # raise a RuntimeError. for key in list(__context__): try: if key.startswith('systemd._systemctl_status.'): ...
[]
Please provide a description of the function:def _default_runlevel(): ''' Try to figure out the default runlevel. It is kept in /etc/init/rc-sysinit.conf, but can be overridden with entries in /etc/inittab, or via the kernel command-line at boot ''' # Try to get the "main" default. If this fai...
[]
Please provide a description of the function:def _get_systemd_services(root): ''' Use os.listdir() to get all the unit files ''' ret = set() for path in SYSTEM_CONFIG_PATHS + (LOCAL_CONFIG_PATH,): # Make sure user has access to the path, and if the path is a # link it's likely that a...
[]
Please provide a description of the function:def _get_sysv_services(root, systemd_services=None): ''' Use os.listdir() and os.access() to get all the initscripts ''' initscript_path = _root(INITSCRIPT_PATH, root) try: sysv_services = os.listdir(initscript_path) except OSError as exc: ...
[]
Please provide a description of the function:def _get_service_exec(): ''' Returns the path to the sysv service manager (either update-rc.d or chkconfig) ''' contextkey = 'systemd._get_service_exec' if contextkey not in __context__: executables = ('update-rc.d', 'chkconfig') for e...
[]
Please provide a description of the function:def _runlevel(): ''' Return the current runlevel ''' contextkey = 'systemd._runlevel' if contextkey in __context__: return __context__[contextkey] out = __salt__['cmd.run']('runlevel', python_shell=False, ignore_retcode=True) try: ...
[]
Please provide a description of the function:def _strip_scope(msg): ''' Strip unnecessary message about running the command with --scope from stderr so that we can raise an exception with the remaining stderr text. ''' ret = [] for line in msg.splitlines(): if not line.endswith('.scope')...
[]
Please provide a description of the function:def _systemctl_cmd(action, name=None, systemd_scope=False, no_block=False, root=None): ''' Build a systemctl command line. Treat unit names without one of the valid suffixes as a service. ''' ret = [] if systemd_scope \ ...
[]
Please provide a description of the function:def _systemctl_status(name): ''' Helper function which leverages __context__ to keep from running 'systemctl status' more than once. ''' contextkey = 'systemd._systemctl_status.%s' % name if contextkey in __context__: return __context__[contex...
[]
Please provide a description of the function:def _sysv_enabled(name, root): ''' A System-V style service is assumed disabled if the "startup" symlink (starts with "S") to its script is found in /etc/init.d in the current runlevel. ''' # Find exact match (disambiguate matches like "S01anacron" fo...
[]
Please provide a description of the function:def _untracked_custom_unit_found(name, root=None): ''' If the passed service name is not available, but a unit file exist in /etc/systemd/system, return True. Otherwise, return False. ''' system = _root('/etc/systemd/system', root) unit_path = os.path...
[]
Please provide a description of the function:def systemctl_reload(): ''' .. versionadded:: 0.15.0 Reloads systemctl, an action needed whenever unit files are updated. CLI Example: .. code-block:: bash salt '*' service.systemctl_reload ''' out = __salt__['cmd.run_all']( _s...
[]
Please provide a description of the function:def get_running(): ''' Return a list of all running services, so far as systemd is concerned CLI Example: .. code-block:: bash salt '*' service.get_running ''' ret = set() # Get running systemd units out = __salt__['cmd.run']( ...
[]
Please provide a description of the function:def get_static(root=None): ''' .. versionadded:: 2015.8.5 Return a list of all static services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_static '...
[]
Please provide a description of the function:def get_all(root=None): ''' Return a list of all available services root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash salt '*' service.get_all ''' ret = _get_systemd_services(...
[]
Please provide a description of the function:def unmask_(name, runtime=False, root=None): ''' .. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-mi...
[]
Please provide a description of the function:def mask(name, runtime=False, root=None): ''' .. versionadded:: 2015.5.0 .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minio...
[]
Please provide a description of the function:def masked(name, runtime=False, root=None): ''' .. versionadded:: 2015.8.0 .. versionchanged:: 2015.8.5 The return data for this function has changed. If the service is masked, the return value will now be the output of the ``systemctl is-...
[]
Please provide a description of the function:def stop(name, no_block=False): ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`` daemon's control group. This ...
[]
Please provide a description of the function:def restart(name, no_block=False, unmask=False, unmask_runtime=False): ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function from the ``salt-minion`...
[]
Please provide a description of the function:def status(name, sig=None): # pylint: disable=unused-argument ''' Return the status for a service via systemd. If the name contains globbing, a dict mapping service name to True/False values is returned. .. versionchanged:: 2018.3.0 The service ...
[]
Please provide a description of the function:def enable(name, no_block=False, unmask=False, unmask_runtime=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to ...
[]
Please provide a description of the function:def disable(name, no_block=False, root=None, **kwargs): # pylint: disable=unused-argument ''' .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0 On minions running systemd>=205, `systemd-run(1)`_ is now used to isolate commands run by this function fro...
[]
Please provide a description of the function:def enabled(name, root=None, **kwargs): # pylint: disable=unused-argument ''' Return if the named service is enabled to start on boot root Enable/disable/mask unit files in the specified root directory CLI Example: .. code-block:: bash ...
[]
Please provide a description of the function:def show(name, root=None): ''' .. versionadded:: 2014.7.0 Show properties of one or more units/jobs or the manager root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.show <service name> ...
[]
Please provide a description of the function:def execs(root=None): ''' .. versionadded:: 2014.7.0 Return a list of all files specified as ``ExecStart`` for all services. root Enable/disable/mask unit files in the specified root directory CLI Example: salt '*' service.execs ''...
[]
Please provide a description of the function:def keys(name, basepath='/etc/pki', **kwargs): ''' Manage libvirt keys. name The name variable used to track the execution basepath Defaults to ``/etc/pki``, this is the root location used for libvirt keys on the hypervisor The ...
[]
Please provide a description of the function:def _virt_call(domain, function, section, comment, connection=None, username=None, password=None, **kwargs): ''' Helper to call the virt functions. Wildcards supported. :param domain: :param function: :param section: :param comment: ...
[]
Please provide a description of the function:def stopped(name, connection=None, username=None, password=None): ''' Stops a VM by shutting it down nicely. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: u...
[]
Please provide a description of the function:def powered_off(name, connection=None, username=None, password=None): ''' Stops a VM by power off. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to...
[]
Please provide a description of the function:def running(name, cpu=None, mem=None, image=None, vm_type=None, disk_profile=None, disks=None, nic_profile=None, interfaces=None, graphics=None, loader=Non...
[]
Please provide a description of the function:def snapshot(name, suffix=None, connection=None, username=None, password=None): ''' Takes a snapshot of a particular VM or by a UNIX-style wildcard. .. versionadded:: 2016.3.0 :param connection: libvirt connection URI, overriding defaults .. versio...
[]
Please provide a description of the function:def rebooted(name, connection=None, username=None, password=None): ''' Reboots VMs .. versionadded:: 2016.3.0 :param name: :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username ...
[]
Please provide a description of the function:def reverted(name, snapshot=None, cleanup=False): # pylint: disable=redefined-outer-name ''' .. deprecated:: 2016.3.0 Reverts to the particular snapshot. .. versionadded:: 2016.3.0 .. code-block:: yaml domain_name: virt.reverted: ...
[]
Please provide a description of the function:def network_running(name, bridge, forward, vport=None, tag=None, autostart=True, connection=None, username=None, pa...
[]
Please provide a description of the function:def pool_running(name, ptype=None, target=None, permissions=None, source=None, transient=False, autostart=True, connection=None, username=N...
[]
Please provide a description of the function:def status(name, sig=None): ''' Return ``True`` if service is running name the service's name sig signature to identify with ps CLI Example: .. code-block:: bash salt '*' runit.status <service name> ''' if sig: ...
[]
Please provide a description of the function:def _is_svc(svc_path): ''' Return ``True`` if directory <svc_path> is really a service: file <svc_path>/run exists and is executable svc_path the (absolute) directory to check for compatibility ''' run_file = os.path.join(svc_path, 'run') ...
[]
Please provide a description of the function:def status_autostart(name): ''' Return ``True`` if service <name> is autostarted by sv (file $service_folder/down does not exist) NB: return ``False`` if the service is not enabled. name the service's name CLI Example: .. code-block:: b...
[]
Please provide a description of the function:def get_svc_broken_path(name='*'): ''' Return list of broken path(s) in SERVICE_DIR that match ``name`` A path is broken if it is a broken symlink or can not be a runit service name a glob for service name. default is '*' CLI Example: .. c...
[]
Please provide a description of the function:def add_svc_avail_path(path): ''' Add a path that may contain available services. Return ``True`` if added (or already present), ``False`` on error. path directory to add to AVAIL_SVR_DIRS ''' if os.path.exists(path): if path not in A...
[]
Please provide a description of the function:def _get_svc_path(name='*', status=None): ''' Return a list of paths to services with ``name`` that have the specified ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) ...
[]
Please provide a description of the function:def _get_svc_list(name='*', status=None): ''' Return list of services that have the specified service ``status`` name a glob for service name. default is '*' status None : all services (no filter, default choice) 'DISABLED' : a...
[]
Please provide a description of the function:def get_svc_alias(): ''' Returns the list of service's name that are aliased and their alias path(s) ''' ret = {} for d in AVAIL_SVR_DIRS: for el in glob.glob(os.path.join(d, '*')): if not os.path.islink(el): continue ...
[]
Please provide a description of the function:def show(name): ''' Show properties of one or more units/jobs or the manager name the service's name CLI Example: salt '*' service.show <service name> ''' ret = {} ret['enabled'] = False ret['disabled'] = True ret['runni...
[]
Please provide a description of the function:def enable(name, start=False, **kwargs): ''' Start service ``name`` at boot. Returns ``True`` if operation is successful name the service's name start : False If ``True``, start the service once enabled. CLI Example: .. code-bl...
[]
Please provide a description of the function:def disable(name, stop=False, **kwargs): ''' Don't start service ``name`` at boot Returns ``True`` if operation is successful name the service's name stop if True, also stops the service CLI Example: .. code-block:: bash ...
[]
Please provide a description of the function:def remove(name): ''' Remove the service <name> from system. Returns ``True`` if operation is successful. The service will be also stopped. name the service's name CLI Example: .. code-block:: bash salt '*' service.remove <name...
[]
Please provide a description of the function:def ext_pillar(minion_id, pillar, # pylint: disable=W0613 bucket, key=None, keyid=None, verify_ssl=True, location=None, multiple_env=False, environment='b...
[]
Please provide a description of the function:def _init(creds, bucket, multiple_env, environment, prefix, s3_cache_expire): ''' Connect to S3 and download the metadata for each file in all buckets specified and cache the data to disk. ''' cache_file = _get_buckets_cache_filename(bucket, prefix) ...
[]
Please provide a description of the function:def _get_cache_dir(): ''' Get pillar cache directory. Initialize it if it does not exist. ''' cache_dir = os.path.join(__opts__['cachedir'], 'pillar_s3fs') if not os.path.isdir(cache_dir): log.debug('Initializing S3 Pillar Cache') os.mak...
[]
Please provide a description of the function:def _get_buckets_cache_filename(bucket, prefix): ''' Return the filename of the cache for bucket contents. Create the path if it does not exist. ''' cache_dir = _get_cache_dir() if not os.path.exists(cache_dir): os.makedirs(cache_dir) re...
[]
Please provide a description of the function:def _refresh_buckets_cache_file(creds, cache_file, multiple_env, environment, prefix): ''' Retrieve the content of all buckets and cache the metadata to the buckets cache file ''' # helper s3 query function def __get_s3_meta(): return __utils...
[]
Please provide a description of the function:def _read_buckets_cache_file(cache_file): ''' Return the contents of the buckets cache file ''' log.debug('Reading buckets cache file') with salt.utils.files.fopen(cache_file, 'rb') as fp_: data = pickle.load(fp_) return data
[]
Please provide a description of the function:def _find_files(metadata): ''' Looks for all the files in the S3 bucket cache metadata ''' ret = {} for bucket, data in six.iteritems(metadata): if bucket not in ret: ret[bucket] = [] # grab the paths from the metadata ...
[]
Please provide a description of the function:def _get_file_from_s3(creds, metadata, saltenv, bucket, path, cached_file_path): ''' Checks the local cache for the file, if it's old or missing go grab the file from S3 and update the cache ''' # check the local cache... if os....
[]
Please provide a description of the function:def _arg2opt(arg): ''' Turn a pass argument into the correct option ''' res = [o for o, a in option_toggles.items() if a == arg] res += [o for o, a in option_flags.items() if a == arg] return res[0] if res else None
[]
Please provide a description of the function:def _parse_conf(conf_file=default_conf): ''' Parse a logadm configuration file. ''' ret = {} with salt.utils.files.fopen(conf_file, 'r') as ifile: for line in ifile: line = salt.utils.stringutils.to_unicode(line).strip() if...
[]
Please provide a description of the function:def _parse_options(entry, options, include_unset=True): ''' Parse a logadm options string ''' log_cfg = {} options = shlex.split(options) if not options: return None ## identifier is entry or log? if entry.startswith('/'): log...
[]
Please provide a description of the function:def show_conf(conf_file=default_conf, name=None): ''' Show configuration conf_file : string path to logadm.conf, defaults to /etc/logadm.conf name : string optional show only a single entry CLI Example: .. code-block:: bash ...
[]
Please provide a description of the function:def list_conf(conf_file=default_conf, log_file=None, include_unset=False): ''' Show parsed configuration .. versionadded:: 2018.3.0 conf_file : string path to logadm.conf, defaults to /etc/logadm.conf log_file : string optional show only...
[]
Please provide a description of the function:def show_args(): ''' Show which arguments map to which flags and options. .. versionadded:: 2018.3.0 CLI Example: .. code-block:: bash salt '*' logadm.show_args ''' mapping = {'flags': {}, 'options': {}} for flag, arg in option_tog...
[]
Please provide a description of the function:def rotate(name, pattern=None, conf_file=default_conf, **kwargs): ''' Set up pattern for logging. name : string alias for entryname pattern : string alias for log_file conf_file : string optional path to alternative configuration ...
[]
Please provide a description of the function:def remove(name, conf_file=default_conf): ''' Remove log pattern from logadm CLI Example: .. code-block:: bash salt '*' logadm.remove myapplog ''' command = "logadm -f {0} -r {1}".format(conf_file, name) result = __salt__['cmd.run_all'](c...
[]
Please provide a description of the function:def get_encodings(): ''' return a list of string encodings to try ''' encodings = [__salt_system_encoding__] try: sys_enc = sys.getdefaultencoding() except ValueError: # system encoding is nonstandard or malformed sys_enc = None ...
[]
Please provide a description of the function:def split_locale(loc): ''' Split a locale specifier. The general format is language[_territory][.codeset][@modifier] [charmap] For example: ca_ES.UTF-8@valencia UTF-8 ''' def split(st, char): ''' Split a string `st` once by `ch...
[]
Please provide a description of the function:def join_locale(comps): ''' Join a locale specifier split in the format returned by split_locale. ''' loc = comps['language'] if comps.get('territory'): loc += '_' + comps['territory'] if comps.get('codeset'): loc += '.' + comps['codes...
[]
Please provide a description of the function:def normalize_locale(loc): ''' Format a locale specifier according to the format returned by `locale -a`. ''' comps = split_locale(loc) comps['territory'] = comps['territory'].upper() comps['codeset'] = comps['codeset'].lower().replace('-', '') co...
[]
Please provide a description of the function:def _remove_dots(src): ''' Remove dots from the given data structure ''' output = {} for key, val in six.iteritems(src): if isinstance(val, dict): val = _remove_dots(val) output[key.replace('.', '-')] = val return output
[]
Please provide a description of the function:def _get_conn(ret): ''' Return a mongodb connection object ''' _options = _get_options(ret) host = _options.get('host') port = _options.get('port') db_ = _options.get('db') user = _options.get('user') password = _options.get('password') ...
[]
Please provide a description of the function:def get_jid(jid): ''' Return the return information associated with a jid ''' conn, mdb = _get_conn(ret=None) ret = {} rdata = mdb.saltReturns.find({'jid': jid}, {'_id': 0}) if rdata: for data in rdata: minion = data['minion'] ...
[]
Please provide a description of the function:def get_fun(fun): ''' Return the most recent jobs that have executed the named function ''' conn, mdb = _get_conn(ret=None) ret = {} rdata = mdb.saltReturns.find_one({'fun': fun}, {'_id': 0}) if rdata: ret = rdata return ret
[]
Please provide a description of the function:def _cert_file(name, cert_type): ''' Return expected path of a Let's Encrypt live cert ''' return os.path.join(LE_LIVE, name, '{0}.pem'.format(cert_type))
[]
Please provide a description of the function:def _expires(name): ''' Return the expiry date of a cert :return datetime object of expiry date ''' cert_file = _cert_file(name, 'cert') # Use the salt module if available if 'tls.cert_info' in __salt__: expiry = __salt__['tls.cert_info']...
[]
Please provide a description of the function:def _renew_by(name, window=None): ''' Date before a certificate should be renewed :param name: Common Name of the certificate (DNS name of certificate) :param window: days before expiry date to renew :return datetime object of first renewal date ''' ...
[]
Please provide a description of the function:def cert(name, aliases=None, email=None, webroot=None, test_cert=False, renew=None, keysize=None, server=None, owner='root', group='root', mode='0640', certname=None, ...
[]
Please provide a description of the function:def info(name): ''' Return information about a certificate .. note:: Will output tls.cert_info if that's available, or OpenSSL text if not :param name: CommonName of cert CLI example: .. code-block:: bash salt 'gitlab.example.com'...
[]
Please provide a description of the function:def needs_renewal(name, window=None): ''' Check if a certificate needs renewal :param name: CommonName of cert :param window: Window in days to renew earlier or True/force to just return True Code example: .. code-block:: python if __salt_...
[]
Please provide a description of the function:def _analyse_overview_field(content): ''' Split the field in drbd-overview ''' if "(" in content: # Output like "Connected(2*)" or "UpToDate(2*)" return content.split("(")[0], content.split("(")[0] elif "/" in content: # Output lik...
[]
Please provide a description of the function:def _count_spaces_startswith(line): ''' Count the number of spaces before the first character ''' if line.split('#')[0].strip() == "": return None spaces = 0 for i in line: if i.isspace(): spaces += 1 else: ...
[]
Please provide a description of the function:def _analyse_status_type(line): ''' Figure out the sections in drbdadm status ''' spaces = _count_spaces_startswith(line) if spaces is None: return '' switch = { 0: 'RESOURCE', 2: {' disk:': 'LOCALDISK', ' role:': 'PEERNODE',...
[]
Please provide a description of the function:def _add_res(line): ''' Analyse the line of local resource of ``drbdadm status`` ''' global resource fields = line.strip().split() if resource: ret.append(resource) resource = {} resource["resource name"] = fields[0] resource...
[]