chef 0.10.4.rc.4 → 0.10.4.rc.5
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/common/html/chef-client.8.html +4 -4
- data/distro/common/html/chef-expander.8.html +4 -4
- data/distro/common/html/chef-expanderctl.8.html +4 -4
- data/distro/common/html/chef-server-webui.8.html +4 -4
- data/distro/common/html/chef-server.8.html +4 -4
- data/distro/common/html/chef-solo.8.html +4 -4
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +4 -4
- data/distro/common/html/knife-client.1.html +4 -4
- data/distro/common/html/knife-configure.1.html +4 -4
- data/distro/common/html/knife-cookbook-site.1.html +6 -6
- data/distro/common/html/knife-cookbook.1.html +11 -4
- data/distro/common/html/knife-data-bag.1.html +4 -4
- data/distro/common/html/knife-environment.1.html +4 -4
- data/distro/common/html/knife-exec.1.html +4 -4
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +7 -6
- data/distro/common/html/knife-role.1.html +4 -4
- data/distro/common/html/knife-search.1.html +177 -24
- data/distro/common/html/knife-ssh.1.html +5 -4
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +4 -4
- data/distro/common/html/shef.1.html +4 -4
- data/distro/common/man/man1/knife-bootstrap.1 +189 -0
- data/distro/common/man/man1/knife-client.1 +99 -0
- data/distro/common/man/man1/knife-configure.1 +88 -0
- data/distro/common/man/man1/knife-cookbook-site.1 +137 -0
- data/distro/common/man/man1/knife-cookbook.1 +340 -0
- data/distro/common/man/man1/knife-data-bag.1 +130 -0
- data/distro/common/man/man1/knife-environment.1 +178 -0
- data/distro/common/man/man1/knife-exec.1 +46 -0
- data/distro/common/man/man1/knife-index.1 +29 -0
- data/distro/common/man/man1/knife-node.1 +154 -0
- data/distro/common/man/man1/knife-role.1 +88 -0
- data/distro/common/man/man1/knife-search.1 +270 -0
- data/distro/common/man/man1/knife-ssh.1 +78 -0
- data/distro/common/man/man1/knife-status.1 +29 -0
- data/distro/common/man/man1/knife-tag.1 +43 -0
- data/distro/common/man/man1/knife.1 +251 -0
- data/distro/common/man/man1/shef.1 +256 -0
- data/distro/common/man/man8/chef-client.8 +84 -0
- data/distro/common/man/man8/chef-expander.8 +97 -0
- data/distro/common/man/man8/chef-expanderctl.8 +62 -0
- data/distro/common/man/man8/chef-server-webui.8 +155 -0
- data/distro/common/man/man8/chef-server.8 +147 -0
- data/distro/common/man/man8/chef-solo.8 +158 -0
- data/distro/common/man/man8/chef-solr.8 +114 -0
- data/distro/common/markdown/man1/knife-search.mkd +130 -6
- data/lib/chef/provider/package/apt.rb +34 -24
- data/lib/chef/version.rb +1 -1
- metadata +28 -4
@@ -0,0 +1,158 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "CHEF\-SOLO" "8" "August 2011" "Chef 0.10.4.rc.5" "Chef Manual"
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBchef\-solo\fR \- Runs chef in solo mode against a specified cookbook location\.
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBchef\-solo\fR \fI(options)\fR
|
11
|
+
.
|
12
|
+
.TP
|
13
|
+
\fB\-c\fR, \fB\-\-config CONFIG\fR
|
14
|
+
The configuration file to use
|
15
|
+
.
|
16
|
+
.TP
|
17
|
+
\fB\-d\fR, \fB\-\-daemonize\fR
|
18
|
+
Daemonize the process
|
19
|
+
.
|
20
|
+
.TP
|
21
|
+
\fB\-g\fR, \fB\-\-group GROUP\fR
|
22
|
+
Group to set privilege to
|
23
|
+
.
|
24
|
+
.TP
|
25
|
+
\fB\-i\fR, \fB\-\-interval SECONDS\fR
|
26
|
+
Run chef\-client periodically, in seconds
|
27
|
+
.
|
28
|
+
.TP
|
29
|
+
\fB\-j\fR, \fB\-\-json\-attributes JSON_ATTRIBS\fR
|
30
|
+
Load attributes from a JSON file or URL
|
31
|
+
.
|
32
|
+
.TP
|
33
|
+
\fB\-l\fR, \fB\-\-log_level LEVEL\fR
|
34
|
+
Set the log level (debug, info, warn, error, fatal)
|
35
|
+
.
|
36
|
+
.TP
|
37
|
+
\fB\-L\fR, \fB\-\-logfile LOGLOCATION\fR
|
38
|
+
Set the log file location, defaults to STDOUT \- recommended for daemonizing
|
39
|
+
.
|
40
|
+
.TP
|
41
|
+
\fB\-N\fR, \fB\-\-node\-name NODE_NAME\fR
|
42
|
+
The node name for this client
|
43
|
+
.
|
44
|
+
.TP
|
45
|
+
\fB\-r\fR, \fB\-\-recipe\-url RECIPE_URL\fR
|
46
|
+
Pull down a remote gzipped tarball of recipes and untar it to the cookbook cache\.
|
47
|
+
.
|
48
|
+
.TP
|
49
|
+
\fB\-s\fR, \fB\-\-splay SECONDS\fR
|
50
|
+
The splay time for running at intervals, in seconds
|
51
|
+
.
|
52
|
+
.TP
|
53
|
+
\fB\-u\fR, \fB\-\-user USER\fR
|
54
|
+
User to set privilege to
|
55
|
+
.
|
56
|
+
.TP
|
57
|
+
\fB\-v\fR, \fB\-\-version\fR
|
58
|
+
Show chef version
|
59
|
+
.
|
60
|
+
.TP
|
61
|
+
\fB\-h\fR, \fB\-\-help\fR
|
62
|
+
Show this message
|
63
|
+
.
|
64
|
+
.SH "DESCRIPTION"
|
65
|
+
Chef Solo allows you to run Chef Cookbooks in the absence of a Chef Server\. To do this, the complete cookbook needs to be present on disk\.
|
66
|
+
.
|
67
|
+
.P
|
68
|
+
By default Chef Solo will look in /etc/chef/solo\.rb for its configuration\. This configuration file has two required variables: file_cache_path and cookbook_path\.
|
69
|
+
.
|
70
|
+
.P
|
71
|
+
For example:
|
72
|
+
.
|
73
|
+
.IP "" 4
|
74
|
+
.
|
75
|
+
.nf
|
76
|
+
|
77
|
+
file_cache_path "/var/chef\-solo"
|
78
|
+
cookbook_path "/var/chef\-solo/cookbooks"
|
79
|
+
.
|
80
|
+
.fi
|
81
|
+
.
|
82
|
+
.IP "" 0
|
83
|
+
.
|
84
|
+
.P
|
85
|
+
For your own systems, you can change this to reflect any directory you like, but you\'ll need to specify absolute paths and the cookbook_path directory should be a subdirectory of the file_cache_path\.
|
86
|
+
.
|
87
|
+
.P
|
88
|
+
You can also specify cookbook_path as an array, passing multiple locations to search for cookbooks\.
|
89
|
+
.
|
90
|
+
.P
|
91
|
+
For example:
|
92
|
+
.
|
93
|
+
.IP "" 4
|
94
|
+
.
|
95
|
+
.nf
|
96
|
+
|
97
|
+
file_cache_path "/var/chef\-solo"
|
98
|
+
cookbook_path ["/var/chef\-solo/cookbooks", "/var/chef\-solo/site\-cookbooks"]
|
99
|
+
.
|
100
|
+
.fi
|
101
|
+
.
|
102
|
+
.IP "" 0
|
103
|
+
.
|
104
|
+
.P
|
105
|
+
Note that earlier entries are now overridden by later ones\.
|
106
|
+
.
|
107
|
+
.P
|
108
|
+
Since chef\-solo doesn\'t have any interaction with a Chef Server, you\'ll need to specify node\-specifc attributes in a JSON file\. This can be located on the target system itself, or it can be stored on a remote server such as S3, or a web server on your network\.
|
109
|
+
.
|
110
|
+
.P
|
111
|
+
Within the JSON file, you\'ll also specify the recipes that Chef should run in the "run_list"\. An example JSON file, which sets a resolv\.conf:
|
112
|
+
.
|
113
|
+
.IP "" 4
|
114
|
+
.
|
115
|
+
.nf
|
116
|
+
|
117
|
+
{
|
118
|
+
"resolver": {
|
119
|
+
"nameservers": [ "10\.0\.0\.1" ],
|
120
|
+
"search":"int\.example\.com"
|
121
|
+
},
|
122
|
+
"run_list": [ "recipe[resolver]" ]
|
123
|
+
}
|
124
|
+
.
|
125
|
+
.fi
|
126
|
+
.
|
127
|
+
.IP "" 0
|
128
|
+
.
|
129
|
+
.P
|
130
|
+
Then you can run chef\-solo with \-j to specify the JSON file\. It will look for cookbooks in the cookbook_path configured in the configuration file, and apply attributes and use the run_list from the JSON file specified\.
|
131
|
+
.
|
132
|
+
.P
|
133
|
+
You can use \-c to specify the path to the configuration file (if you don\'t want chef\-solo to use the default)\. You can also specify \-r for a cookbook tarball\.
|
134
|
+
.
|
135
|
+
.P
|
136
|
+
For example:
|
137
|
+
.
|
138
|
+
.IP "" 4
|
139
|
+
.
|
140
|
+
.nf
|
141
|
+
|
142
|
+
chef\-solo \-c ~/solo\.rb \-j ~/node\.json \-r http://www\.example\.com/chef\-solo\.tar\.gz
|
143
|
+
.
|
144
|
+
.fi
|
145
|
+
.
|
146
|
+
.IP "" 0
|
147
|
+
.
|
148
|
+
.P
|
149
|
+
In the above case, chef\-solo would extract the tarball to your specified cookbook_path, use ~/solo\.rb as the configuration file, and apply attributes and use the run_list from ~/node\.json\.
|
150
|
+
.
|
151
|
+
.SH "SEE ALSO"
|
152
|
+
Full documentation for Chef and chef\-solo is located on the Chef wiki, http://wiki\.opscode\.com/display/chef/Home\.
|
153
|
+
.
|
154
|
+
.SH "AUTHOR"
|
155
|
+
Chef was written by Adam Jacob \fIadam@ospcode\.com\fR of Opscode (http://www\.opscode\.com), with contributions from the community\. This manual page was written by Joshua Timberman \fIjoshua@opscode\.com\fR with help2man\. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2\.0 License\.
|
156
|
+
.
|
157
|
+
.P
|
158
|
+
On Debian systems, the complete text of the Apache 2\.0 License can be found in /usr/share/common\-licenses/Apache\-2\.0\.
|
@@ -0,0 +1,114 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "CHEF\-SOLR" "8" "August 2011" "Chef 0.10.4.rc.5" "Chef Manual"
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBchef\-solr\fR \- Runs as Chef\'s search server
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBchef\-solr\fR \fI(options)\fR
|
11
|
+
.
|
12
|
+
.TP
|
13
|
+
\fB\-c\fR, \fB\-\-config CONFIG\fR
|
14
|
+
The configuration file to use
|
15
|
+
.
|
16
|
+
.TP
|
17
|
+
\fB\-d\fR, \fB\-\-daemonize\fR
|
18
|
+
Daemonize the process
|
19
|
+
.
|
20
|
+
.TP
|
21
|
+
\fB\-g\fR, \fB\-\-group GROUP\fR
|
22
|
+
Group to set privilege to
|
23
|
+
.
|
24
|
+
.TP
|
25
|
+
\fB\-l\fR, \fB\-\-log_level LEVEL\fR
|
26
|
+
Set the log level (debug, info, warn, error, fatal)
|
27
|
+
.
|
28
|
+
.TP
|
29
|
+
\fB\-L\fR, \fB\-\-logfile LOGLOCATION\fR
|
30
|
+
Set the log file location, defaults to STDOUT \- recommended for daemonizing
|
31
|
+
.
|
32
|
+
.TP
|
33
|
+
\fB\-D\fR, \fB\-\-solr\-data\-dir PATH\fR
|
34
|
+
Where the Solr data lives
|
35
|
+
.
|
36
|
+
.TP
|
37
|
+
\fB\-x\fR, \fB\-\-solor\-heap\-size SIZE\fR
|
38
|
+
Set the size of the Java Heap
|
39
|
+
.
|
40
|
+
.TP
|
41
|
+
\fB\-H\fR, \fB\-\-solr\-home\-dir PATH\fR
|
42
|
+
Solr home directory
|
43
|
+
.
|
44
|
+
.TP
|
45
|
+
\fB\-j\fR, \fB\-\-java\-opts OPTS\fR
|
46
|
+
Raw options passed to Java
|
47
|
+
.
|
48
|
+
.TP
|
49
|
+
\fB\-W\fR, \fB\-\-solr\-jetty\-dir PATH\fR
|
50
|
+
Where to place the Solr Jetty instance
|
51
|
+
.
|
52
|
+
.TP
|
53
|
+
\fB\-u\fR, \fB\-\-user USER\fR
|
54
|
+
User to set privilege to
|
55
|
+
.
|
56
|
+
.TP
|
57
|
+
\fB\-v\fR, \fB\-\-version\fR
|
58
|
+
Show chef\-solr version
|
59
|
+
.
|
60
|
+
.TP
|
61
|
+
\fB\-h\fR, \fB\-\-help\fR
|
62
|
+
Show this message
|
63
|
+
.
|
64
|
+
.SH "DESCRIPTION"
|
65
|
+
Chef\-solr provides search service for Chef\. You need to have both chef\-solr and chef\-expander\-cluster running in order for search to work\.
|
66
|
+
.
|
67
|
+
.P
|
68
|
+
\fBInstallation\fR
|
69
|
+
.
|
70
|
+
.P
|
71
|
+
Make sure you backed up your data if you are upgrading from a previous version\. Run chef\-solr\-installer to upgrade your Chef Solr installation\. Answer "yes" when prompted for confirmation\. The process should look like this:
|
72
|
+
.
|
73
|
+
.IP "" 4
|
74
|
+
.
|
75
|
+
.nf
|
76
|
+
|
77
|
+
yourshell> chef\-solr\-installer
|
78
|
+
Configuration setting solr_heap_size is unknown and will be ignored
|
79
|
+
|
80
|
+
Chef Solr is already installed in /var/chef/solr
|
81
|
+
Do you want to overwrite the current install? All existing Solr data will be lost\. [y/n] y
|
82
|
+
Removing the existing Chef Solr installation
|
83
|
+
rm \-rf /var/chef/solr
|
84
|
+
rm \-rf /var/chef/solr\-jetty
|
85
|
+
rm \-rf /var/chef/solr/data
|
86
|
+
Creating Solr Home Directory
|
87
|
+
mkdir \-p /var/chef/solr
|
88
|
+
entering /var/chef/solr
|
89
|
+
tar zxvf /Users/ddeleo/opscode/chef/chef\-solr/solr/solr\-home\.tar\.gz
|
90
|
+
Creating Solr Data Directory
|
91
|
+
mkdir \-p /var/chef/solr/data
|
92
|
+
Unpacking Solr Jetty
|
93
|
+
mkdir \-p /var/chef/solr\-jetty
|
94
|
+
entering /var/chef/solr\-jetty
|
95
|
+
tar zxvf /Users/ddeleo/opscode/chef/chef\-solr/solr/solr\-jetty\.tar\.gz
|
96
|
+
|
97
|
+
Successfully installed Chef Solr\.
|
98
|
+
You can restore your search index using `knife index rebuild`
|
99
|
+
.
|
100
|
+
.fi
|
101
|
+
.
|
102
|
+
.IP "" 0
|
103
|
+
.
|
104
|
+
.SH "SEE ALSO"
|
105
|
+
\fBchef\-expander\-cluster\fR(8)
|
106
|
+
.
|
107
|
+
.P
|
108
|
+
Full documentation for Chef and chef\-server is located on the Chef wiki, http://wiki\.opscode\.com/display/chef/Home\.
|
109
|
+
.
|
110
|
+
.SH "AUTHOR"
|
111
|
+
Chef was written by Adam Jacob \fIadam@ospcode\.com\fR of Opscode (http://www\.opscode\.com), with contributions from the community\. This manual page was written by Joshua Timberman \fIjoshua@opscode\.com\fR with help2man\. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2\.0 License\.
|
112
|
+
.
|
113
|
+
.P
|
114
|
+
On Debian systems, the complete text of the Apache 2\.0 License can be found in /usr/share/common\-licenses/Apache\-2\.0\.
|
@@ -9,6 +9,8 @@ __knife__ __search INDEX QUERY__ _(options)_
|
|
9
9
|
Show only one attribute
|
10
10
|
* `-i`, `--id-only`:
|
11
11
|
Show only the ID of matching objects
|
12
|
+
* `-q`, `--query QUERY`
|
13
|
+
The search query; useful to protect queries starting with -
|
12
14
|
* `-R`, `--rows INT`:
|
13
15
|
The number of rows to return
|
14
16
|
* `-r`, `--run-list`:
|
@@ -26,21 +28,143 @@ __knife__ __search INDEX QUERY__ _(options)_
|
|
26
28
|
|
27
29
|
## DESCRIPTION
|
28
30
|
|
31
|
+
Search is a feature of the Chef Server that allows you to use a
|
32
|
+
full-text search engine to query information about your infrastructure
|
33
|
+
and applications. You can utilize this service via search calls in a
|
34
|
+
recipe or the knife search command. The search syntax is based on
|
35
|
+
Lucene.
|
36
|
+
|
37
|
+
|
38
|
+
## INDEXES
|
39
|
+
|
29
40
|
Search indexes are a feature of the Chef Server and the search
|
30
41
|
sub-command allows querying any of the available indexes using SOLR
|
31
|
-
query syntax. The following data types are indexed for search:
|
32
|
-
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
42
|
+
query syntax. The following data types are indexed for search:
|
43
|
+
|
44
|
+
* _node_
|
45
|
+
* _role_
|
46
|
+
* _environment_
|
47
|
+
* _data bag_
|
48
|
+
|
49
|
+
Data bags are indexed by the data bag's name. For example, to search a
|
50
|
+
data bag named "admins":
|
51
|
+
|
52
|
+
knife search admins "field:search_pattern"
|
53
|
+
|
54
|
+
## QUERY SYNTAX
|
55
|
+
|
56
|
+
Queries have the form `field:search_pattern` where `field` is a key in
|
57
|
+
the JSON description of the relevant objects (nodes, roles,
|
58
|
+
environments, or data bags). Both `field` and `search_pattern` are
|
59
|
+
case-sensitive. `search_pattern` can be an exact, wildcard,
|
60
|
+
range, or fuzzy match (see below). The `field` supports exact
|
61
|
+
matching and limited wildcard matching.
|
62
|
+
|
63
|
+
Searches will return the relevant objects (nodes, roles, environments,
|
64
|
+
or data bags) where the `search_pattern` matches the object's value of
|
65
|
+
`field`.
|
66
|
+
|
67
|
+
### FIELD NAMES
|
68
|
+
|
69
|
+
Field names are the keys within the JSON description of the object
|
70
|
+
being searched. Nested Keys can be searched by placing an underscore
|
71
|
+
("_") between key names.
|
72
|
+
|
73
|
+
#### WILDCARD MATCHING FOR FIELD NAMES
|
74
|
+
|
75
|
+
The field name also has limited support for wildcard matching. Both
|
76
|
+
the "*" and "?" wildcards (see below) can be used within a field name;
|
77
|
+
however, they cannot be the first character of the field name.
|
78
|
+
|
79
|
+
### EXACT MATCHES
|
80
|
+
Without any search modifiers, a search returns those fields for which
|
81
|
+
the `search_pattern` exactly matches the value of `field` in the JSON
|
82
|
+
description of the object.
|
83
|
+
|
84
|
+
### WILDCARD MATCHES
|
85
|
+
|
86
|
+
Search support both single- and multi-character wildcard searches
|
87
|
+
within a search pattern.
|
88
|
+
|
89
|
+
'?' matches exactly one character.
|
90
|
+
|
91
|
+
'*' matches zero or more characters.
|
92
|
+
|
93
|
+
### RANGE MATCHES
|
94
|
+
Range searches allows one to match values between two given values. To
|
95
|
+
match values between X and Y, inclusively, use square brackets:
|
96
|
+
|
97
|
+
knife search INDEX 'field:[X TO Y]
|
98
|
+
|
99
|
+
To match values between X and Y, exclusively, use curly brackets:
|
100
|
+
|
101
|
+
knife search INDEX 'field:{X TO Y}'
|
102
|
+
|
103
|
+
Values are sorted in lexicographic order.
|
104
|
+
|
105
|
+
### FUZZY MATCHES
|
36
106
|
|
37
|
-
|
107
|
+
Fuzzy searches allows one to match values based on the Levenshtein
|
108
|
+
Distance algorithm. To perform a fuzzy match, append a tilda (~) to
|
109
|
+
the search term:
|
110
|
+
|
111
|
+
knife search nodes 'field:term~'
|
112
|
+
|
113
|
+
This search would return nodes whose `field` was 'perm' or 'germ'.
|
114
|
+
|
115
|
+
### BOOLEAN OPERATORS
|
116
|
+
|
117
|
+
The boolean operators NOT, AND, and OR are supported. To find values
|
118
|
+
of `field` that are not X:
|
119
|
+
|
120
|
+
knife search INDEX 'field:(NOT X)'
|
121
|
+
|
122
|
+
To find records where `field1` is X and `field2` is Y:
|
123
|
+
|
124
|
+
knife search INDEX 'field1:X AND field2:Y'
|
125
|
+
|
126
|
+
To find records where `field` is X or Y:
|
127
|
+
|
128
|
+
knife search INDEX 'field:X OR field:Y'
|
129
|
+
|
130
|
+
### QUOTING AND SPECIAL CHARACTERS
|
131
|
+
|
132
|
+
In order to avoid having special characters and escape sequences
|
133
|
+
within your search term interpreted by either Ruby or the shell,
|
134
|
+
enclose them in single quotes.
|
135
|
+
|
136
|
+
Search terms that include spaces should be enclosed in double-quotes:
|
137
|
+
|
138
|
+
knife search INDEX 'field:"term with spaces"'
|
139
|
+
|
140
|
+
The following characters must be escaped:
|
141
|
+
|
142
|
+
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \
|
38
143
|
|
39
144
|
## EXAMPLES
|
40
145
|
|
146
|
+
Find the nodes with the fully-qualified domain name (FQDN)
|
147
|
+
www.example.com:
|
148
|
+
|
149
|
+
knife search nodes 'fqdn:www.example.com'
|
150
|
+
|
151
|
+
Find the nodes running a version of Ubuntu:
|
152
|
+
|
153
|
+
knife search nodes 'platform:ubuntu*'
|
154
|
+
|
155
|
+
Find all nodes running CentOS in the production environment:
|
156
|
+
|
157
|
+
knife search nodes 'chef_environment:production AND platform:centos'
|
158
|
+
|
159
|
+
## KNOWN BUGS
|
160
|
+
|
161
|
+
* Searches against the client index return no results in most cases. (CHEF-2477)
|
162
|
+
* Searches using the fuzzy match operator (~) produce an error. (CHEF-2478)
|
163
|
+
|
41
164
|
## SEE ALSO
|
42
165
|
__knife-ssh__(1)
|
43
166
|
<http://wiki.opscode.com/display/chef/Attributes>
|
167
|
+
[Lucene Query Parser Syntax](http://lucene.apache.org/java/2_3_2/queryparsersyntax.html)
|
44
168
|
|
45
169
|
## AUTHOR
|
46
170
|
Chef was written by Adam Jacob <adam@opscode.com> with many contributions from the community.
|
@@ -19,6 +19,8 @@
|
|
19
19
|
require 'chef/provider/package'
|
20
20
|
require 'chef/mixin/command'
|
21
21
|
require 'chef/resource/package'
|
22
|
+
require 'chef/mixin/shell_out'
|
23
|
+
|
22
24
|
|
23
25
|
class Chef
|
24
26
|
class Provider
|
@@ -39,36 +41,44 @@ class Chef
|
|
39
41
|
Chef::Log.debug("#{@new_resource} checking package status for #{package}")
|
40
42
|
installed = false
|
41
43
|
|
42
|
-
shell_out!("
|
44
|
+
shell_out!("apt-cache policy #{package}").stdout.each_line do |line|
|
43
45
|
case line
|
44
|
-
when
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
when /^Version: (.*)/
|
49
|
-
@candidate_version = $1
|
50
|
-
if installed
|
51
|
-
@current_resource.version($1)
|
52
|
-
else
|
46
|
+
when /^\s{2}Installed: (.+)$/
|
47
|
+
installed_version = $1
|
48
|
+
if installed_version == '(none)'
|
49
|
+
Chef::Log.debug("#{@new_resource} current version is nil")
|
53
50
|
@current_resource.version(nil)
|
51
|
+
else
|
52
|
+
Chef::Log.debug("#{@new_resource} current version is #{installed_version}")
|
53
|
+
@current_resource.version(installed_version)
|
54
|
+
installed = true
|
55
|
+
end
|
56
|
+
when /^\s{2}Candidate: (.+)$/
|
57
|
+
candidate_version = $1
|
58
|
+
if candidate_version == '(none)'
|
59
|
+
# This may not be an appropriate assumption, but it shouldn't break anything that already worked -- btm
|
60
|
+
@is_virtual_package = true
|
61
|
+
showpkg = shell_out!("apt-cache showpkg #{package}").stdout
|
62
|
+
providers = Hash.new
|
63
|
+
showpkg.rpartition(/Reverse Provides:? #{$/}/)[2].each_line do |line|
|
64
|
+
provider, version = line.split
|
65
|
+
providers[provider] = version
|
66
|
+
end
|
67
|
+
# Check if the package providing this virtual package is installed
|
68
|
+
num_providers = providers.length
|
69
|
+
raise Chef::Exceptions::Package, "#{@new_resource.package_name} has no candidate in the apt-cache" if num_providers == 0
|
70
|
+
# apt will only install a virtual package if there is a single providing package
|
71
|
+
raise Chef::Exceptions::Package, "#{@new_resource.package_name} is a virtual package provided by #{num_providers} packages, you must explicitly select one to install" if num_providers > 1
|
72
|
+
# Check if the package providing this virtual package is installed
|
73
|
+
Chef::Log.info("#{@new_resource} is a virtual package, actually acting on package[#{providers.keys.first}]")
|
74
|
+
installed = check_package_state(providers.keys.first)
|
75
|
+
else
|
76
|
+
Chef::Log.debug("#{@new_resource} candidate version is #{$1}")
|
77
|
+
@candidate_version = $1
|
54
78
|
end
|
55
|
-
# If we are a virtual package with one provider package, install it
|
56
|
-
when /^Provided by: ([\w\d\-\.]*)$/
|
57
|
-
next unless @is_virtual_package
|
58
|
-
virtual_provider = $1
|
59
|
-
Chef::Log.info("#{@new_resource} is a virtual package, actually acting on package[#{virtual_provider}]")
|
60
|
-
installed = check_package_state(virtual_provider)
|
61
|
-
# If there is a comma, it is a list of packages. In this case fail to force the user to choose.
|
62
|
-
when /^Provided by: .*,/
|
63
|
-
next unless @is_virtual_package
|
64
|
-
raise Chef::Exceptions::Package, "#{@new_resource.package_name} is a virtual package provided by multiple packages, you must explicitly select one to install"
|
65
79
|
end
|
66
80
|
end
|
67
81
|
|
68
|
-
if @candidate_version.nil?
|
69
|
-
raise Chef::Exceptions::Package, "apt does not have a version of package #{@new_resource.package_name}"
|
70
|
-
end
|
71
|
-
|
72
82
|
return installed
|
73
83
|
end
|
74
84
|
|