line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
2
|
|
|
|
|
|
|
# @class : Chef::Rest::Client::roles # |
3
|
|
|
|
|
|
|
# @author : Bhavin Patel # |
4
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Chef::REST::Client::roles; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
989
|
use parent qw { Chef::REST::Client::EndPoints }; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
68
|
use Chef::REST::Client::role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
6
|
use Chef::REST::Client::runlist; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
34
|
|
11
|
1
|
|
|
1
|
|
45
|
use Chef::REST::Client::envrunlist; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
12
|
1
|
|
|
1
|
|
5
|
use Chef::REST::Client::attributes; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
382
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$Chef::REST::Client::roles::VERSION = 1.0; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# this module will be passed tha json parsed hash |
17
|
|
|
|
|
|
|
# under ___data__() or variable. |
18
|
|
|
|
|
|
|
# process it depending on the content expected. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub list |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
23
|
0
|
|
|
|
|
|
my $list_of_roles = $self->___data___; |
24
|
0
|
0
|
|
|
|
|
return undef if $self->___data___->{'chef_type'}; |
25
|
|
|
|
|
|
|
#return $self->___data___; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
foreach my $r ( keys(%$list_of_roles) ){ |
28
|
0
|
|
|
|
|
|
my $role = new Chef::REST::Client::role |
29
|
|
|
|
|
|
|
( |
30
|
|
|
|
|
|
|
'name' => $r, |
31
|
|
|
|
|
|
|
'url' => $list_of_roles->{$r}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
push @{'___roles_list___'} , $role; |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return @{'___roles_list___'}; |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub details |
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
my $data = $self->___data___; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
return $self->raw() unless ref $data eq 'HASH'; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return new Chef::REST::Client::role( |
47
|
|
|
|
|
|
|
'name' => $data->{'name'}, |
48
|
|
|
|
|
|
|
'run_list' => new Chef::REST::Client::runlist( $data->{'run_list'} ), #convert it to class |
49
|
|
|
|
|
|
|
'env_run_lists' => [map { |
50
|
0
|
|
|
|
|
|
new Chef::REST::Client::envrunlist( |
51
|
|
|
|
|
|
|
env_name => $_, |
52
|
|
|
|
|
|
|
run_list => new Chef::REST::Client::runlist( |
53
|
|
|
|
|
|
|
$data->{'env_run_lists'}->{$_} |
54
|
|
|
|
|
|
|
) |
55
|
|
|
|
|
|
|
) |
56
|
0
|
|
|
|
|
|
} keys( %{ $data->{'env_run_lists'} } ) ], #convert it to class |
57
|
|
|
|
|
|
|
'description' => $data->{'description'}, |
58
|
|
|
|
|
|
|
'default_attributes' => new Chef::REST::Client::attributes($data->{'default_attributes'}), |
59
|
|
|
|
|
|
|
'override_attributes' => new Chef::REST::Client::attributes($data->{'override_attributes'}), |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=pod |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Chef::REST::Client::roles |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1.0 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use Chef::REST::Client::roles; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$obj->roles->list; |
81
|
|
|
|
|
|
|
$obj->roles( 'devserver-role' )->details; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 DESCRIPTION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Class that represents collection of roles |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 METHODS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 list |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
return list of roles, array of L objects. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 details |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
return details about a particular role. or dump raw hash. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 KNOWN BUGS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SUPPORT |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
open a github ticket or email comments to Bhavin Patel |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This Software is free to use , licensed under : The Artisic License 2.0 (GPL Compatible) |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |