| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Ixchel::Actions::sagan_conf_update; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
141770
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
28
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
44
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
86
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use base 'Ixchel::Actions::base'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
573
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Ixchel::Actions::sagan_conf_update - Update the all Sagan confs. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.2.0 |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.2.0'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 CLI SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
ixchel -a sagan_conf_update [B<--np>] [B<-w>] [B<--no_base>] [B<-i> ] |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 CODE SYNOPSIS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Data::Dumper; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $results=$ixchel->action(action=>'sagan_conf_update', opts=>{np=>1, w=>1, }); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
print Dumper($results); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This calls runs the following actions if |
|
35
|
|
|
|
|
|
|
.sagan.merged_base_include is false. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sagan_base |
|
38
|
|
|
|
|
|
|
sagan_include |
|
39
|
|
|
|
|
|
|
sagan_rules |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This calls runs the following actions if |
|
42
|
|
|
|
|
|
|
.sagan.merged_base_include is true. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sagan_merged |
|
45
|
|
|
|
|
|
|
sagan_rules |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 FLAGS |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 -i instance |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
A instance to operate on. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 --no_base |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Do not rebuild the base files. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Only relevant is the config item .sagan.merged_base_include |
|
58
|
|
|
|
|
|
|
is false. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 --no_include |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Do not rebuild the include files. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Only relevant is the config item .sagan.merged_base_include |
|
65
|
|
|
|
|
|
|
is false. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 --no_merged |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Do not rebuild the the merged base/include files. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Only relevant is the config item .sagan.merged_base_include |
|
72
|
|
|
|
|
|
|
is true. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 --no_rules |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Do not rebuild the rules files. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 RESULT HASH REF |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
.errors :: A array of errors encountered. |
|
81
|
|
|
|
|
|
|
.status_text :: A string description of what was done and teh results. |
|
82
|
|
|
|
|
|
|
.ok :: Set to zero if any of the above errored. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
0
|
0
|
|
sub new_extra { } |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub action_extra { |
|
89
|
0
|
|
|
0
|
0
|
|
my $self = $_[0]; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my %opts = %{ $self->{opts} }; |
|
|
0
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$opts{np} = 1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
0
|
|
|
|
|
if ( $self->{config}{sagan}{merged_base_include} ) { |
|
95
|
0
|
0
|
|
|
|
|
if ( !$self->{opts}{no_merged} ) { |
|
96
|
0
|
|
|
|
|
|
$self->status_add( status => '-----[ sagan_merged ]-------------------------------------' ); |
|
97
|
0
|
|
|
|
|
|
my $returned; |
|
98
|
0
|
|
|
|
|
|
eval { $returned = $self->{ixchel}->action( action => 'sagan_merged', opts => \%opts ); }; |
|
|
0
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
if ($@) { |
|
100
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_incude died ... ' . $@, error => 1 ); |
|
101
|
|
|
|
|
|
|
} else { |
|
102
|
0
|
0
|
|
|
|
|
if ( defined( $returned->{errors}[0] ) ) { |
|
103
|
0
|
|
|
|
|
|
push( @{ $self->{results}{errors} }, @{ $returned->{errors} } ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_merged errored', error => 1 ); |
|
105
|
|
|
|
|
|
|
} else { |
|
106
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_merged completed with out errors.', ); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
} ## end if ( !$self->{opts}{no_merged} ) |
|
110
|
|
|
|
|
|
|
} else { |
|
111
|
0
|
0
|
|
|
|
|
if ( !$self->{opts}{no_base} ) { |
|
112
|
0
|
|
|
|
|
|
$self->status_add( status => '-----[ sagan_base ]-------------------------------------', ); |
|
113
|
0
|
|
|
|
|
|
my $returned; |
|
114
|
0
|
|
|
|
|
|
eval { $returned = $self->{ixchel}->action( action => 'sagan_base', opts => \%opts ); }; |
|
|
0
|
|
|
|
|
|
|
|
115
|
0
|
0
|
|
|
|
|
if ($@) { |
|
116
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_base died ' . $@, error => 1 ); |
|
117
|
|
|
|
|
|
|
} else { |
|
118
|
0
|
0
|
|
|
|
|
if ( defined( $returned->{errors}[0] ) ) { |
|
119
|
0
|
|
|
|
|
|
push( @{ $self->{results}{errors} }, @{ $returned->{errors} } ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_base errored', error => 1 ); |
|
121
|
|
|
|
|
|
|
} else { |
|
122
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_base completed with out errors', ); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
} ## end if ( !$self->{opts}{no_base} ) |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
if ( !$self->{opts}{no_include} ) { |
|
128
|
0
|
|
|
|
|
|
my $status = '-----[ sagan_include ]-------------------------------------' . "\n"; |
|
129
|
0
|
|
|
|
|
|
my $returned; |
|
130
|
0
|
|
|
|
|
|
eval { $returned = $self->{ixchel}->action( action => 'sagan_include', opts => \%opts ); }; |
|
|
0
|
|
|
|
|
|
|
|
131
|
0
|
0
|
|
|
|
|
if ($@) { |
|
132
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_incude died ... ' . $@, error => 1 ); |
|
133
|
|
|
|
|
|
|
} else { |
|
134
|
0
|
0
|
|
|
|
|
if ( defined( $returned->{errors}[0] ) ) { |
|
135
|
0
|
|
|
|
|
|
push( @{ $self->{results}{errors} }, @{ $returned->{errors} } ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_include errored', error => 1 ); |
|
137
|
|
|
|
|
|
|
} else { |
|
138
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_include completed with out errors', ); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
} ## end if ( !$self->{opts}{no_include} ) |
|
142
|
|
|
|
|
|
|
} ## end else [ if ( $self->{config}{sagan}{merged_base_include...})] |
|
143
|
|
|
|
|
|
|
|
|
144
|
0
|
0
|
|
|
|
|
if ( !$self->{opts}{no_rules} ) { |
|
145
|
0
|
|
|
|
|
|
my $status = '-----[ sagan_rules ]-------------------------------------' . "\n"; |
|
146
|
0
|
|
|
|
|
|
my $returned; |
|
147
|
0
|
|
|
|
|
|
eval { $returned = $self->{ixchel}->action( action => 'sagan_rules', opts => \%opts ); }; |
|
|
0
|
|
|
|
|
|
|
|
148
|
0
|
0
|
|
|
|
|
if ($@) { |
|
149
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_rules died ... ' . $@, error => 1 ); |
|
150
|
|
|
|
|
|
|
} else { |
|
151
|
0
|
0
|
|
|
|
|
if ( defined( $returned->{errors}[0] ) ) { |
|
152
|
0
|
|
|
|
|
|
push( @{ $self->{results}{errors} }, @{ $returned->{errors} } ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_rules errored', error => 1 ); |
|
154
|
|
|
|
|
|
|
} else { |
|
155
|
0
|
|
|
|
|
|
$self->status_add( status => 'sagan_rules completed with out errors', ); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
} ## end if ( !$self->{opts}{no_rules} ) |
|
159
|
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
return undef; |
|
161
|
|
|
|
|
|
|
} ## end sub action_extra |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub short { |
|
164
|
0
|
|
|
0
|
1
|
|
return 'Generates the instance specific include for a sagan instance.'; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub opts_data { |
|
168
|
0
|
|
|
0
|
1
|
|
return 'i=s |
|
169
|
|
|
|
|
|
|
w |
|
170
|
|
|
|
|
|
|
no_base |
|
171
|
|
|
|
|
|
|
no_include |
|
172
|
|
|
|
|
|
|
no_rules |
|
173
|
|
|
|
|
|
|
no_merged |
|
174
|
|
|
|
|
|
|
'; |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
1; |