mixlib-install 0.8.0.alpha.7 → 0.8.0.alpha.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09578e7ebe6313ee2b4319317af109fed364e46e
4
- data.tar.gz: 0a3a8c4bf55672a723c1576a5ebadbc883cde6de
3
+ metadata.gz: fe243313ad84e3ae88dc0708806eb15c43f76a11
4
+ data.tar.gz: 470d541528a8c2d1f7147632f43a1e932e7dd875
5
5
  SHA512:
6
- metadata.gz: 5e87fb189a92b2dbd3d03ee680cadf47385c2ded328242e524fb620ac6e3c62cf17741a62f4b6ff3c3794ad89e5768e081318057421d6ad7bcab794a0c0996a4
7
- data.tar.gz: 8342b80c4decd0db0640e4899e41d22ecb5fbe39aa4e90bd0caa58a366100c5386feabf4d3a628645b4a7945324e100a5a68b49d2bcc706cd3c3bbc1e98e92d8
6
+ metadata.gz: f5a37cf8df4a56bb141995f514899895a61634fa2bd7a8d09373bfd17cd95709411c32017991867caccb61ab96e860cadbdfc5ae0accd59ce961e5209d933bc7
7
+ data.tar.gz: 94cf89573f423781f835a31ec99290b9fcefc71758c44ee7b18142c112b1ba18bd7852ac32390f56906ef968755aced6830486ed79569796eca47cfa006071f3
data/PRODUCT_MATRIX.md CHANGED
@@ -5,21 +5,21 @@
5
5
  | Angry Chef Client | angrychef |
6
6
  | Chef Client | chef |
7
7
  | Chef Backend | chef-backend |
8
- | Chef Server High Availability addon | chef-ha |
9
- | Chef Cloud Marketplace addon | chef-marketplace |
10
8
  | Chef Server | chef-server |
11
9
  | Chef Server HA Provisioning for AWS | chef-server-ha-provisioning |
12
- | Chef Server Replication addon | chef-sync |
13
10
  | Chef Development Kit | chefdk |
14
11
  | Chef Compliance | compliance |
15
12
  | Delivery | delivery |
16
13
  | Delivery CLI | delivery-cli |
14
+ | Chef Server High Availability addon | ha |
17
15
  | Management Console | manage |
16
+ | Chef Cloud Marketplace addon | marketplace |
18
17
  | Omnibus Toolchain | omnibus-toolchain |
19
18
  | Enterprise Chef (legacy) | private-chef |
20
- | Chef Push Server | push-client |
21
- | Chef Push Server | push-server |
19
+ | Chef Push Server | push-jobs-client |
20
+ | Chef Push Server | push-jobs-server |
22
21
  | Chef Server Reporting addon | reporting |
23
22
  | Supermarket | supermarket |
23
+ | Chef Server Replication addon | sync |
24
24
 
25
25
  Do not modify this file manually. It is automatically rendered via a rake task.
data/config.ru ADDED
@@ -0,0 +1,7 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+
4
+ Bundler.require
5
+
6
+ require_relative "spec/support/bintray_server"
7
+ run BintrayServer
@@ -19,19 +19,21 @@
19
19
  module Mixlib
20
20
  class Install
21
21
  class ArtifactInfo
22
- attr_accessor :url
23
- attr_accessor :md5
24
- attr_accessor :sha256
25
- attr_accessor :version
22
+ attr_reader :url
23
+ attr_reader :md5
24
+ attr_reader :sha256
25
+ attr_reader :sha1
26
+ attr_reader :version
26
27
 
27
- attr_accessor :platform
28
- attr_accessor :platform_version
29
- attr_accessor :architecture
28
+ attr_reader :platform
29
+ attr_reader :platform_version
30
+ attr_reader :architecture
30
31
 
31
32
  def initialize(data)
32
33
  @url = data[:url]
33
34
  @md5 = data[:md5]
34
35
  @sha256 = data[:sha256]
36
+ @sha1 = data[:sha1]
35
37
  @version = data[:version]
36
38
  @platform = data[:platform]
37
39
  @platform_version = data[:platform_version]
@@ -65,6 +67,7 @@ module Mixlib
65
67
  url: url,
66
68
  md5: md5,
67
69
  sha256: sha256,
70
+ sha1: sha1,
68
71
  version: version,
69
72
  platform: platform,
70
73
  platform_version: platform_version,
@@ -18,15 +18,16 @@
18
18
 
19
19
  require "mixlib/install/backend/omnitruck"
20
20
  require "mixlib/install/backend/artifactory"
21
+ require "mixlib/install/backend/bintray"
21
22
 
22
23
  module Mixlib
23
24
  class Install
24
25
  class Backend
25
26
  def self.info(options)
26
- backend = if options.for_omnitruck?
27
- Backend::Omnitruck.new(options)
28
- elsif options.for_artifactory?
27
+ backend = if options.for_artifactory?
29
28
  Backend::Artifactory.new(options)
29
+ else
30
+ Backend::Omnitruck.new(options)
30
31
  end
31
32
 
32
33
  backend.info
@@ -20,23 +20,18 @@ require "net/http"
20
20
  require "json"
21
21
  require "mixlib/install/artifact_info"
22
22
  require "artifactory"
23
+ require "mixlib/install/backend/base"
23
24
 
24
25
  module Mixlib
25
26
  class Install
26
27
  class Backend
27
- class Artifactory
28
+ class Artifactory < Base
28
29
  class ConnectionError < StandardError; end
29
30
  class AuthenticationError < StandardError; end
30
31
  class NoArtifactsError < StandardError; end
31
32
 
32
33
  ENDPOINT = "http://artifactory.chef.co".freeze
33
34
 
34
- attr_accessor :options
35
-
36
- def initialize(options)
37
- @options = options
38
- end
39
-
40
35
  # Create filtered list of artifacts
41
36
  #
42
37
  # @return [Array<ArtifactInfo>] list of artifacts for the configured
@@ -109,13 +104,14 @@ Can not find any builds for #{options.product_name} in #{::Artifactory.endpoint}
109
104
  #
110
105
  # @return [Array<ArtifactInfo>] Array of info about found artifacts
111
106
  def artifactory_artifacts(version)
112
- results = artifactory_query(<<-QUERY)
107
+ results = artifactory_query(<<-QUERY
113
108
  items.find(
114
109
  {"repo": "omnibus-#{options.channel}-local"},
115
110
  {"@omnibus.project": "#{options.product_name}"},
116
111
  {"@omnibus.version": "#{version}"}
117
112
  ).include("repo", "path", "name", "property")
118
113
  QUERY
114
+ )
119
115
 
120
116
  # Merge artifactory properties and downloadUri to a flat Hash
121
117
  results.collect! do |result|
@@ -191,16 +187,16 @@ items.find(
191
187
  begin
192
188
  results = yield
193
189
  rescue Errno::ETIMEDOUT, ::Artifactory::Error::ConnectionError
194
- raise ConnectionError, <<-EOS
195
- Artifactory endpoint '#{::Artifactory.endpoint}' is unreachable. Check that
190
+ raise ConnectionError, <<-MSG
191
+ Artifactory endpoint '#{endpoint}' is unreachable. Check that
196
192
  the endpoint is correct and there is an open connection to Chef's private network.
197
- EOS
193
+ MSG
198
194
  rescue ::Artifactory::Error::HTTPError => e
199
195
  if e.code == 401 && e.message =~ /Bad credentials/
200
- raise AuthenticationError, <<-EOS
196
+ raise AuthenticationError, <<-MSG
201
197
  Artifactory server denied credentials. Verify ARTIFACTORY_USERNAME and
202
198
  ARTIFACTORY_PASSWORD environment variables are configured properly.
203
- EOS
199
+ MSG
204
200
  else
205
201
  raise e
206
202
  end
@@ -0,0 +1,39 @@
1
+ #
2
+ # Author:: Patrick Wright (<patrick@chef.io>)
3
+ # Copyright:: Copyright (c) 2016 Chef, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ module Mixlib
20
+ class Install
21
+ class Backend
22
+ class Base
23
+ attr_reader :options
24
+
25
+ def initialize(options)
26
+ @options = options
27
+ end
28
+
29
+ def info
30
+ raise "Must implement info method that returns ArtifactInfo or Array<ArtifactInfo>"
31
+ end
32
+
33
+ def endpoint
34
+ raise "Must implement endpoint method that returns endpoint String"
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,266 @@
1
+ #
2
+ # Author:: Patrick Wright (<patrick@chef.io>)
3
+ # Copyright:: Copyright (c) 2016 Chef, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require "json"
20
+ require "mixlib/install/backend/base"
21
+ require "mixlib/install/artifact_info"
22
+
23
+ #
24
+ # Add method to Array class to support
25
+ # searching for substrings that match against
26
+ # the items in the Array
27
+ #
28
+ class Array
29
+ def fuzzy_include?(search_value, regex_format = "%s")
30
+ inject(false) do |is_found, array_value|
31
+ is_found || !!(search_value =~ /#{regex_format % array_value}/)
32
+ end
33
+ end
34
+ end
35
+
36
+ module Mixlib
37
+ class Install
38
+ class Backend
39
+ class Bintray < Base
40
+ class UnknownArchitecture < StandardError; end
41
+
42
+ ENDPOINT = "https://bintray.com/api/v1/".freeze
43
+
44
+ # Bintray credentials for api read access. These are here intentionally.
45
+ BINTRAY_USERNAME = "mixlib-install@chef".freeze
46
+
47
+ BINTRAY_PASSWORD = "a83d3a2ffad50eb9a2230f281a2e19b70fe0db2d".freeze
48
+
49
+ DOWNLOAD_URL_ENDPOINT = "https://packages.chef.io".freeze
50
+
51
+ def endpoint
52
+ @endpoint ||= ENV.fetch("BINTRAY_ENDPOINT", ENDPOINT)
53
+ end
54
+
55
+ # Create filtered list of artifacts
56
+ #
57
+ # @return [Array<ArtifactInfo>] list of artifacts for the configured
58
+ # channel, product name, and product version.
59
+ # @return [ArtifactInfo] arifact info for the configured
60
+ # channel, product name, product version and platform info
61
+ #
62
+ def info
63
+ artifacts = bintray_artifacts
64
+
65
+ if options.platform
66
+ artifacts.select! do |a|
67
+ a.platform == options.platform &&
68
+ a.platform_version == options.platform_version &&
69
+ a.architecture == options.architecture
70
+ end
71
+ end
72
+
73
+ artifacts.length == 1 ? artifacts.first : artifacts
74
+ end
75
+
76
+ #
77
+ # Makes a GET request to bintray for the given path.
78
+ #
79
+ # @param [String] path
80
+ # "/api/v1/packages/chef" is prepended to the given path.
81
+ #
82
+ # @return [String] JSON parsed string of the bintray response
83
+ #
84
+ def bintray_get(path)
85
+ uri = URI.parse(endpoint)
86
+ http = Net::HTTP.new(uri.host, uri.port)
87
+ http.use_ssl = (uri.scheme == "https")
88
+
89
+ full_path = File.join(uri.path, "packages/chef", path)
90
+ request = Net::HTTP::Get.new(full_path)
91
+ request.basic_auth(BINTRAY_USERNAME, BINTRAY_PASSWORD)
92
+
93
+ res = http.request(request)
94
+
95
+ # Raise if response is not 2XX
96
+ res.value
97
+ JSON.parse(res.body)
98
+ end
99
+
100
+ #
101
+ # Get latest version for product/channel
102
+ #
103
+ # @return [String] latest version value
104
+ #
105
+ def latest_version
106
+ result = bintray_get("#{options.channel}/#{options.product_name}/versions/_latest")
107
+ result["name"]
108
+ end
109
+
110
+ #
111
+ # Get artifacts for a given version, channel and product_name
112
+ #
113
+ # @return [Array<ArtifactInfo>] Array of info about found artifacts
114
+ #
115
+ def bintray_artifacts
116
+ version = options.product_version == :latest ? latest_version : options.product_version
117
+ results = bintray_get("#{options.channel}/#{options.product_name}/versions/#{version}/files")
118
+
119
+ #
120
+ # Delete .asc files
121
+ # Also delete .pkg files which are uploaded along with dmg files for
122
+ # some chef versions.
123
+ #
124
+ results.reject! do |r|
125
+ r["name"].end_with?(".asc") || r["name"].end_with?(".pkg")
126
+ end
127
+
128
+ # Convert results to build records
129
+ results.map { |a| create_artifact(a) }
130
+ end
131
+
132
+ #
133
+ # Creates an instance of ArtifactInfo
134
+ #
135
+ # @param artifact_map
136
+ # {
137
+ # "name" => "chef-12.8.1-1.powerpc.bff",
138
+ # "path" => "aix/6.1/chef-12.8.1-1.powerpc.bff",
139
+ # "version" => "12.8.1",
140
+ # "sha1" => "1206f7be7be8bbece1e9943dcdc0d22fe538718b",
141
+ # "sha256" => "e49321095a04f51385a59b3f3d7223cd1bddefc2e2f4280edfb0934d00a4fa3f"
142
+ # }
143
+ #
144
+ # @return [ArtifactInfo] ArtifactInfo instance
145
+ #
146
+ def create_artifact(artifact_map)
147
+ platform_info = parse_platform_info(artifact_map)
148
+
149
+ url = "#{DOWNLOAD_URL_ENDPOINT}/#{options.channel}/#{artifact_map["path"]}"
150
+
151
+ ArtifactInfo.new(
152
+ sha1: artifact_map["sha1"],
153
+ sha256: artifact_map["sha256"],
154
+ version: artifact_map["version"],
155
+ platform: platform_info[:platform],
156
+ platform_version: platform_info[:platform_version],
157
+ architecture: platform_info[:architecture],
158
+ url: url
159
+ )
160
+ end
161
+
162
+ #
163
+ # Parses platform info
164
+ #
165
+ # @param artifact_map
166
+ # {
167
+ # "name" => "chef-12.8.1-1.powerpc.bff",
168
+ # "path" => "aix/6.1/chef-12.8.1-1.powerpc.bff",
169
+ # "version" => "12.8.1",
170
+ # "sha1" => "1206f7be7be8bbece1e9943dcdc0d22fe538718b",
171
+ # "sha256" => "e49321095a04f51385a59b3f3d7223cd1bddefc2e2f4280edfb0934d00a4fa3f"
172
+ # }
173
+ #
174
+ # @return [Hash] platform, platform_version, architecture
175
+ #
176
+ def parse_platform_info(artifact_map)
177
+ # platform/platform_version/filename
178
+ path = artifact_map["path"].split("/")
179
+ platform = path[0]
180
+ platform_version = path[1]
181
+
182
+ filename = artifact_map["name"]
183
+ architecture = parse_architecture_from_file_name(filename)
184
+
185
+ {
186
+ platform: platform,
187
+ platform_version: platform_version,
188
+ architecture: architecture,
189
+ }
190
+ end
191
+
192
+ #
193
+ # Determines the architecture for which a file is published from from
194
+ # filename.
195
+ #
196
+ # We determine the architecture based on the filename of the artifact
197
+ # since architecture the artifact is published for is not available
198
+ # in bintray.
199
+ #
200
+ # IMPORTANT: This function is heavily used by omnitruck poller. Make
201
+ # sure you test with `./poller` if you change this function.
202
+ #
203
+ # @param [String] filename
204
+ #
205
+ # @return [String]
206
+ # one of the standardized architectures for Chef packages:
207
+ # x86_64, i386, powerpc, sparc, ppc64, ppc64le
208
+ def parse_architecture_from_file_name(filename)
209
+ #
210
+ # We first map the different variations of architectures that we have
211
+ # used historically to our final set.
212
+ #
213
+ if %w{ x86_64 amd64 x64 }.fuzzy_include?(filename)
214
+ "x86_64"
215
+ elsif %w{ i386 x86 i86pc i686 }.fuzzy_include?(filename)
216
+ "i386"
217
+ elsif %w{ powerpc }.fuzzy_include?(filename)
218
+ "powerpc"
219
+ elsif %w{ sparc sun4u sun4v }.fuzzy_include?(filename)
220
+ "sparc"
221
+ # Note that ppc64le should come before ppc64 otherwise our search
222
+ # will think ppc64le matches ppc64.
223
+ elsif %w{ ppc64le }.fuzzy_include?(filename)
224
+ "ppc64le"
225
+ elsif %w{ ppc64 }.fuzzy_include?(filename)
226
+ "ppc64"
227
+ #
228
+ # From here on we need to deal with historical versions
229
+ # that we have published without any architecture in their
230
+ # names.
231
+ #
232
+ #
233
+ # All dmg files are published for x86_64
234
+ elsif filename.end_with?(".dmg")
235
+ "x86_64"
236
+ #
237
+ # The msi files we catch here are versions that are older than the
238
+ # ones which we introduced 64 builds. Therefore they should map to
239
+ # i386
240
+ elsif filename.end_with?(".msi")
241
+ "i386"
242
+ #
243
+ # sh files are the packaging format we were using before dmg on Mac.
244
+ # They map to x86_64
245
+ elsif filename.end_with?(".sh")
246
+ "x86_64"
247
+ #
248
+ # We have two common file names for solaris packages. E.g:
249
+ # chef-11.12.8-2.solaris2.5.10.solaris
250
+ # chef-11.12.8-2.solaris2.5.9.solaris
251
+ # These were build on two boxes:
252
+ # Solaris 9 => sparc
253
+ # Solaris 10 => i386
254
+ elsif filename.end_with?(".solaris2.5.10.solaris")
255
+ "i386"
256
+ elsif filename.end_with?(".solaris2.5.9.solaris")
257
+ "sparc"
258
+ else
259
+ raise UnknownArchitecture,
260
+ "architecture can not be determined for '#{filename}'"
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
@@ -19,17 +19,16 @@
19
19
  require "net/http"
20
20
  require "json"
21
21
  require "mixlib/install/artifact_info"
22
+ require "mixlib/install/backend/base"
22
23
 
23
24
  module Mixlib
24
25
  class Install
25
26
  class Backend
26
- class Omnitruck
27
+ class Omnitruck < Base
27
28
  ENDPOINT = "https://omnitruck.chef.io/".freeze
28
29
 
29
- attr_accessor :options
30
-
31
- def initialize(options)
32
- @options = options
30
+ def endpoint
31
+ @endpoint ||= ENV.fetch("OMNITRUCK_ENDPOINT", ENDPOINT)
33
32
  end
34
33
 
35
34
  def info
@@ -55,7 +54,7 @@ module Mixlib
55
54
  private
56
55
 
57
56
  def omnitruck_get(resource, parameters)
58
- uri = URI.parse(ENDPOINT)
57
+ uri = URI.parse(endpoint)
59
58
  http = Net::HTTP.new(uri.host, uri.port)
60
59
  http.use_ssl = (uri.scheme == "https")
61
60
 
@@ -12,7 +12,6 @@
12
12
  # Outputs:
13
13
  # $download_url:
14
14
  # $sha256:
15
- # $md5:
16
15
  ############
17
16
 
18
17
  <% artifacts.each do |artifact| %>
@@ -20,7 +19,6 @@
20
19
  mkdir -p $artifact_info_dir
21
20
  touch "$artifact_info_dir/artifact_info"
22
21
  echo "url <%= artifact.url%>" >> "$artifact_info_dir/artifact_info"
23
- echo "md5 <%= artifact.md5%>" >> "$artifact_info_dir/artifact_info"
24
22
  echo "sha256 <%= artifact.sha256%>" >> "$artifact_info_dir/artifact_info"
25
23
  <% end %>
26
24
 
@@ -28,4 +26,3 @@ artifact_info_for_platform="$tmp_dir/artifact_info/$platform/$platform_version/$
28
26
 
29
27
  download_url=`awk '$1 == "url" { print $2 }' "$artifact_info_for_platform"`
30
28
  sha256=`awk '$1 == "sha256" { print $2 }' "$artifact_info_for_platform"`
31
- md5=`awk '$1 == "md5" { print $2 }' "$artifact_info_for_platform"`
@@ -15,7 +15,6 @@
15
15
  # Outputs:
16
16
  # $download_url:
17
17
  # $sha256:
18
- # $md5:
19
18
  ############
20
19
 
21
20
  echo "Getting information for $project $channel $version for $platform..."
@@ -29,7 +28,7 @@ cat "$metadata_filename"
29
28
 
30
29
  echo ""
31
30
  # check that all the mandatory fields in the downloaded metadata are there
32
- if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null && grep '^md5' $metadata_filename > /dev/null; then
31
+ if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null; then
33
32
  echo "downloaded metadata file looks valid..."
34
33
  else
35
34
  echo "downloaded metadata file is corrupted or an uncaught error was encountered in downloading the file..."
@@ -41,7 +40,6 @@ fi
41
40
 
42
41
  download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"`
43
42
  sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"`
44
- md5=`awk '$1 == "md5" { print $2 }' "$metadata_filename"`
45
43
 
46
44
  ############
47
45
  # end of fetch_metadata.sh
@@ -34,7 +34,7 @@ download_dir=`dirname $download_filename`
34
34
  cached_file_available="false"
35
35
  if test -f $download_filename; then
36
36
  echo "$download_filename already exists, verifiying checksum..."
37
- if do_checksum "$download_filename" "$sha256" "$md5"; then
37
+ if do_checksum "$download_filename" "$sha256"; then
38
38
  echo "checksum compare succeeded, using existing file!"
39
39
  cached_file_available="true"
40
40
  else
@@ -45,7 +45,7 @@ fi
45
45
  # download if no local version of the file available
46
46
  if test "x$cached_file_available" != "xtrue"; then
47
47
  do_download "$download_url" "$download_filename"
48
- do_checksum "$download_filename" "$sha256" "$md5" || checksum_mismatch
48
+ do_checksum "$download_filename" "$sha256" || checksum_mismatch
49
49
  fi
50
50
 
51
51
  ############
@@ -214,17 +214,8 @@ do_checksum() {
214
214
  echo "Comparing checksum with shasum..."
215
215
  checksum=`shasum -a 256 $1 | awk '{ print $1 }'`
216
216
  return `test "x$checksum" = "x$2"`
217
- elif exists md5sum; then
218
- echo "Comparing checksum with md5sum..."
219
- checksum=`md5sum $1 | awk '{ print $1 }'`
220
- return `test "x$checksum" = "x$3"`
221
- elif exists md5; then
222
- echo "Comparing checksum with md5..."
223
- # this is for md5 utility on MacOSX (OSX 10.6-10.10) and $4 is the correct field
224
- checksum=`md5 $1 | awk '{ print $4 }'`
225
- return `test "x$checksum" = "x$3"`
226
217
  else
227
- echo "WARNING: could not find a valid checksum program, pre-install shasum, md5sum or md5 in your O/S image to get valdation..."
218
+ echo "WARNING: could not find a valid checksum program, pre-install shasum or sha256sum in your O/S image to get valdation..."
228
219
  return 0
229
220
  fi
230
221
  }
@@ -89,11 +89,11 @@ module Mixlib
89
89
  end
90
90
 
91
91
  def render_command
92
- <<EOS
93
- install -project #{options.product_name} \
94
- -version #{product_version} \
95
- -channel #{options.channel}
96
- EOS
92
+ cmd = "install -project #{options.product_name}"
93
+ cmd << " -version #{product_version}"
94
+ cmd << " -channel #{options.channel}"
95
+ cmd << " -architecture #{options.architecture}" if options.architecture
96
+ cmd << "\n"
97
97
  end
98
98
  end
99
99
  end
@@ -7,11 +7,11 @@ function Get-ProjectMetadata {
7
7
  .EXAMPLE
8
8
  iex (new-object net.webclient).downloadstring('https://omnitruck.chef.io/install.ps1'); Get-ProjectMetadata -project chef -channel stable
9
9
 
10
- Gets the download url, MD5 checksum, and SHA256 checksum for the latest stable release of Chef.
10
+ Gets the download url and SHA256 checksum for the latest stable release of Chef.
11
11
  .EXAMPLE
12
12
  iex (irm 'https://omnitruck.chef.io/install.ps1'); Get-ProjectMetadata -project chefdk -channel stable -version 0.8.0
13
13
 
14
- Gets the download url, MD5 checksum, and SHA256 checksum for ChefDK 0.8.0.
14
+ Gets the download url and SHA256 checksum for ChefDK 0.8.0.
15
15
  #>
16
16
  [cmdletbinding()]
17
17
  param (
@@ -7,11 +7,11 @@ function Get-ProjectMetadata {
7
7
  .EXAMPLE
8
8
  iex (new-object net.webclient).downloadstring('https://omnitruck.chef.io/install.ps1'); Get-ProjectMetadata -project chef -channel stable
9
9
 
10
- Gets the download url, MD5 checksum, and SHA256 checksum for the latest stable release of Chef.
10
+ Gets the download url and SHA256 checksum for the latest stable release of Chef.
11
11
  .EXAMPLE
12
12
  iex (irm 'https://omnitruck.chef.io/install.ps1'); Get-ProjectMetadata -project chefdk -channel stable -version 0.8.0
13
13
 
14
- Gets the download url, MD5 checksum, and SHA256 checksum for ChefDK 0.8.0.
14
+ Gets the download url, and SHA256 checksum for ChefDK 0.8.0.
15
15
  #>
16
16
  [cmdletbinding()]
17
17
  param (
@@ -64,7 +64,6 @@ function Get-ProjectMetadata {
64
64
  New-Item -ItemType directory -Path $artifact_info_dir -force
65
65
  New-Item -ItemType file "$($artifact_info_dir)/artifact_info" -force
66
66
  "url <%= artifact.url%>" | out-file "$artifact_info_dir/artifact_info"
67
- "md5 <%= artifact.md5%>" | out-file "$artifact_info_dir/artifact_info" -Append
68
67
  "sha256 <%= artifact.sha256%>" | out-file "$artifact_info_dir/artifact_info" -Append
69
68
  <% end %>
70
69
 
@@ -16,6 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
+ require "mixlib/install/product"
19
20
  require "mixlib/versioning"
20
21
 
21
22
  module Mixlib
@@ -25,21 +26,11 @@ module Mixlib
25
26
  class ArtifactoryCredentialsNotFound < StandardError; end
26
27
 
27
28
  attr_reader :options
28
- attr_reader :defaults
29
29
 
30
30
  OMNITRUCK_CHANNELS = [:stable, :current]
31
31
  ARTIFACTORY_CHANNELS = [:unstable]
32
32
  ALL_SUPPORTED_CHANNELS = OMNITRUCK_CHANNELS + ARTIFACTORY_CHANNELS
33
- SUPPORTED_PRODUCT_NAMES = %w{
34
- angry-omnibus-toolchain
35
- angrychef
36
- chef
37
- chefdk
38
- chef-server
39
- delivery-cli
40
- omnibus-toolchain
41
- push-jobs-client
42
- }
33
+ SUPPORTED_PRODUCT_NAMES = PRODUCT_MATRIX.products
43
34
  SUPPORTED_SHELL_TYPES = [:ps1, :sh]
44
35
  SUPPORTED_OPTIONS = [
45
36
  :architecture,
@@ -53,9 +44,6 @@ module Mixlib
53
44
 
54
45
  def initialize(options)
55
46
  @options = options
56
- @defaults = {
57
- shell_type: :sh,
58
- }
59
47
 
60
48
  validate!
61
49
  end
@@ -70,7 +58,6 @@ module Mixlib
70
58
 
71
59
  errors << validate_product_names
72
60
  errors << validate_channels
73
- errors << validate_platform_info
74
61
  errors << validate_shell_type
75
62
 
76
63
  unless errors.compact.empty?
@@ -80,7 +67,7 @@ module Mixlib
80
67
 
81
68
  SUPPORTED_OPTIONS.each do |option|
82
69
  define_method option do
83
- options[option] || options[option.to_s] || defaults[option]
70
+ options[option] || options[option.to_s] || default_options[option]
84
71
  end
85
72
  end
86
73
 
@@ -88,6 +75,10 @@ module Mixlib
88
75
  ARTIFACTORY_CHANNELS.include?(channel)
89
76
  end
90
77
 
78
+ def for_bintray?
79
+ [:stable, :current].include?(channel)
80
+ end
81
+
91
82
  def for_omnitruck?
92
83
  OMNITRUCK_CHANNELS.include?(channel)
93
84
  end
@@ -115,6 +106,12 @@ module Mixlib
115
106
 
116
107
  private
117
108
 
109
+ def default_options
110
+ {
111
+ shell_type: :sh,
112
+ }
113
+ end
114
+
118
115
  def validate_product_names
119
116
  unless SUPPORTED_PRODUCT_NAMES.include? product_name
120
117
  <<-EOS
@@ -133,16 +130,6 @@ Must be one of: #{ALL_SUPPORTED_CHANNELS.join(", ")}
133
130
  end
134
131
  end
135
132
 
136
- def validate_platform_info
137
- platform_opts = [platform, platform_version, architecture]
138
- if (platform_opts.any?(&:nil?)) &&
139
- (platform_opts.any? { |opt| !opt.nil? })
140
- <<-EOS
141
- platform, platform version, and architecture are all required when specifying Platform options.
142
- EOS
143
- end
144
- end
145
-
146
133
  def validate_shell_type
147
134
  unless SUPPORTED_SHELL_TYPES.include? shell_type
148
135
  <<-EOS
@@ -172,19 +172,6 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
172
172
  config_file "/etc/chef-backend/chef-backend.rb"
173
173
  end
174
174
 
175
- product "chef-ha" do
176
- product_name "Chef Server High Availability addon"
177
- package_name "chef-ha"
178
- config_file "/etc/opscode/chef-server.rb"
179
- end
180
-
181
- product "chef-marketplace" do
182
- product_name "Chef Cloud Marketplace addon"
183
- package_name "chef-marketplace"
184
- ctl_command "chef-marketplace-ctl"
185
- config_file "/etc/chef-marketplace/marketplace.rb"
186
- end
187
-
188
175
  product "chef-server" do
189
176
  product_name "Chef Server"
190
177
  package_name do |v|
@@ -203,13 +190,6 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
203
190
  package_name "chef-server-ha-provisioning"
204
191
  end
205
192
 
206
- product "chef-sync" do
207
- product_name "Chef Server Replication addon"
208
- package_name "chef-sync"
209
- ctl_command "chef-sync-ctl"
210
- config_file "/etc/chef-sync/chef-sync.rb"
211
- end
212
-
213
193
  product "chefdk" do
214
194
  product_name "Chef Development Kit"
215
195
  package_name "chefdk"
@@ -234,6 +214,12 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
234
214
  package_name "delivery-cli"
235
215
  end
236
216
 
217
+ product "ha" do
218
+ product_name "Chef Server High Availability addon"
219
+ package_name "chef-ha"
220
+ config_file "/etc/opscode/chef-server.rb"
221
+ end
222
+
237
223
  product "manage" do
238
224
  product_name "Management Console"
239
225
  package_name do |v|
@@ -251,6 +237,13 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
251
237
  end
252
238
  end
253
239
 
240
+ product "marketplace" do
241
+ product_name "Chef Cloud Marketplace addon"
242
+ package_name "chef-marketplace"
243
+ ctl_command "chef-marketplace-ctl"
244
+ config_file "/etc/chef-marketplace/marketplace.rb"
245
+ end
246
+
254
247
  product "omnibus-toolchain" do
255
248
  product_name "Omnibus Toolchain"
256
249
  package_name "omnibus-toolchain"
@@ -263,14 +256,14 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
263
256
  config_file "/etc/opscode/private-chef.rb"
264
257
  end
265
258
 
266
- product "push-client" do
259
+ product "push-jobs-client" do
267
260
  product_name "Chef Push Server"
268
261
  package_name do |v|
269
262
  v < version_for("1.3.0") ? "opscode-push-jobs-client" : "push-jobs-client"
270
263
  end
271
264
  end
272
265
 
273
- product "push-server" do
266
+ product "push-jobs-server" do
274
267
  product_name "Chef Push Server"
275
268
  package_name "opscode-push-jobs-server"
276
269
  ctl_command "opscode-push-jobs-server-ctl"
@@ -290,4 +283,11 @@ PRODUCT_MATRIX = Mixlib::Install::ProductMatrix.new do
290
283
  ctl_command "supermarket-ctl"
291
284
  config_file "/etc/supermarket/supermarket.json"
292
285
  end
286
+
287
+ product "sync" do
288
+ product_name "Chef Server Replication addon"
289
+ package_name "chef-sync"
290
+ ctl_command "chef-sync-ctl"
291
+ config_file "/etc/chef-sync/chef-sync.rb"
292
+ end
293
293
  end
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "0.8.0.alpha.7"
3
+ VERSION = "0.8.0.alpha.8"
4
4
  end
5
5
  end
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.3"
26
26
  spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "sinatra"
27
28
  end
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: 0.8.0.alpha.7
4
+ version: 0.8.0.alpha.8
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-03-10 00:00:00.000000000 Z
12
+ date: 2016-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: artifactory
@@ -95,6 +95,20 @@ dependencies:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: sinatra
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
98
112
  description:
99
113
  email:
100
114
  - thom@chef.io
@@ -127,10 +141,13 @@ files:
127
141
  - acceptance/unstable/.acceptance/acceptance-cookbook/recipes/provision.rb
128
142
  - acceptance/unstable/.acceptance/acceptance-cookbook/recipes/verify.rb
129
143
  - acceptance/unstable/.kitchen.yml
144
+ - config.ru
130
145
  - lib/mixlib/install.rb
131
146
  - lib/mixlib/install/artifact_info.rb
132
147
  - lib/mixlib/install/backend.rb
133
148
  - lib/mixlib/install/backend/artifactory.rb
149
+ - lib/mixlib/install/backend/base.rb
150
+ - lib/mixlib/install/backend/bintray.rb
134
151
  - lib/mixlib/install/backend/omnitruck.rb
135
152
  - lib/mixlib/install/generator.rb
136
153
  - lib/mixlib/install/generator/base.rb
@@ -181,4 +198,3 @@ signing_key:
181
198
  specification_version: 4
182
199
  summary: A mixin to help with omnitruck installs
183
200
  test_files: []
184
- has_rdoc: