New upstream version 0.122
Dominique Dumont
6 years ago
34 | 34 | configure_requires => { 'Module::Build' => '0.36' }, |
35 | 35 | requires => { |
36 | 36 | 'Log::Log4perl' => '1.11', # for TRACE log level |
37 | 'Exception::Class' => 0, | |
38 | 37 | 'Config::Augeas' => '0.303', |
39 | 'Config::Model' => '2.034', | |
38 | 'Config::Model' => '2.111', | |
40 | 39 | 'Mouse' => 0, |
41 | ||
42 | 40 | }, |
43 | 41 | build_requires => { |
44 | 'Test::More' => 0, | |
45 | 'Test::Exception' => 0, | |
46 | 'Test::Differences' => 0, | |
47 | 'Test::Warn' => '0.11', # tests fail with 0.08 | |
48 | 'version' => '0.77' | |
49 | }, | |
42 | 'Config::Model::Itself' => '2.012', # for t/model_extension.t | |
43 | 'Test::More' => 0, | |
44 | 'Test::Exception' => 0, | |
45 | 'Test::Differences' => 0, | |
46 | 'Test::Warn' => '0.11', # tests fail with 0.08 | |
47 | 'version' => '0.77' | |
48 | }, | |
50 | 49 | |
51 | 50 | # cleanup required by t/augeas_backend.t |
52 | 51 | add_to_cleanup => [qw/wr_root r_root/], |
0 | 2017-10-03 Dominique Dumont <domi.dumont@free.fr> v0.122 | |
1 | ||
2 | * Build.PL: require Config::Model::Itself 2.012 for tests | |
3 | * Build.PL: remove obsolete dependency on Exception::Class | |
4 | ||
5 | 2017-10-01 Dominique Dumont <domi.dumont@free.fr> v0.121 | |
6 | ||
7 | * changed test backend specification to use rw_config instead of | |
8 | read_config following the deprecation done in Config::Model 2.111 | |
9 | * Renamed meta model extension to follow the changes done in | |
10 | Config::Model::Itself 2.012 | |
11 | ||
0 | 12 | 2017-05-14 Dominique Dumont <domi.dumont@free.fr> v0.120 |
1 | 13 | |
2 | 14 | * tweak test to cope with '.' removal from @INC |
55 | 67 | * require Config::Model 1.255 |
56 | 68 | |
57 | 69 | |
58 | 2010-12-13 Dominique Dumont <dominique.dumont@hp.com> v0.109 | |
70 | 2010-12-13 Dominique Dumont <domi.dumont@free.fr> v0.109 | |
59 | 71 | |
60 | 72 | * updated tests to work with Config::Model 1.236 |
61 | 73 | (fix Ubuntu bug #749108) |
62 | 74 | |
63 | 2010-12-13 Dominique Dumont <dominique.dumont@hp.com> v0.108 | |
75 | 2010-12-13 Dominique Dumont <domi.dumont@free.fr> v0.108 | |
64 | 76 | |
65 | 77 | * updated tests to work with Config::Model 1.207 |
66 | 78 | * C::M::B::Augeas: synopsis is now a model snippet |
67 | ||
68 | 2009-05-29 Dominique Dumont <dominique.dumont@hp.com> v0.107 | |
79 | ||
80 | 2009-05-29 Dominique Dumont <domi.dumont@free.fr> v0.107 | |
69 | 81 | |
70 | 82 | * lib/Config/Model/Backend/Augeas.pm (all): Use Log::Log4perl for |
71 | 83 | trace with Data::Read and Data::Write categories |
72 | 84 | |
73 | 2009-05-28 Dominique Dumont <dominique.dumont@hp.com> | |
85 | 2009-05-28 Dominique Dumont <domi.dumont@free.fr> | |
74 | 86 | |
75 | 87 | * lib/Config/Model/Backend/Augeas.pm: replaced obsolete |
76 | 88 | config_file parameter with file (Config::Model 0.636) |
77 | 89 | (all): ignore Augeas #comment nodes |
78 | 90 | |
79 | 2009-03-31 Dominique Dumont <dominique.dumont@hp.com> v0.106 | |
91 | 2009-03-31 Dominique Dumont <domi.dumont@free.fr> v0.106 | |
80 | 92 | |
81 | 93 | * t/*.t: fixed tests that broke with Config::Model 0.634 |
82 | 94 | (Fixes Debian bug #521968) |
83 | 95 | |
84 | 2009-01-28 Dominique Dumont <dominique.dumont@hp.com> v0.105 | |
96 | 2009-01-28 Dominique Dumont <domi.dumont@free.fr> v0.105 | |
85 | 97 | |
86 | 98 | * t/augeas*.t: Sometimes the Augeas locale bug workaround also |
87 | 99 | needs LC_ALL=C. |
88 | 100 | |
89 | 2009-01-27 Dominique Dumont <dominique.dumont@hp.com> v0.104 | |
101 | 2009-01-27 Dominique Dumont <domi.dumont@free.fr> v0.104 | |
90 | 102 | |
91 | 103 | * lib/Config/Model/Backend/Augeas.pm (write): Do no create |
92 | 104 | directory to store config files. Creating dir for file is Augeas |
98 | 110 | tests can be run on amd64 arch. The workaround re-run tests with |
99 | 111 | LANG=C environment |
100 | 112 | |
101 | 2009-01-19 Dominique Dumont <dominique.dumont@hp.com> v0.102 | |
113 | 2009-01-19 Dominique Dumont <domi.dumont@free.fr> v0.102 | |
102 | 114 | |
103 | 115 | * lib/Config/Model/Backend/Augeas.pm: Lots of improvement to deal |
104 | 116 | with sshd_config lenses |
105 | 117 | |
106 | 2008-11-16 Domi <domi@bilbo.maison> | |
118 | 2008-11-16 Dominique Dumont <domi.dumont@free.fr> | |
107 | 119 | |
108 | 120 | * lib/Config/Model/Backend/Augeas.pm (write): Fixed a bug that |
109 | 121 | prevented to write through Augeas even if read through Augeas was |
110 | 122 | not done. |
111 | 123 | |
112 | 2008-11-13 Dominique Dumont <dominique.dumont@hp.com> v0.101 | |
124 | 2008-11-13 Dominique Dumont <domi.dumont@free.fr> v0.101 | |
113 | 125 | |
114 | 126 | * lib/Config/Model/Backend/Augeas.pm: First version |
115 | ||
116 | 127 | |
128 |
2 | 2 | Build.PL |
3 | 3 | ChangeLog |
4 | 4 | lib/Config/Model/Backend/Augeas.pm |
5 | lib/Config/Model/models/Itself/ConfigWR.d/augeas-backend.pl | |
5 | lib/Config/Model/models/Itself/ConfigReadWrite.d/augeas-backend.pl | |
6 | 6 | MANIFEST This list of files |
7 | 7 | META.json |
8 | 8 | META.yml |
3 | 3 | "Dominique Dumont (ddumont at cpan dot org)" |
4 | 4 | ], |
5 | 5 | "dynamic_config" : 1, |
6 | "generated_by" : "Module::Build version 0.422", | |
6 | "generated_by" : "Module::Build version 0.4224", | |
7 | 7 | "license" : [ |
8 | 8 | "lgpl_2_1" |
9 | 9 | ], |
15 | 15 | "prereqs" : { |
16 | 16 | "build" : { |
17 | 17 | "requires" : { |
18 | "Config::Model::Itself" : "2.012", | |
18 | 19 | "Test::Differences" : "0", |
19 | 20 | "Test::Exception" : "0", |
20 | 21 | "Test::More" : "0", |
30 | 31 | "runtime" : { |
31 | 32 | "requires" : { |
32 | 33 | "Config::Augeas" : "0.303", |
33 | "Config::Model" : "2.034", | |
34 | "Exception::Class" : "0", | |
34 | "Config::Model" : "2.111", | |
35 | 35 | "Log::Log4perl" : "1.11", |
36 | 36 | "Mouse" : "0" |
37 | 37 | } |
40 | 40 | "provides" : { |
41 | 41 | "Config::Model::Backend::Augeas" : { |
42 | 42 | "file" : "lib/Config/Model/Backend/Augeas.pm", |
43 | "version" : "0.120" | |
43 | "version" : "0.122" | |
44 | 44 | } |
45 | 45 | }, |
46 | 46 | "release_status" : "stable", |
49 | 49 | "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt" |
50 | 50 | ] |
51 | 51 | }, |
52 | "version" : "0.120", | |
53 | "x_serialization_backend" : "JSON::PP version 2.27300_01" | |
52 | "version" : "0.122", | |
53 | "x_serialization_backend" : "JSON::PP version 2.27400_02" | |
54 | 54 | } |
2 | 2 | author: |
3 | 3 | - 'Dominique Dumont (ddumont at cpan dot org)' |
4 | 4 | build_requires: |
5 | Config::Model::Itself: '2.012' | |
5 | 6 | Test::Differences: '0' |
6 | 7 | Test::Exception: '0' |
7 | 8 | Test::More: '0' |
10 | 11 | configure_requires: |
11 | 12 | Module::Build: '0.36' |
12 | 13 | dynamic_config: 1 |
13 | generated_by: 'Module::Build version 0.422, CPAN::Meta::Converter version 2.150005' | |
14 | generated_by: 'Module::Build version 0.4224, CPAN::Meta::Converter version 2.150010' | |
14 | 15 | license: lgpl |
15 | 16 | meta-spec: |
16 | 17 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
19 | 20 | provides: |
20 | 21 | Config::Model::Backend::Augeas: |
21 | 22 | file: lib/Config/Model/Backend/Augeas.pm |
22 | version: '0.120' | |
23 | version: '0.122' | |
23 | 24 | requires: |
24 | 25 | Config::Augeas: '0.303' |
25 | Config::Model: '2.034' | |
26 | Exception::Class: '0' | |
26 | Config::Model: '2.111' | |
27 | 27 | Log::Log4perl: '1.11' |
28 | 28 | Mouse: '0' |
29 | 29 | resources: |
30 | 30 | license: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt |
31 | version: '0.120' | |
31 | version: '0.122' | |
32 | 32 | x_serialization_backend: 'CPAN::Meta::YAML version 0.018' |
31 | 31 | eval { require Config::Augeas; }; |
32 | 32 | $has_augeas = 0 if $@; |
33 | 33 | |
34 | our $VERSION = '0.120'; | |
34 | our $VERSION = '0.122'; | |
35 | 35 | |
36 | 36 | my $logger = get_logger('Backend::Augeas'); |
37 | 37 |
0 | [ | |
1 | [ | |
2 | name => "Itself::ConfigReadWrite", | |
3 | ||
4 | 'element' => [ | |
5 | ||
6 | 'backend' => { | |
7 | choice => [qw/Augeas/], | |
8 | help => { | |
9 | augeas => "Experimental backend with RedHat's Augeas library. See http://augeas.net for details", | |
10 | } | |
11 | }, | |
12 | ||
13 | 'save' => { | |
14 | type => 'leaf', | |
15 | value_type => 'enum', | |
16 | choice => [qw/backup newfile/], | |
17 | level => 'hidden', | |
18 | description => | |
19 | 'Specify how to save the configuration file. Either create a newfile (with extension .augnew, and do not overwrite the original file) or move the original file into a backup file (.augsave extension). Configuration files are overwritten by default', | |
20 | warp => { | |
21 | follow => '- backend', | |
22 | rules => [ Augeas => { level => 'normal', } ], | |
23 | } | |
24 | }, | |
25 | ||
26 | 'set_in' => { | |
27 | type => 'leaf', | |
28 | value_type => 'reference', | |
29 | refer_to => '- - element', | |
30 | level => 'hidden', | |
31 | description => | |
32 | 'Sometimes, the structure of a file loaded by Augeas starts directly with a list of items. For instance, /etc/hosts structure starts with a list of lines that specify hosts and IP addresses. This parameter specifies an element name in Config::Model root class that will hold the configuration data retrieved by Augeas', | |
33 | warp => { | |
34 | follow => '- backend', | |
35 | rules => [ Augeas => { level => 'normal', } ], | |
36 | } | |
37 | }, | |
38 | 'sequential_lens' => { | |
39 | type => 'list', | |
40 | level => 'hidden', | |
41 | cargo => { | |
42 | type => 'leaf', | |
43 | value_type => 'uniline', | |
44 | }, | |
45 | warp => { | |
46 | follow => { b => '- backend' }, | |
47 | rules => [ '$b eq "Augeas"' => { level => 'normal', } ], | |
48 | }, | |
49 | description => | |
50 | 'List of hash or list Augeas lenses where value are stored in sequential Augeas nodes. See Config::Model::Backend::Augeas for details.', | |
51 | }, | |
52 | ], | |
53 | ||
54 | ], | |
55 | ||
56 | ]; |
0 | [ | |
1 | [ | |
2 | name => "Itself::ConfigWR", | |
3 | ||
4 | 'element' => [ | |
5 | ||
6 | 'backend' => { | |
7 | choice => [qw/Augeas/], | |
8 | help => { | |
9 | augeas => "Experimental backend with RedHat's Augeas library. See http://augeas.net for details", | |
10 | } | |
11 | }, | |
12 | ||
13 | 'save' => { | |
14 | type => 'leaf', | |
15 | value_type => 'enum', | |
16 | choice => [qw/backup newfile/], | |
17 | level => 'hidden', | |
18 | description => | |
19 | 'Specify how to save the configuration file. Either create a newfile (with extension .augnew, and do not overwrite the original file) or move the original file into a backup file (.augsave extension). Configuration files are overwritten by default', | |
20 | warp => { | |
21 | follow => '- backend', | |
22 | rules => [ Augeas => { level => 'normal', } ], | |
23 | } | |
24 | }, | |
25 | ||
26 | 'set_in' => { | |
27 | type => 'leaf', | |
28 | value_type => 'reference', | |
29 | refer_to => '- - element', | |
30 | level => 'hidden', | |
31 | description => | |
32 | 'Sometimes, the structure of a file loaded by Augeas starts directly with a list of items. For instance, /etc/hosts structure starts with a list of lines that specify hosts and IP addresses. This parameter specifies an element name in Config::Model root class that will hold the configuration data retrieved by Augeas', | |
33 | warp => { | |
34 | follow => '- backend', | |
35 | rules => [ Augeas => { level => 'normal', } ], | |
36 | } | |
37 | }, | |
38 | 'sequential_lens' => { | |
39 | type => 'list', | |
40 | level => 'hidden', | |
41 | cargo => { | |
42 | type => 'leaf', | |
43 | value_type => 'uniline', | |
44 | }, | |
45 | warp => { | |
46 | follow => { b => '- backend' }, | |
47 | rules => [ '$b eq "Augeas"' => { level => 'normal', } ], | |
48 | }, | |
49 | description => | |
50 | 'List of hash or list Augeas lenses where value are stored in sequential Augeas nodes. See Config::Model::Backend::Augeas for details.', | |
51 | }, | |
52 | ], | |
53 | ||
54 | ], | |
55 | ||
56 | ]; |
18 | 18 | use ExtUtils::testlib; |
19 | 19 | use Log::Log4perl qw(:easy :levels) ; |
20 | 20 | use Config::Model ; |
21 | use Config::Model::Itself 2.012; | |
21 | 22 | |
22 | 23 | no warnings qw(once); |
23 | ||
24 | eval { require Config::Model::Itself ;} ; | |
25 | if ( $@ ) { | |
26 | plan skip_all => 'Config::Model::Itself is not installed'; | |
27 | } | |
28 | else { | |
29 | plan tests => 3; | |
30 | } | |
31 | 24 | |
32 | 25 | my $arg = shift || ''; |
33 | 26 | my ($log,$show) = (0) x 2 ; |
60 | 53 | |
61 | 54 | my $meta_root = $meta_inst->config_root ; |
62 | 55 | |
63 | my %ssh_model; | |
56 | my %ssh_model ; | |
57 | ||
58 | # avoid unordered hash warning | |
59 | $ssh_model{class}{__order} = ['MasterModel::SshdWithAugeas']; | |
64 | 60 | |
65 | 61 | $ssh_model{class}{'MasterModel::SshdWithAugeas'} = { |
66 | 62 | |
67 | 'read_config' => [ | |
68 | { | |
69 | backend => 'Augeas', | |
70 | config_dir => '/etc/ssh', | |
71 | file => 'sshd_config', | |
72 | sequential_lens => [qw/HostKey Subsystem Match/], | |
73 | }, | |
74 | { | |
75 | backend => 'perl_file', | |
76 | config_dir => '/etc/ssh', | |
77 | auto_create => 1, | |
78 | }, | |
79 | ], | |
63 | 'rw_config' => { | |
64 | backend => 'Augeas', | |
65 | # commentnfig_dir => '/etc/ssh', | |
66 | file => 'sshd_config', | |
67 | sequential_lens => [qw/HostKey Subsystem Match/], | |
68 | }, | |
80 | 69 | |
81 | 70 | element => [ |
82 | 71 | 'AcceptEnv', |
120 | 109 | |
121 | 110 | # kind of not necessary since load_data aboce will fail if the model extension is |
122 | 111 | # not loaded |
123 | my $backend = $meta_root->grab("class:MasterModel::SshdWithAugeas read_config:0 backend") ; | |
112 | my $backend = $meta_root->grab("class:MasterModel::SshdWithAugeas rw_config backend") ; | |
124 | 113 | like( |
125 | 114 | join( ',', $backend->get_choice), |
126 | 115 | qr/Augeas/, |
127 | 116 | "test that augeas backend is part of backend choice" |
128 | 117 | ) ; |
129 | 118 | |
119 | done_testing(); |
16 | 16 | ( |
17 | 17 | name => 'Hosts', |
18 | 18 | |
19 | read_config => [ { backend => 'augeas', | |
20 | config_dir => '/etc/', | |
21 | file => 'hosts', | |
22 | set_in => 'record', | |
23 | save => 'backup', | |
24 | #sequential_lens => ['record'], | |
25 | }, | |
26 | ], | |
19 | rw_config => { | |
20 | backend => 'augeas', | |
21 | config_dir => '/etc/', | |
22 | file => 'hosts', | |
23 | set_in => 'record', | |
24 | save => 'backup', | |
25 | #sequential_lens => ['record'], | |
26 | }, | |
27 | 27 | |
28 | 28 | element => [ |
29 | 29 | record => { type => 'list', |
38 | 38 | ( |
39 | 39 | name => 'Sshd', |
40 | 40 | |
41 | 'read_config' | |
42 | => [ { backend => 'augeas', | |
43 | config_dir => '/etc/ssh/', | |
44 | file => 'sshd_config', | |
45 | save => 'backup', | |
46 | sequential_lens => [qw/HostKey Subsystem Match/], | |
47 | }, | |
48 | ], | |
41 | 'rw_config' => { | |
42 | backend => 'augeas', | |
43 | config_dir => '/etc/ssh/', | |
44 | file => 'sshd_config', | |
45 | save => 'backup', | |
46 | sequential_lens => [qw/HostKey Subsystem Match/], | |
47 | }, | |
49 | 48 | |
50 | 49 | element => [ |
51 | 50 | 'AcceptEnv', |