mixlib-install 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +12 -1
- data/lib/mixlib/install/backend/package_router.rb +19 -3
- data/lib/mixlib/install/options.rb +16 -0
- data/lib/mixlib/install/product.rb +26 -8
- data/lib/mixlib/install/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4893a11fa816d4a5f41a23ba5fc240581814e01c
|
4
|
+
data.tar.gz: b63a27ed56a22506d8d239e94fdaa5996a86d316
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e4fa265d321456e0eb32c805680965ba28b1022794863bdf4a8d2e82cb2bb86e2ebd567b1a909925255ad94b070623db658c49bb498b63d4d6c4ec2049b4eab
|
7
|
+
data.tar.gz: aff7a8bdfa4fd774209e0cca484304eddcae3e3af35ca55e41f50b1826a64781470486b73cdf2c312148f49a0246f4ccbc51e0a99e34d735e490caad11fc3fa7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -103,11 +103,22 @@ Mixlib::Install.available_versions("chef", "stable")
|
|
103
103
|
# => ["12.13.3", "12.13.7"]
|
104
104
|
```
|
105
105
|
|
106
|
+
### User-Agent Request Headers
|
107
|
+
By default, all requests made by `mixlib-install` will include a `User-Agent` request header as `mixlib-install/<version>`.
|
108
|
+
Additional `User-Agent` request headers can be added by setting the `user_agent_headers` option.
|
109
|
+
When you want to identify a product using mixlib-install as a dependency we recommend the format `product/version`.
|
110
|
+
```ruby
|
111
|
+
options = {
|
112
|
+
channel: :stable,
|
113
|
+
product_name: 'chef',
|
114
|
+
user_agent_headers: ["my_product/1.2.3", "somethingelse"],
|
115
|
+
}
|
116
|
+
```
|
117
|
+
|
106
118
|
### Collecting Software Dependencies and License Content
|
107
119
|
Collecting software dependencies and license content for ArtifactInfo instances
|
108
120
|
requires additional requests to the repository server. By default, collection is disabled.
|
109
121
|
To return data for instance methods `software_dependencies` and `license_content`, the `include_metadata` option must be enabled.
|
110
|
-
|
111
122
|
```
|
112
123
|
options = {
|
113
124
|
channel: :current,
|
@@ -147,16 +147,32 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
|
|
147
147
|
uri = URI.parse(endpoint)
|
148
148
|
http = Net::HTTP.new(uri.host, uri.port)
|
149
149
|
http.use_ssl = (uri.scheme == "https")
|
150
|
-
|
151
150
|
full_path = File.join(uri.path, url)
|
152
|
-
request = Net::HTTP::Get.new(full_path)
|
153
151
|
|
154
|
-
res = http.request(
|
152
|
+
res = http.request(create_http_request(full_path))
|
155
153
|
|
156
154
|
res.value
|
157
155
|
JSON.parse(res.body)
|
158
156
|
end
|
159
157
|
|
158
|
+
def create_http_request(full_path)
|
159
|
+
require "mixlib/install/version"
|
160
|
+
|
161
|
+
request = Net::HTTP::Get.new(full_path)
|
162
|
+
|
163
|
+
user_agents = ["mixlib-install/#{Mixlib::Install::VERSION}"]
|
164
|
+
|
165
|
+
if options.user_agent_headers
|
166
|
+
options.user_agent_headers.each do |header|
|
167
|
+
user_agents << header
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
request.add_field("User-Agent", user_agents.join(" "))
|
172
|
+
|
173
|
+
request
|
174
|
+
end
|
175
|
+
|
160
176
|
def create_artifact(artifact_map)
|
161
177
|
# set normalized platform and platform version
|
162
178
|
platform, platform_version = normalize_platform(
|
@@ -39,6 +39,7 @@ module Mixlib
|
|
39
39
|
:shell_type,
|
40
40
|
:platform_version_compatibility_mode,
|
41
41
|
:include_metadata,
|
42
|
+
:user_agent_headers,
|
42
43
|
]
|
43
44
|
|
44
45
|
def initialize(options)
|
@@ -57,6 +58,7 @@ module Mixlib
|
|
57
58
|
errors << validate_product_names
|
58
59
|
errors << validate_channels
|
59
60
|
errors << validate_shell_type
|
61
|
+
errors << validate_user_agent_headers
|
60
62
|
|
61
63
|
unless errors.compact.empty?
|
62
64
|
raise InvalidOptions, errors.join("\n")
|
@@ -132,6 +134,20 @@ Must be one of: #{SUPPORTED_SHELL_TYPES.join(", ")}
|
|
132
134
|
end
|
133
135
|
end
|
134
136
|
|
137
|
+
def validate_user_agent_headers
|
138
|
+
error = nil
|
139
|
+
if user_agent_headers
|
140
|
+
if user_agent_headers.is_a? Array
|
141
|
+
user_agent_headers.each do |header|
|
142
|
+
error = "user agent headers can not have spaces." if header.include?(" ")
|
143
|
+
end
|
144
|
+
else
|
145
|
+
error = "user_agent_headers must be an Array."
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
error
|
150
|
+
end
|
135
151
|
end
|
136
152
|
end
|
137
153
|
end
|
@@ -29,6 +29,8 @@ module Mixlib
|
|
29
29
|
:ctl_command,
|
30
30
|
:package_name,
|
31
31
|
:product_name,
|
32
|
+
:install_path,
|
33
|
+
:omnibus_project,
|
32
34
|
]
|
33
35
|
|
34
36
|
#
|
@@ -49,7 +51,7 @@ module Mixlib
|
|
49
51
|
if block.nil?
|
50
52
|
if prop_string.nil?
|
51
53
|
value = instance_variable_get("@#{prop}".to_sym)
|
52
|
-
return
|
54
|
+
return default_value_for(prop) if value.nil?
|
53
55
|
|
54
56
|
if value.is_a? String
|
55
57
|
value
|
@@ -67,14 +69,16 @@ module Mixlib
|
|
67
69
|
end
|
68
70
|
|
69
71
|
#
|
70
|
-
#
|
71
|
-
# package_name
|
72
|
+
# Return the default values for DSL properties
|
72
73
|
#
|
73
|
-
def
|
74
|
-
|
75
|
-
|
74
|
+
def default_value_for(prop)
|
75
|
+
case prop
|
76
|
+
when :install_path
|
77
|
+
"/opt/#{package_name}"
|
78
|
+
when :omnibus_project
|
79
|
+
package_name
|
76
80
|
else
|
77
|
-
|
81
|
+
nil
|
78
82
|
end
|
79
83
|
end
|
80
84
|
|
@@ -217,7 +221,20 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
|
|
217
221
|
end
|
218
222
|
omnibus_project "chef-server"
|
219
223
|
ctl_command "chef-server-ctl"
|
220
|
-
config_file
|
224
|
+
config_file do |v|
|
225
|
+
if (v < version_for("12.0.0")) && (v > version_for("11.0.0"))
|
226
|
+
"/etc/chef-server/chef-server.rb"
|
227
|
+
else
|
228
|
+
"/etc/opscode/chef-server.rb"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
install_path do |v|
|
232
|
+
if (v < version_for("12.0.0")) && (v > version_for("11.0.0"))
|
233
|
+
"/opt/chef-server"
|
234
|
+
else
|
235
|
+
"/opt/opscode"
|
236
|
+
end
|
237
|
+
end
|
221
238
|
end
|
222
239
|
|
223
240
|
product "chef-server-ha-provisioning" do
|
@@ -294,6 +311,7 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
|
|
294
311
|
package_name "private-chef"
|
295
312
|
ctl_command "private-chef-ctl"
|
296
313
|
config_file "/etc/opscode/private-chef.rb"
|
314
|
+
install_path "/opt/opscode"
|
297
315
|
end
|
298
316
|
|
299
317
|
product "push-jobs-client" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-install
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thom May
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: artifactory
|