NAME

LCFG::Resources - load and save LCFG resources

SYNOPSYS

use LCFG::Resources;

# Load resources for named resources from adaptor profile
# Note that the nodename must be fully-qualified not the short name

$res = LCFG::Resources::Load($nodename,$rspec1,$rspec2,...);

# Dump resources for named resources to stdout
LCFG::Resources::Dump($res,$verbose,$all,$rspec1,$rspec2,...);

# Dump named resources as shell assigments
LCFG::Resources::Export($res,$rspec1,$rspec2,...);

# Load resource for named resources from environment
$res = LCFG::Resources::Import($rspec1,$rspec2,...);

# Write named resources to file
LCFG::Resources::WriteFile($file,$res,$rspec1,$rspec2,...);

# Read named resources from file
$res = LCFG::Resources::ReadFile($file,$rspec1,$rspec2,...);

# Parse resource values from arguments
$res = LCFG::Resources::Parse($default,"res1=val1","res2=val2",...);

# Merge resource structures
$res = LCFG::Resources::Merge($res1,$res2,...);

# Set prefixes to be used for environment variables
LCFG::Resources::SetPrefix($value_prefix,$type_prefix);

DESCRIPTION

In the above, rspec has the form component.resource or simply component which refers to all resources in the specified component.

The Parse routine accepts qualified, or unqualified resource names. The default component is assumed for unqualified resource names.

SetPrefix defines the prefixes attached to resource names when the values and types are exported or imported from the environment. %s in the prefix strings is replaced by the name of the corresponding component. The defaults are LCFG_%S_ and LCFGTYPE_%s_.

The res structures have the following form:

 {
   'foo' => {
              'resource1' => {
                               VALUE => value,
                               TYPE => type,
                               DERIVE = > derivation,
                               CONTEXT => context
                             },
              'resource2' => {
                               VALUE => value,
                               TYPE => type,
                               DERIVE = > derivation,
                               CONTEXT => context
                             },
              ......
            }

   'bar' => {
              'resource1' => {
                               VALUE => value,
                               TYPE => type,
                               DERIVE = > derivation,
                               CONTEXT => context
                             },
              'resource2' => {
                               VALUE => value,
                               TYPE => type,
                               DERIVE = > derivation,
                               CONTEXT => context
                             },
              ......
            }
   .......
}

All routines return undef and set the variable $@ on error.

PLATFORMS

ScientificLinux6, EnterpriseLinux7, Debian

AUTHOR

Stephen Quinney <squinney@inf.ed.ac.uk>