mixlib-install 1.2.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +41 -0
  3. data/CHANGELOG.md +6 -2
  4. data/README.md +4 -15
  5. data/Rakefile +2 -12
  6. data/acceptance/.gitignore +7 -1
  7. data/acceptance/Gemfile +0 -8
  8. data/acceptance/README.md +6 -0
  9. data/acceptance/bourne/.acceptance/acceptance-cookbook/.gitignore +8 -0
  10. data/acceptance/{unstable → bourne}/.acceptance/acceptance-cookbook/metadata.rb +1 -0
  11. data/acceptance/bourne/.acceptance/acceptance-cookbook/recipes/destroy.rb +3 -0
  12. data/acceptance/bourne/.acceptance/acceptance-cookbook/recipes/provision.rb +11 -0
  13. data/acceptance/bourne/.acceptance/acceptance-cookbook/recipes/verify.rb +11 -0
  14. data/acceptance/bourne/inspec/verify.rb +3 -0
  15. data/acceptance/bourne/terraform/application.tf +78 -0
  16. data/acceptance/bourne/terraform/aws.tf +8 -0
  17. data/acceptance/bourne/terraform/variables.tf +27 -0
  18. data/acceptance/{current → powershell}/.acceptance/acceptance-cookbook/.gitignore +1 -1
  19. data/acceptance/{current → powershell}/.acceptance/acceptance-cookbook/metadata.rb +1 -0
  20. data/acceptance/powershell/.acceptance/acceptance-cookbook/recipes/destroy.rb +3 -0
  21. data/acceptance/powershell/.acceptance/acceptance-cookbook/recipes/provision.rb +12 -0
  22. data/acceptance/powershell/.acceptance/acceptance-cookbook/recipes/verify.rb +12 -0
  23. data/acceptance/powershell/inspec/verify.rb +3 -0
  24. data/acceptance/powershell/terraform/application.tf +89 -0
  25. data/acceptance/powershell/terraform/aws.tf +8 -0
  26. data/acceptance/powershell/terraform/variables.tf +16 -0
  27. data/ci/before-script.sh +31 -0
  28. data/ci/es-infrastructure.pem.enc +0 -0
  29. data/lib/mixlib/install.rb +0 -10
  30. data/lib/mixlib/install/backend.rb +2 -7
  31. data/lib/mixlib/install/backend/{artifactory.rb → package_router.rb} +52 -100
  32. data/lib/mixlib/install/generator/base.rb +1 -2
  33. data/lib/mixlib/install/generator/bourne.rb +1 -13
  34. data/lib/mixlib/install/generator/powershell.rb +2 -25
  35. data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata.ps1.erb +1 -1
  36. data/lib/mixlib/install/options.rb +3 -17
  37. data/lib/mixlib/install/script_generator.rb +1 -0
  38. data/lib/mixlib/install/version.rb +1 -1
  39. data/mixlib-install.gemspec +4 -3
  40. metadata +51 -32
  41. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
  42. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -3
  43. data/acceptance/current/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -3
  44. data/acceptance/current/.kitchen.yml +0 -41
  45. data/acceptance/unstable/.acceptance/acceptance-cookbook/.gitignore +0 -2
  46. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
  47. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -3
  48. data/acceptance/unstable/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -3
  49. data/acceptance/unstable/.kitchen.yml +0 -41
  50. data/config.ru +0 -7
  51. data/lib/mixlib/install/backend/bintray.rb +0 -298
  52. data/lib/mixlib/install/backend/omnitruck.rb +0 -75
  53. data/lib/mixlib/install/generator/bourne/scripts/artifactory_urls.sh.erb +0 -28
  54. data/lib/mixlib/install/generator/powershell/scripts/get_project_metadata_for_artifactory.ps1.erb +0 -75
@@ -1,75 +0,0 @@
1
- #
2
- # Author:: Patrick Wright (<patrick@chef.io>)
3
- # Copyright:: Copyright (c) 2015 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 "net/http"
20
- require "json"
21
- require "mixlib/install/artifact_info"
22
- require "mixlib/install/backend/base"
23
-
24
- module Mixlib
25
- class Install
26
- class Backend
27
- class Omnitruck < Base
28
- ENDPOINT = "https://omnitruck.chef.io/".freeze
29
-
30
- def endpoint
31
- @endpoint ||= ENV.fetch("OMNITRUCK_ENDPOINT", ENDPOINT)
32
- end
33
-
34
- def available_artifacts
35
- # If we are querying a single platform we need to call metadata
36
- # endpoint otherwise we need to call versions endpoint in omnitruck
37
- if options.platform
38
- build = omnitruck_get("metadata", p: options.platform,
39
- pv: options.platform_version,
40
- m: options.architecture,
41
- v: options.product_version
42
- )
43
- ArtifactInfo.from_json(build,
44
- platform: options.platform,
45
- platform_version: options.platform_version,
46
- architecture: options.architecture
47
- )
48
- else
49
- builds = omnitruck_get("versions", v: options.product_version)
50
- ArtifactInfo.from_metadata_map(builds)
51
- end
52
- end
53
-
54
- private
55
-
56
- def omnitruck_get(resource, parameters)
57
- uri = URI.parse(endpoint)
58
- http = Net::HTTP.new(uri.host, uri.port)
59
- http.use_ssl = (uri.scheme == "https")
60
-
61
- path = "/#{options.channel}/#{options.product_name}/#{resource}"
62
- full_path = [path, URI.encode_www_form(parameters)].join("?")
63
- request = Net::HTTP::Get.new(full_path)
64
- request["Accept"] = "application/json"
65
-
66
- res = http.request(request)
67
-
68
- # Raise if response is not 2XX
69
- res.value
70
- res.body
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,28 +0,0 @@
1
- # artifactory_urls.sh
2
- ############
3
- # This section sets up the information for a build to be installed from artifactory
4
- # then uses $platform, $platform_version and $machine to select the correct
5
- # version.
6
- #
7
- # Inputs:
8
- # $platform:
9
- # $platform_version:
10
- # $machine:
11
- #
12
- # Outputs:
13
- # $download_url:
14
- # $sha256:
15
- ############
16
-
17
- <% artifacts.each do |artifact| %>
18
- artifact_info_dir="$tmp_dir/artifact_info/<%= File.join(artifact.platform, artifact.platform_version, artifact.architecture)%>"
19
- mkdir -p $artifact_info_dir
20
- touch "$artifact_info_dir/artifact_info"
21
- echo "url <%= artifact.url%>" >> "$artifact_info_dir/artifact_info"
22
- echo "sha256 <%= artifact.sha256%>" >> "$artifact_info_dir/artifact_info"
23
- <% end %>
24
-
25
- artifact_info_for_platform="$tmp_dir/artifact_info/$platform/$platform_version/$machine/artifact_info"
26
-
27
- download_url=`awk '$1 == "url" { print $2 }' "$artifact_info_for_platform"`
28
- sha256=`awk '$1 == "sha256" { print $2 }' "$artifact_info_for_platform"`
@@ -1,75 +0,0 @@
1
- function Get-ProjectMetadata {
2
- <#
3
- .SYNOPSIS
4
- Get metadata for a Chef Software, Inc. project
5
- .DESCRIPTION
6
- Get metadata for project
7
- .EXAMPLE
8
- iex (new-object net.webclient).downloadstring('https://omnitruck.chef.io/install.ps1'); Get-ProjectMetadata -project chef -channel stable
9
-
10
- Gets the download url and SHA256 checksum for the latest stable release of Chef.
11
- .EXAMPLE
12
- iex (irm 'https://omnitruck.chef.io/install.ps1'); Get-ProjectMetadata -project chefdk -channel stable -version 0.8.0
13
-
14
- Gets the download url, and SHA256 checksum for ChefDK 0.8.0.
15
- #>
16
- [cmdletbinding()]
17
- param (
18
- # Base url to retrieve metadata from.
19
- [uri]$base_server_uri = '<%= base_url %>',
20
- [string]
21
- # Project to install
22
- [string]
23
- $project = 'chef',
24
- # Version of the application to install
25
- # This parameter is optional, if not supplied it will provide the latest version,
26
- # and if an iteration number is not specified, it will grab the latest available iteration.
27
- # Partial version numbers are also acceptable (using v=11
28
- # will grab the latest 11.x client which matches the other flags).
29
- [string]
30
- $version,
31
- # Release channel to install from
32
- $channel = 'unstable',
33
- # The following legacy switches are just aliases for the current channel
34
- [switch]
35
- $prerelease,
36
- [switch]
37
- $nightlies,
38
- [validateset('auto', 'i386', 'x86_64')]
39
- [string]
40
- $architecture = 'auto'
41
- )
42
-
43
- # PowerShell is only on Windows ATM
44
- $platform = 'windows'
45
- Write-Verbose "Platform: $platform"
46
-
47
- $platform_version = Get-PlatformVersion
48
- Write-Verbose "Platform Version: $platform_version"
49
-
50
- if ($architecture -eq 'auto') {
51
- $architecture = Get-PlatformArchitecture
52
- }
53
-
54
- Write-Verbose "Architecture: $architecture"
55
- Write-Verbose "Project: $project"
56
-
57
- <% artifacts.each do |artifact| %>
58
- $artifact_info_dir = "$($env:temp)/artifact_info/<%= File.join(artifact.platform, artifact.platform_version, artifact.architecture)%>"
59
- New-Item -ItemType directory -Path $artifact_info_dir -force
60
- New-Item -ItemType file "$($artifact_info_dir)/artifact_info" -force
61
- "url <%= artifact.url%>" | out-file "$artifact_info_dir/artifact_info"
62
- "sha256 <%= artifact.sha256%>" | out-file "$artifact_info_dir/artifact_info" -Append
63
- <% end %>
64
-
65
- $artifact_info_for_platform = Get-Content "$($env:temp)/artifact_info/$($platform)/$($platform_version)/$($architecture)/artifact_info"
66
-
67
- $package_metadata = ($artifact_info_for_platform).trim() -split '\n' |
68
- foreach { $hash = @{} } {$key, $value = $_ -split '\s+'; $hash.Add($key, $value)} {$hash}
69
-
70
- Write-Verbose "Project details: "
71
- foreach ($key in $package_metadata.keys) {
72
- Write-Verbose "`t$key = $($package_metadata[$key])"
73
- }
74
- $package_metadata
75
- }