Skip to content

Latest commit

 

History

History
1095 lines (762 loc) · 33.1 KB

REFERENCE.md

File metadata and controls

1095 lines (762 loc) · 33.1 KB

Reference

Table of Contents

Functions

  • simpkv::delete: Deletes a key from the configured backend.
  • simpkv::deletetree: Deletes a whole folder from the configured backend.
  • simpkv::exists: Returns whether key or key folder exists in the configured backend.
  • simpkv::get: Retrieves the value and any metadata stored at key from the configured backend.
  • simpkv::list: Returns a listing of all keys and sub-folders in a folder. The list operation does not recurse through any sub-folders. Only information abo
  • simpkv::put: Sets the data at key to the specified value in the configured backend. Optionally sets metadata along with the value.
  • simpkv::support::config::merge: Create merged backend configuration and then validate it. The merge entails the following operations: * The options argument is merged wit
  • simpkv::support::config::validate: Validate backend configuration
  • simpkv::support::key::validate: Validates key conforms to the simpkv key specification * simpkv key specification * Key must contain only the following characters:
  • simpkv::support::load: Load simpkv adapter and plugins and add simpkv 'extension' to the catalog instance, if it is not present

Functions

simpkv::delete

Type: Ruby 4.x API

Deletes a key from the configured backend.

Examples

Delete a key from the default backend
simpkv::delete("hosts/${facts['fqdn']}")
Delete a key from the backend servicing an application id
simpkv::delete("hosts/${facts['fqdn']}", { 'app_id' => 'myapp' })
Delete a global key from the default backend
simpkv::delete("hosts/${facts['fqdn']}", { 'global' => true })

simpkv::delete(String[1] $key, Optional[Hash] $options)

Deletes a key from the configured backend.

Returns: Boolean true when backend operation succeeds; false when the backend operation fails and 'softfail' is true in the merged backend options

Raises:

  • ArgumentError If the key or merged backend config is invalid
  • LoadError If the simpkv adapter cannot be loaded
  • RuntimeError If the backend operation fails, unless 'softfail' is true in the merged backend options.
Examples
Delete a key from the default backend
simpkv::delete("hosts/${facts['fqdn']}")
Delete a key from the backend servicing an application id
simpkv::delete("hosts/${facts['fqdn']}", { 'app_id' => 'myapp' })
Delete a global key from the default backend
simpkv::delete("hosts/${facts['fqdn']}", { 'global' => true })
key

Data type: String[1]

The key to remove. Must conform to the following:

  • Key must contain only the following characters:

    • a-z
    • 0-9
    • The following special characters: ._:-/
  • Key may not contain '/./' or '/../' sequences.

options

Data type: Optional[Hash]

simpkv configuration that will be merged with simpkv::options. All keys are optional.

Options:

  • 'app_id' String: Specifies an application name that can be used to identify which backend configuration to use via fuzzy name matching, in the absence of the backend option.

    • More flexible option than backend.
    • Useful for grouping together simpkv function calls found in different catalog resources.
    • When specified and the backend option is absent, the backend will be selected preferring a backend in the merged backends option whose name exactly matches the app_id, followed by the longest backend name that matches the beginning of the app_id, followed by the default backend.
    • When absent and the backend option is also absent, this function will use the default backend.
  • 'backend' String: Definitive name of the backend to use.

    • Takes precedence over app_id.
    • When present, must match a key in the backends option of the merged options Hash or the function will fail.
    • When absent in the merged options, this function will select the backend as described in the app_id option.
  • 'backends' Hash: Hash of backend configurations

    • Each backend configuration in the merged options Hash must be a Hash that has the following keys:

      • type: Backend type.
      • id: Unique name for the instance of the backend. (Same backend type can be configured differently).
    • Other keys for configuration specific to the backend may also be present.

  • 'global' Boolean: Set to true when the key being accessed is global. Otherwise, the key will be tied to the Puppet environment of the node whose manifest is being compiled.

    • Defaults to false
  • 'softfail' Boolean: Whether to ignore simpkv operation failures.

    • When true, this function will return a result even when the operation failed at the backend.
    • When false, this function will fail when the backend operation failed.
    • Defaults to false.

simpkv::deletetree

Type: Ruby 4.x API

Deletes a whole folder from the configured backend.

Examples

Delete a key folder from the default backend
simpkv::deletetree("hosts")
Delete a key folder from the backend servicing an application id
simpkv::deletetree("hosts", { 'app_id' => 'myapp' })
Delete a global key folder from the default backend
simpkv::deletetree("hosts", { 'global' => true })

simpkv::deletetree(String[1] $keydir, Optional[Hash] $options)

Deletes a whole folder from the configured backend.

Returns: Boolean true when backend operation succeeds; false when the backend operation fails and 'softfail' is true in the merged backend options

Raises:

  • ArgumentError If the key folder or merged backend config is invalid
  • LoadError If the simpkv adapter cannot be loaded
  • RuntimeError If the backend operation fails, unless 'softfail' is true in the merged backend options.
Examples
Delete a key folder from the default backend
simpkv::deletetree("hosts")
Delete a key folder from the backend servicing an application id
simpkv::deletetree("hosts", { 'app_id' => 'myapp' })
Delete a global key folder from the default backend
simpkv::deletetree("hosts", { 'global' => true })
keydir

Data type: String[1]

The key folder to remove. Must conform to the following:

  • Key folder must contain only the following characters:

    • a-z
    • 0-9
    • The following special characters: ._:-/
  • Key folder may not contain '/./' or '/../' sequences.

options

Data type: Optional[Hash]

simpkv configuration that will be merged with simpkv::options. All keys are optional.

Options:

  • 'app_id' String: Specifies an application name that can be used to identify which backend configuration to use via fuzzy name matching, in the absence of the backend option.

    • More flexible option than backend.
    • Useful for grouping together simpkv function calls found in different catalog resources.
    • When specified and the backend option is absent, the backend will be selected preferring a backend in the merged backends option whose name exactly matches the app_id, followed by the longest backend name that matches the beginning of the app_id, followed by the default backend.
    • When absent and the backend option is also absent, this function will use the default backend.
  • 'backend' String: Definitive name of the backend to use.

    • Takes precedence over app_id.
    • When present, must match a key in the backends option of the merged options Hash or the function will fail.
    • When absent in the merged options, this function will select the backend as described in the app_id option.
  • 'backends' Hash: Hash of backend configurations

    • Each backend configuration in the merged options Hash must be a Hash that has the following keys:

      • type: Backend type.
      • id: Unique name for the instance of the backend. (Same backend type can be configured differently).
    • Other keys for configuration specific to the backend may also be present.

  • 'global' Boolean: Set to true when the key being accessed is global. Otherwise, the key will be tied to the Puppet environment of the node whose manifest is being compiled.

    • Defaults to false
  • 'softfail' Boolean: Whether to ignore simpkv operation failures.

    • When true, this function will return a result even when the operation failed at the backend.
    • When false, this function will fail when the backend operation failed.
    • Defaults to false.

simpkv::exists

Type: Ruby 4.x API

Returns whether key or key folder exists in the configured backend.

Examples

Check for the existence of a key in the default backend
if simpkv::exists("hosts/${facts['fqdn']}") {
   notify { "hosts/${facts['fqdn']} exists": }
}
Check for the existence of a key in the backend servicing an application id
if simpkv::exists("hosts/${facts['fqdn']}", { 'app_id' => 'myapp' }) {
   notify { "hosts/${facts['fqdn']} exists": }
}
Check for the existence of a global key folder in the default backend
if simpkv::exists("hosts", { 'global' => true}) {
   notify { 'hosts folder exists': }
}

simpkv::exists(String[1] $key, Optional[Hash] $options)

Returns whether key or key folder exists in the configured backend.

Returns: Enum[Boolean,Undef] If the backend operation succeeds, returns true or false; if the backend operation fails and 'softfail' is true in the merged backend options, returns nil

Raises:

  • ArgumentError If the key or merged backend config is invalid
  • LoadError If the simpkv adapter cannot be loaded
  • RuntimeError If the backend operation fails, unless 'softfail' is true in the merged backend options.
Examples
Check for the existence of a key in the default backend
if simpkv::exists("hosts/${facts['fqdn']}") {
   notify { "hosts/${facts['fqdn']} exists": }
}
Check for the existence of a key in the backend servicing an application id
if simpkv::exists("hosts/${facts['fqdn']}", { 'app_id' => 'myapp' }) {
   notify { "hosts/${facts['fqdn']} exists": }
}
Check for the existence of a global key folder in the default backend
if simpkv::exists("hosts", { 'global' => true}) {
   notify { 'hosts folder exists': }
}
key

Data type: String[1]

The key or key folder to check. Must conform to the following:

  • Key must contain only the following characters:

    • a-z
    • 0-9
    • The following special characters: ._:-/
  • Key may not contain '/./' or '/../' sequences.

options

Data type: Optional[Hash]

simpkv configuration that will be merged with simpkv::options. All keys are optional.

Options:

  • 'app_id' String: Specifies an application name that can be used to identify which backend configuration to use via fuzzy name matching, in the absence of the backend option.

    • More flexible option than backend.
    • Useful for grouping together simpkv function calls found in different catalog resources.
    • When specified and the backend option is absent, the backend will be selected preferring a backend in the merged backends option whose name exactly matches the app_id, followed by the longest backend name that matches the beginning of the app_id, followed by the default backend.
    • When absent and the backend option is also absent, this function will use the default backend.
  • 'backend' String: Definitive name of the backend to use.

    • Takes precedence over app_id.
    • When present, must match a key in the backends option of the merged options Hash or the function will fail.
    • When absent in the merged options, this function will select the backend as described in the app_id option.
  • 'backends' Hash: Hash of backend configurations

    • Each backend configuration in the merged options Hash must be a Hash that has the following keys:

      • type: Backend type.
      • id: Unique name for the instance of the backend. (Same backend type can be configured differently).
    • Other keys for configuration specific to the backend may also be present.

  • 'global' Boolean: Set to true when the key being accessed is global. Otherwise, the key will be tied to the Puppet environment of the node whose manifest is being compiled.

    • Defaults to false
  • 'softfail' Boolean: Whether to ignore simpkv operation failures.

    • When true, this function will return a result even when the operation failed at the backend.
    • When false, this function will fail when the backend operation failed.
    • Defaults to false.

simpkv::get

Type: Ruby 4.x API

Retrieves the value and any metadata stored at key from the configured backend.

Examples

Retrieve the value and any metadata for a key from the default backend
$result = simpkv::get("database/${facts['fqdn']}")
class { 'wordpress':
  db_host => $result['value'],
  db_info => $result['metadata']
}
Retrieve the value and any metadata for a key from the backend servicing an application id
$result = simpkv::get("database/${facts['fqdn']}", { 'app_id' => 'myapp' })
class { 'wordpress':
  db_host => $result['value'],
  db_info => $result['metadata']
}
Retrieve the value and any metadata for a global key from the default backend
$result = simpkv::get("database/${facts['fqdn']}", { 'global' => true })
class { 'wordpress':
  db_host => $result['value'],
  db_info => $result['metadata']
}

simpkv::get(String[1] $key, Optional[Hash] $options)

Retrieves the value and any metadata stored at key from the configured backend.

Returns: Enum[Hash,Undef] Hash containing the value and any metadata upon success; Undef when the backend operation fails and 'softfail' is true in the merged backend options

  • Hash will have a 'value' key containing the retrieved value
  • Hash may have a 'metadata' key containing a Hash with any metadata for the key

Raises:

  • ArgumentError If the key or merged backend config is invalid
  • LoadError If the simpkv adapter cannot be loaded
  • RuntimeError If the backend operation fails, unless 'softfail' is true in the merged backend options.
Examples
Retrieve the value and any metadata for a key from the default backend
$result = simpkv::get("database/${facts['fqdn']}")
class { 'wordpress':
  db_host => $result['value'],
  db_info => $result['metadata']
}
Retrieve the value and any metadata for a key from the backend servicing an application id
$result = simpkv::get("database/${facts['fqdn']}", { 'app_id' => 'myapp' })
class { 'wordpress':
  db_host => $result['value'],
  db_info => $result['metadata']
}
Retrieve the value and any metadata for a global key from the default backend
$result = simpkv::get("database/${facts['fqdn']}", { 'global' => true })
class { 'wordpress':
  db_host => $result['value'],
  db_info => $result['metadata']
}
key

Data type: String[1]

The key to retrieve. Must conform to the following:

  • Key must contain only the following characters:

    • a-z
    • 0-9
    • The following special characters: ._:-/
  • Key may not contain '/./' or '/../' sequences.

options

Data type: Optional[Hash]

simpkv configuration that will be merged with simpkv::options. All keys are optional.

Options:

  • 'app_id' String: Specifies an application name that can be used to identify which backend configuration to use via fuzzy name matching, in the absence of the backend option.

    • More flexible option than backend.
    • Useful for grouping together simpkv function calls found in different catalog resources.
    • When specified and the backend option is absent, the backend will be selected preferring a backend in the merged backends option whose name exactly matches the app_id, followed by the longest backend name that matches the beginning of the app_id, followed by the default backend.
    • When absent and the backend option is also absent, this function will use the default backend.
  • 'backend' String: Definitive name of the backend to use.

    • Takes precedence over app_id.
    • When present, must match a key in the backends option of the merged options Hash or the function will fail.
    • When absent in the merged options, this function will select the backend as described in the app_id option.
  • 'backends' Hash: Hash of backend configurations

    • Each backend configuration in the merged options Hash must be a Hash that has the following keys:

      • type: Backend type.
      • id: Unique name for the instance of the backend. (Same backend type can be configured differently).
    • Other keys for configuration specific to the backend may also be present.

  • 'global' Boolean: Set to true when the key being accessed is global. Otherwise, the key will be tied to the Puppet environment of the node whose manifest is being compiled.

    • Defaults to false
  • 'softfail' Boolean: Whether to ignore simpkv operation failures.

    • When true, this function will return a result even when the operation failed at the backend.
    • When false, this function will fail when the backend operation failed.
    • Defaults to false.

simpkv::list

Type: Ruby 4.x API

Returns a listing of all keys and sub-folders in a folder.

The list operation does not recurse through any sub-folders. Only information about the specified key folder is returned.

Examples

Retrieve the list of key info for a key folder from the default backend
$result = simpkv::list('hosts')
$result['keys'].each |$host, $info | {
  host { $host:
    ip => $info['value'],
  }
}
Retrieve the list of sub-folders in a key folder from the backend servicing an application id
$result = simpkv::list('applications', { 'app_id' => 'myapp' })
notice("Supported applications: ${join($result['folders'], ' ')}")
Retrieve the top level list of global keys/folders in the default backend
$result = simpkv::list('/', { 'global' = true })
notice("Global folders: ${join($result['folders'], ' ')}")
$result['keys'].each |$key, $info | {
  notice("Global key ${key}: value=${info['value']} metadata=${info['metadata']}")
}

simpkv::list(String[1] $keydir, Optional[Hash] $options)

Returns a listing of all keys and sub-folders in a folder.

The list operation does not recurse through any sub-folders. Only information about the specified key folder is returned.

Returns: Enum[Hash,Undef] Hash containing the key/info pairs and list of sub-folders upon success; Undef when the backend operation fails and 'softfail' is true in the merged backend options

  • 'keys' attribute is a Hash of the key information in the folder
    • Each Hash key is a key found in the folder
    • Each Hash value is a Hash with a 'value' key and an optional 'metadata' key.
  • 'folders' attribute is an Array of sub-folder names

Raises:

  • ArgumentError If the key folder or merged backend config is invalid
  • LoadError If the simpkv adapter cannot be loaded
  • RuntimeError If the backend operation fails, unless 'softfail' is true in the merged backend options.
Examples
Retrieve the list of key info for a key folder from the default backend
$result = simpkv::list('hosts')
$result['keys'].each |$host, $info | {
  host { $host:
    ip => $info['value'],
  }
}
Retrieve the list of sub-folders in a key folder from the backend servicing an application id
$result = simpkv::list('applications', { 'app_id' => 'myapp' })
notice("Supported applications: ${join($result['folders'], ' ')}")
Retrieve the top level list of global keys/folders in the default backend
$result = simpkv::list('/', { 'global' = true })
notice("Global folders: ${join($result['folders'], ' ')}")
$result['keys'].each |$key, $info | {
  notice("Global key ${key}: value=${info['value']} metadata=${info['metadata']}")
}
keydir

Data type: String[1]

The key folder to list. Must conform to the following:

  • Key folder must contain only the following characters:

    • a-z
    • 0-9
    • The following special characters: ._:-/
  • Key folder may not contain '/./' or '/../' sequences.

options

Data type: Optional[Hash]

simpkv configuration that will be merged with simpkv::options. All keys are optional.

Options:

  • 'app_id' String: Specifies an application name that can be used to identify which backend configuration to use via fuzzy name matching, in the absence of the backend option.

    • More flexible option than backend.
    • Useful for grouping together simpkv function calls found in different catalog resources.
    • When specified and the backend option is absent, the backend will be selected preferring a backend in the merged backends option whose name exactly matches the app_id, followed by the longest backend name that matches the beginning of the app_id, followed by the default backend.
    • When absent and the backend option is also absent, this function will use the default backend.
  • 'backend' String: Definitive name of the backend to use.

    • Takes precedence over app_id.
    • When present, must match a key in the backends option of the merged options Hash or the function will fail.
    • When absent in the merged options, this function will select the backend as described in the app_id option.
  • 'backends' Hash: Hash of backend configurations

    • Each backend configuration in the merged options Hash must be a Hash that has the following keys:

      • type: Backend type.
      • id: Unique name for the instance of the backend. (Same backend type can be configured differently).
    • Other keys for configuration specific to the backend may also be present.

  • 'global' Boolean: Set to true when the key being accessed is global. Otherwise, the key will be tied to the Puppet environment of the node whose manifest is being compiled.

    • Defaults to false
  • 'softfail' Boolean: Whether to ignore simpkv operation failures.

    • When true, this function will return a result even when the operation failed at the backend.
    • When false, this function will fail when the backend operation failed.
    • Defaults to false.

simpkv::put

Type: Ruby 4.x API

Sets the data at key to the specified value in the configured backend. Optionally sets metadata along with the value.

Examples

Set a key in the default backend
simpkv::put("hosts/${facts['clientcert']}", $facts['ipaddress'])
Set a key with metadata in the backend servicing an application id
$meta = { 'rack_id' => 183 }
$opts = { 'app_id' => 'myapp' }
simpkv::put("hosts/${facts['clientcert']}", $facts['ipaddress'], $meta, $opts)
Set a gobal key in the default backend
simpkv::put("hosts/${facts['clientcert']}", $facts['ipaddress'], { 'global' => true })

simpkv::put(String[1] $key, NotUndef $value, Optional[Hash] $metadata, Optional[Hash] $options)

Sets the data at key to the specified value in the configured backend. Optionally sets metadata along with the value.

Returns: Boolean true when backend operation succeeds; false when the backend operation fails and 'softfail' is true in the merged backend options

Raises:

  • ArgumentError If the key or merged backend config is invalid
  • LoadError If the simpkv adapter cannot be loaded
  • RuntimeError If the backend operation fails, unless 'softfail' is true in the merged backend options.
Examples
Set a key in the default backend
simpkv::put("hosts/${facts['clientcert']}", $facts['ipaddress'])
Set a key with metadata in the backend servicing an application id
$meta = { 'rack_id' => 183 }
$opts = { 'app_id' => 'myapp' }
simpkv::put("hosts/${facts['clientcert']}", $facts['ipaddress'], $meta, $opts)
Set a gobal key in the default backend
simpkv::put("hosts/${facts['clientcert']}", $facts['ipaddress'], { 'global' => true })
key

Data type: String[1]

The key to set. Must conform to the following:

  • Key must contain only the following characters:

    • a-z
    • 0-9
    • The following special characters: ._:-/
  • Key may not contain '/./' or '/../' sequences.

value

Data type: NotUndef

The value of the key

metadata

Data type: Optional[Hash]

Additional information to be persisted

options

Data type: Optional[Hash]

simpkv configuration that will be merged with simpkv::options. All keys are optional.

Options:

  • 'app_id' String: Specifies an application name that can be used to identify which backend configuration to use via fuzzy name matching, in the absence of the backend option.

    • More flexible option than backend.
    • Useful for grouping together simpkv function calls found in different catalog resources.
    • When specified and the backend option is absent, the backend will be selected preferring a backend in the merged backends option whose name exactly matches the app_id, followed by the longest backend name that matches the beginning of the app_id, followed by the default backend.
    • When absent and the backend option is also absent, this function will use the default backend.
  • 'backend' String: Definitive name of the backend to use.

    • Takes precedence over app_id.
    • When present, must match a key in the backends option of the merged options Hash or the function will fail.
    • When absent in the merged options, this function will select the backend as described in the app_id option.
  • 'backends' Hash: Hash of backend configurations

    • Each backend configuration in the merged options Hash must be a Hash that has the following keys:

      • type: Backend type.
      • id: Unique name for the instance of the backend. (Same backend type can be configured differently).
    • Other keys for configuration specific to the backend may also be present.

  • 'global' Boolean: Set to true when the key being accessed is global. Otherwise, the key will be tied to the Puppet environment of the node whose manifest is being compiled.

    • Defaults to false
  • 'softfail' Boolean: Whether to ignore simpkv operation failures.

    • When true, this function will return a result even when the operation failed at the backend.
    • When false, this function will fail when the backend operation failed.
    • Defaults to false.

simpkv::support::config::merge

Type: Ruby 4.x API

Create merged backend configuration and then validate it.

The merge entails the following operations:

  • The options argument is merged with simpkv::options Hiera and global simpkv defaults.

  • If the backend options is missing in the merged options, it is set to a value determined as follows:

    • If the app_id option is present and the name of a backend in backends matches app_id, backend will be set to app_id.
    • Otherwise, if the app_id option is present and the name of a backend in backends matches the beginning of app_id, backend will be set to that partially-matching backend name. When multiple backends satisfy the 'start with' match, the backend with the most matching characters is selected.
    • Otherwise, if the app_id option does not match any backend name or is not present, backend will be set to default.
  • If the backends option is missing in the merged options, it is set to a Hash containing a single entry, default, that has configuration for the simpkv 'file' backend.

Validation includes the following checks:

  • configuration for the selected backend exists
  • the plugin for the selected backend has been loaded
  • different configuration for a specific plugin instance does not exist

simpkv::support::config::merge(Hash $options, Array $backends)

Create merged backend configuration and then validate it.

The merge entails the following operations:

  • The options argument is merged with simpkv::options Hiera and global simpkv defaults.

  • If the backend options is missing in the merged options, it is set to a value determined as follows:

    • If the app_id option is present and the name of a backend in backends matches app_id, backend will be set to app_id.
    • Otherwise, if the app_id option is present and the name of a backend in backends matches the beginning of app_id, backend will be set to that partially-matching backend name. When multiple backends satisfy the 'start with' match, the backend with the most matching characters is selected.
    • Otherwise, if the app_id option does not match any backend name or is not present, backend will be set to default.
  • If the backends option is missing in the merged options, it is set to a Hash containing a single entry, default, that has configuration for the simpkv 'file' backend.

Validation includes the following checks:

  • configuration for the selected backend exists
  • the plugin for the selected backend has been loaded
  • different configuration for a specific plugin instance does not exist

Returns: Hash merged simpkv options that will have the backend to use specified by 'backend'

Raises:

  • ArgumentError if merged configuration fails validation
options

Data type: Hash

Hash that specifies simpkv backend options to be merged with simpkv::options.

backends

Data type: Array

List of backends for which plugins have been successfully loaded.

simpkv::support::config::validate

Type: Ruby 4.x API

Validate backend configuration

simpkv::support::config::validate(Hash $options, Array $backends)

Validate backend configuration

Returns: Nil

Raises:

  • ArgumentError if a backend has not been specified, appropriate configuration for a specified backend cannot be found, or different backend configurations are provided for the same ['type', 'id'] pair.
options

Data type: Hash

Hash that specifies simpkv backend options

backends

Data type: Array

List of backends for which plugins have been successfully loaded.

simpkv::support::key::validate

Type: Ruby 4.x API

Validates key conforms to the simpkv key specification

  • simpkv key specification

    • Key must contain only the following characters:

      • a-z
      • 0-9
      • The following special characters: ._:-/
    • Key may not contain '/./' or '/../' sequences.

  • Terminates catalog compilation if validation fails.

Examples

Passing
simpkv::support::key::validate('looks/like/a/file/path')
simpkv::support::key::validate('looks/like/a/directory/path/')
simpkv::support::key::validate('simp-simp_snmpd:password.auth')
Failing
simpkv::support::key::validate('Uppercase/Characters/NOT/Allowed')
simpkv::support::key::validate('${special}/chars/not/allowed!'}
simpkv::support::key::validate('looks/like/an/./unexpanded/linux/path')
simpkv::support::key::validate('looks/like/another/../unexpanded/linux/path')

simpkv::support::key::validate(String[1] $key)

Validates key conforms to the simpkv key specification

  • simpkv key specification

    • Key must contain only the following characters:

      • a-z
      • 0-9
      • The following special characters: ._:-/
    • Key may not contain '/./' or '/../' sequences.

  • Terminates catalog compilation if validation fails.

Returns: Nil

Raises:

  • ArgumentError if validation fails
Examples
Passing
simpkv::support::key::validate('looks/like/a/file/path')
simpkv::support::key::validate('looks/like/a/directory/path/')
simpkv::support::key::validate('simp-simp_snmpd:password.auth')
Failing
simpkv::support::key::validate('Uppercase/Characters/NOT/Allowed')
simpkv::support::key::validate('${special}/chars/not/allowed!'}
simpkv::support::key::validate('looks/like/an/./unexpanded/linux/path')
simpkv::support::key::validate('looks/like/another/../unexpanded/linux/path')
key

Data type: String[1]

simpkv key

simpkv::support::load

Type: Ruby 4.x API

Load simpkv adapter and plugins and add simpkv 'extension' to the catalog instance, if it is not present

simpkv::support::load()

Load simpkv adapter and plugins and add simpkv 'extension' to the catalog instance, if it is not present

Returns: Nil

Raises:

  • LoadError if simpkv adapter software fails to load