mixlib-install 2.1.7 → 2.1.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: 4aa42309e20d7a5b06a3874e1cb4d471892a2cb8
4
- data.tar.gz: 70ff1f55118f8f2c6094315b03657b826af4fcbc
3
+ metadata.gz: 40fa6c0a0b63502b8c38218361ecff0c041ebbd7
4
+ data.tar.gz: e151caa4b979c2e561c5520d860bfc4e0f544e9a
5
5
  SHA512:
6
- metadata.gz: dd1a93974bb5129e86251a25c720a6e9b76229fb5bf77c7d609ace656287884c6783fb2389a474d1d0c0ff72be6cde03fe6b3c178f00128953630a0b207830f3
7
- data.tar.gz: f924da9ad408db2f7f90c0dd8fa9fa23b31556acfd2bd07453a431361ee4792d2717e722a2c071ad4eb86681be1a173856dd694ce829ca0aac10d2b698deb70e
6
+ metadata.gz: 4441ee64cfed4d6cc63ccf209def59e4f3866393b389d9cbd70c3211a7332e1d4b664a1e21ed972b6062d3bf423ec16686c18efb92dee48803d8f3c05726efcb
7
+ data.tar.gz: 8f7c097bd4c36ab4474dec1007d82da49b02d015be101575348cca832ed503e6063b5123ed3536c78cc9ac9779234859dd8283678d88841a8bfc67926649c7a3
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## [2.1.8]
4
+ - Query performance optimizations
5
+ - Add ChefClientFeature support to the MSI install script
6
+
3
7
  ## [2.1.7]
4
8
  - Add support for passing arguments to the MSI in install scripts
5
9
  - Add platform version compatibility support for Windows (including desktop versions)
@@ -47,10 +47,23 @@ module Mixlib
47
47
  end
48
48
 
49
49
  #
50
- # Gets available versions from Artifactory via AQL.
50
+ # Gets available versions from Artifactory via AQL. Returning
51
+ # simply the list of versions.
51
52
  #
52
53
  # @return [Array<String>] Array of available versions
53
54
  def available_versions
55
+ # We are only including a single property, version and that exists
56
+ # under the properties in the following structure:
57
+ # "properties" => [ {"key"=>"omnibus.version", "value"=>"12.13.3"} ]
58
+ ver_list = versions.map { |i| extract_version_from_response(i) }
59
+ ver_list.uniq
60
+ end
61
+
62
+ #
63
+ # Get available versions from Artifactory via AQL. Returning the full API response
64
+ #
65
+ # @return [Array<Array<Hash>] Build records for available versions
66
+ def versions
54
67
  items = get("/api/v1/#{options.channel}/#{omnibus_project}/versions")["results"]
55
68
 
56
69
  # Filter out the partial builds if we are in :unstable channel
@@ -63,12 +76,7 @@ module Mixlib
63
76
  # populated with the build record if "artifact.module.build" exists.
64
77
  items.reject! { |i| i["artifacts"].nil? }
65
78
  end
66
-
67
- # We are only including a single property, version and that exists
68
- # under the properties in the following structure:
69
- # "properties" => [ {"key"=>"omnibus.version", "value"=>"12.13.3"} ]
70
- items.map! { |i| i["properties"].first["value"] }
71
- items.uniq
79
+ items
72
80
  end
73
81
 
74
82
  #
@@ -79,7 +87,7 @@ module Mixlib
79
87
  # Get the list of builds from the REST api.
80
88
  # We do this because a user in the readers group does not have
81
89
  # permissions to run aql against builds.
82
- builds = get("/api/v1/build/#{omnibus_project}")
90
+ builds = versions
83
91
 
84
92
  if builds.nil?
85
93
  raise NoArtifactsError, <<-MSG
@@ -87,30 +95,15 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
87
95
  MSG
88
96
  end
89
97
 
90
- # Output we get is something like:
91
- # {
92
- # "buildsNumbers": [
93
- # {"uri"=>"/12.5.1+20151213083009", "started"=>"2015-12-13T08:40:19.238+0000"},
94
- # {"uri"=>"/12.6.0+20160111212038", "started"=>"2016-01-12T00:25:35.762+0000"},
95
- # ...
96
- # ]
97
- # }
98
- # First we sort based on started
99
- builds["buildsNumbers"].sort_by! { |b| b["started"] }.reverse!
100
-
101
- # Now check if the build is in the requested channel or not
102
- # Note that if you do this for any channel other than :unstable
103
- # it will run a high number of queries but it is fine because we
104
- # are using artifactory only for :unstable channel
105
- builds["buildsNumbers"].each do |build|
106
- version = build["uri"].delete("/")
107
- artifacts = artifacts_for_version(version)
108
-
109
- return artifacts unless artifacts.empty?
110
- end
98
+ # Sort by created data
99
+ # TODO: Shouldn't we sort by version?
100
+ builds.sort_by! { |b| b["created"] }.reverse!
101
+ version = extract_version_from_response(builds.first)
102
+ artifacts_for_version(version)
103
+ end
111
104
 
112
- # we could not find any matching artifacts
113
- []
105
+ def extract_version_from_response(response)
106
+ response["properties"].find { |item| item["key"] == "omnibus.version" }["value"]
114
107
  end
115
108
 
116
109
  #
@@ -149,9 +142,7 @@ Can not find any builds for #{options.product_name} in #{endpoint}.
149
142
  http = Net::HTTP.new(uri.host, uri.port)
150
143
  http.use_ssl = (uri.scheme == "https")
151
144
  full_path = File.join(uri.path, url)
152
-
153
145
  res = http.request(create_http_request(full_path))
154
-
155
146
  res.value
156
147
  JSON.parse(res.body)
157
148
  end
@@ -107,10 +107,10 @@ set-alias install -value Install-Project
107
107
 
108
108
  Function Install-ChefMsi($msi, $addlocal) {
109
109
  if ($addlocal -eq "service") {
110
- $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefServiceFeature`"" -Passthru -Wait
110
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefClientFeature,ChefServiceFeature`"" -Passthru -Wait
111
111
  }
112
112
  ElseIf ($addlocal -eq "task") {
113
- $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefSchTaskFeature`"" -Passthru -Wait
113
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefClientFeature,ChefSchTaskFeature`"" -Passthru -Wait
114
114
  }
115
115
  ElseIf ($addlocal -eq "auto") {
116
116
  $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "2.1.7"
3
+ VERSION = "2.1.8"
4
4
  end
5
5
  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: 2.1.7
4
+ version: 2.1.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-11-18 00:00:00.000000000 Z
12
+ date: 2016-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: artifactory