line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
2
|
|
|
|
|
|
|
# @class : Chef::Rest::Client::cookbooks # |
3
|
|
|
|
|
|
|
# @author : Bhavin Patel # |
4
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Chef::REST::Client::cookbooks; |
7
|
1
|
|
|
1
|
|
9349
|
use parent qw { Chef::REST::Client::EndPoints }; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Chef::REST::Client::cookbooks::VERSION = 1.0; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
86
|
use Chef::REST::Client::cookbook; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
12
|
1
|
|
|
1
|
|
6
|
use Chef::REST::Client::cookbook_versions; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
354
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Chef::REST::Client::cookbooks |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 VERSION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1.0 |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$obj->cookbooks('yum', '_latest')->details; |
27
|
|
|
|
|
|
|
$obj->cookbooks('yum', '_latest')->details->attributes; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This class contains methods to get cookbooks from chef server. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 list |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This method list all the cookbooks available. |
38
|
|
|
|
|
|
|
$obj->cookbook()->list; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# this module will be passed tha json parsed hash |
43
|
|
|
|
|
|
|
# under ___data__() or variable. |
44
|
|
|
|
|
|
|
# process it depending on the content expected. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub list |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
my $list_of_cookbooks = $self->___data___; |
50
|
0
|
0
|
|
|
|
|
return undef if $self->___data___->{'chef_type'} eq 'cookbook'; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
foreach my $c ( keys(%$list_of_cookbooks) ){ |
53
|
0
|
|
|
|
|
|
my $cookbook = new Chef::REST::Client::cookbook('name' => $c); |
54
|
0
|
|
|
|
|
|
$cookbook->url( $list_of_cookbooks->{$c}->{'url'}); |
55
|
0
|
|
|
|
|
|
$cookbook->versions( $list_of_cookbooks->{$c}->{'versions'} ); |
56
|
0
|
|
|
|
|
|
push @{'___cookbooks_list___'} , $cookbook; |
|
0
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
return @{'___cookbooks_list___'}; |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 details |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This method fetches details about a cookbook |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
$obj->cookbook('yum')->details; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub details |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
72
|
0
|
|
|
|
|
|
my $data = $self->___data___; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#return $self->raw(); |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
return $self->raw() unless ref $data eq 'HASH'; |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
|
|
|
|
return new Chef::REST::Client::cookbook( |
79
|
|
|
|
|
|
|
'name' => $data->{'cookbook_name'}, |
80
|
|
|
|
|
|
|
'libraries' => $data->{'libraries' }, |
81
|
|
|
|
|
|
|
'providers' => $data->{'providers' }, |
82
|
|
|
|
|
|
|
'resources' => $data->{'resources' }, |
83
|
|
|
|
|
|
|
'root_files' => $data->{'root_files' }, |
84
|
|
|
|
|
|
|
'version' => $data->{'version' }, |
85
|
|
|
|
|
|
|
'templates' => $data->{'templates' }, |
86
|
|
|
|
|
|
|
'files' => $data->{'files' }, |
87
|
|
|
|
|
|
|
'attributes' => $data->{'attributes' }, |
88
|
|
|
|
|
|
|
'recipes' => $data->{'recipes' }, |
89
|
|
|
|
|
|
|
'metadata' => $data->{'metadata' }, |
90
|
|
|
|
|
|
|
) if defined $data->{'cookbook_name'}; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my $obj = new Chef::REST::Client::cookbook ( 'name' => keys(%$data)); |
93
|
0
|
|
|
|
|
|
$obj->url( $data->{ $obj->name }->{'url' } ); |
94
|
0
|
|
|
|
|
|
$obj->versions( $data->{ $obj->name }->{'versions'} ); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return $obj; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 KNOWN BUGS |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SUPPORT |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
open a github ticket or email comments to Bhavin Patel |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This Software is free to use , licensed under : The Artisic License 2.0 (GPL Compatible) |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |