This shows you the differences between two versions of the page.
esmith:configdb [2015/05/22 07:22] stephdl created |
esmith:configdb [2019/06/05 19:48] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== esmith:: | ||
- | |||
- | ===== NAME ===== | ||
- | | ||
- | |||
- | In a root terminal you can do the command below if you want to display the up-to-date content | ||
- | | ||
- | |||
- | ===== SYNOPSIS ===== | ||
- | use esmith:: | ||
- | my $db = esmith:: | ||
- | my $db = esmith:: | ||
- | | ||
- | my @services = $db-> | ||
- | | ||
- | # Singleton Records | ||
- | my $record = $db-> | ||
- | my $value = $record-> | ||
- | | ||
- | | ||
- | # BAD! | ||
- | my $value = $db-> | ||
- | # doesn’t exist | ||
- | | ||
- | # doesn’t exist | ||
- | | ||
- | # GOOD | ||
- | my $record = $db-> | ||
- | my $value; | ||
- | if ($record) | ||
- | { | ||
- | | ||
- | } | ||
- | | ||
- | # Typed Records (eventually they all will be) | ||
- | my $prop = $record-> | ||
- | | ||
- | my $value = $db-> | ||
- | | ||
- | |||
- | ===== DESCRIPTION ===== | ||
- | This module provides an abstracted interface to the esmith master configuration database. | ||
- | |||
- | Unless otherwise noted, esmith:: | ||
- | |||
- | ==== open() ==== | ||
- | Like esmith:: | ||
- | |||
- | ==== open_ro() ==== | ||
- | |||
- | Like esmith:: | ||
- | |||
- | ==== new_record() ==== | ||
- | |||
- | This method creates a new record in the configuration database. As arguments, it expects the key to the record, followed by a hash references with its properties, including the type. | ||
- | |||
- | my $db = esmith:: | ||
- | type => ’service’, | ||
- | status => ’disabled’ }); | ||
- | | ||
- | my %defaults = qw( | ||
- | type => ’service’, | ||
- | | ||
- | | ||
- | ); my $record = $db-> | ||
- | | ||
- | |||
- | ==== get() ==== | ||
- | Like their esmith::DB counterparts except they return esmith:: | ||
- | |||
- | my $record = $db-> | ||
- | |||
- | ==== getLocale() ==== | ||
- | |||
- | Retrieves the locale and keyboard settings from the configuration database. | ||
- | |||
- | ==== hosts_allow_spec ($service [,$daemon]) ==== | ||
- | |||
- | Given a service, return the string suitable for / | ||
- | |||
- | An optional argument provides the tag which appears in hosts.allow. If not given, the service name is used. | ||
- | |||
- | For example, one of the following: | ||
- | |||
- | # ’oidentd’ is not defined in the configuration database # ’oidentd’ is | ||
- | | ||
- | | ||
- | |||
- | And here’s the hosts.allow fragment: | ||
- | |||
- | { | ||
- | $OUT = $DB-> | ||
- | } | ||
- | |||
- | ==== wins_server ==== | ||
- | Return the value of the WINS server from the config db or undef if we don’t have a WINS server set and we are not the domain master | ||
- | |||
- | ==== services() ==== | ||
- | |||
- | Returns a list of services in the configuration database | ||
- | |||
- | ==== _loadDefaults ($forceReset) ==== | ||
- | |||
- | Behaves just like the esmith::DB method of the same name. This is a private method used internally. | ||
- | |||
- | ==== record_has_defaults ($name) ==== | ||
- | |||
- | Behaves just like the esmith::DB method of the same name. | ||
- | ==== migrate ==== | ||
- | |||
- | Just like the esmith::DB method of the same name. | ||
- | |||
- | ===== AUTHOR ===== | ||
- | SME Server Developers < | ||
- | {tag> neth-development sme-development }} |