line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::Config::Host; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Host - Host config parameter |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role> for methods and attributes without |
10
|
|
|
|
|
|
|
documentation. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
An instance from this class, comes from / will produce: |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
host $name_attribute_value { |
15
|
|
|
|
|
|
|
$keyvalues_attribute_value |
16
|
|
|
|
|
|
|
$filenames_attribute_value |
17
|
|
|
|
|
|
|
$options_attribute_value |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config/SYNOPSIS>. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
25
|
|
|
25
|
|
17571
|
use Moose; |
|
25
|
|
|
|
|
41
|
|
|
25
|
|
|
|
|
180
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::Config::Role'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 children |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/children>. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub children { |
37
|
76
|
|
|
76
|
1
|
489
|
return qw/ |
38
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Host::FixedAddress |
39
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Host::HardwareEthernet |
40
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Option |
41
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::Filename |
42
|
|
|
|
|
|
|
Net::ISC::DHCPd::Config::KeyValue |
43
|
|
|
|
|
|
|
/; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
__PACKAGE__->create_children(__PACKAGE__->children()); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 fixedaddress |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Convienence method that wraps shift->fixedaddresses->[0] |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 options |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Option> objects. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 filenames |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::Filename> objects. There can |
60
|
|
|
|
|
|
|
be only one element in this list. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
before add_filename => sub { |
65
|
|
|
|
|
|
|
if(0 < int @{ $_[0]->filenames }) { |
66
|
|
|
|
|
|
|
confess 'Host cannot have more than one filename'; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
before add_fixedaddress => sub { |
71
|
|
|
|
|
|
|
if(0 < int @{ $_[0]->fixedaddresses }) { |
72
|
|
|
|
|
|
|
confess 'Host cannot have more than one ip address'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
}; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
before add_hardwareethernet => sub { |
77
|
|
|
|
|
|
|
if(0 < int @{ $_[0]->hardwareethernets }) { |
78
|
|
|
|
|
|
|
confess 'Host cannot have more than one mac address'; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub fixedaddress { |
83
|
0
|
|
|
0
|
1
|
0
|
shift->fixedaddresses->[0]; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 hardwareethernet |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Convienence method that wraps shift->hardwareethernets->[0] |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
sub hardwareethernet { |
92
|
1
|
|
|
1
|
1
|
3
|
shift->hardwareethernets->[0]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 keyvalues |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
A list of parsed L<Net::ISC::DHCPd::Config::KeyValue> objects. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 name |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This attribute holds a string describing the host. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
has name => ( |
106
|
|
|
|
|
|
|
is => 'ro', |
107
|
|
|
|
|
|
|
isa => 'Str', |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 regex |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/regex>. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
our $regex = qr{^ \s* host \s+ (\S+)}x; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 METHODS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 captured_to_args |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/captured_to_args>. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub captured_to_args { |
127
|
16
|
|
|
16
|
1
|
49
|
return { name => $_[0] }; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 generate |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd::Config::Role/generate>. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub generate { |
137
|
4
|
|
|
4
|
1
|
5
|
my $self = shift; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
return( |
140
|
4
|
|
|
|
|
98
|
'host ' .$self->name .' {', |
141
|
|
|
|
|
|
|
$self->_generate_config_from_children, |
142
|
|
|
|
|
|
|
'}', |
143
|
|
|
|
|
|
|
); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
154
|
|
|
|
|
|
|
1; |