Config-Model-Backend-Augeas

 view release on metacpan or  search on metacpan

t/lib/LoadTest.pm  view on Meta::CPAN

# test model used by t/*.t

package LoadTest;
require Exporter;

our @ISA = qw/Exporter/;
our @EXPORT = qw/load_test_model/;

sub load_test_model {
    my $model = shift ;

    $model->create_config_class (
        name => 'Host',

        element => [
            [qw/ipaddr canonical alias/] => {
                type => 'leaf',
                value_type => 'uniline',
            }
        ]
    );


    $model->create_config_class (
        name => 'Hosts',

        rw_config  =>  {
            backend => 'augeas',
            config_dir => '/etc/',
            file => 'hosts',
            set_in => 'record',
            save   => 'backup',
            #sequential_lens => ['record'],
        },

        element => [
            record => {
                type => 'list',
                cargo => {
                    type => 'node',
                    config_class_name => 'Host',
                } ,
            },
        ]
    );

    $model->create_config_class (
        name => 'Sshd',

        'rw_config' => {
            backend => 'augeas',
            config_dir => '/etc/ssh/',
            file => 'sshd_config',
            save   => 'backup',
            sequential_lens => [qw/HostKey Subsystem Match/],
        },

        element => [
            'AcceptEnv', {
                'cargo' => {
                    'value_type' => 'uniline',
                    'type' => 'leaf'
                },
                'type' => 'list',
            },
            'AllowUsers', {
                'cargo' => {
                    'value_type' => 'uniline',
                    'type' => 'leaf'
                },
                'type' => 'list',
            },
            'ForceCommand', {
                'value_type' => 'uniline',
                'type' => 'leaf',
            },
	       'HostbasedAuthentication', {
               'value_type' => 'enum',
               choice => [qw/no yes/],
               'type' => 'leaf',
	       },
	       'HostKey', {
               'cargo' => {
                   'value_type' => 'uniline',
                   'type' => 'leaf'
			   },
               'type' => 'list',
	       },
            'DenyUSers', {
                'cargo' => {
                    'value_type' => 'uniline',
                    'type' => 'leaf'
                },
                'type' => 'list',
            },
            'Protocol', {
                'default_list' => ['1', '2'],
                'type' => 'check_list',
                'choice' => ['1', '2']
            },
	       'Subsystem', {
               'cargo' => {
                   'value_type' => 'uniline',
                   'mandatory' => '1',
                   'type' => 'leaf'
			   },
               'type' => 'hash',
               'index_type' => 'string'
	       },
            'Match', {
                'cargo' => {
                    'type' => 'node',
                    'config_class_name' => 'Sshd::MatchBlock'
                },



( run in 0.617 second using v1.01-cache-2.11-cpan-39bf76dae61 )