mixlib-install 3.3.2 → 3.3.3

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: a18332899c9613f49a801ec4ceb6508511b29d81
4
- data.tar.gz: 89d42e1043cdc5ae1da07b89fbb6f501a33b9e22
3
+ metadata.gz: 52c2a6687ddf2b789dc55e0f1aeacdbc8787c8fa
4
+ data.tar.gz: 834ce2f31d9b9ead5346938cb13e95a20f49ae72
5
5
  SHA512:
6
- metadata.gz: 2fcaa63666676a96788e7b28375d033369bba761db6223b3d365ccfd316d9903ec66f5dd247f05b2ef5a26614a7b3aa9cbfeb42fc23643d885151903197a3b00
7
- data.tar.gz: 9b3e8c8dad6034f288888cac36cfedb51a4a368f3c46bafcff47182db6508e35fe5234c15573143dc4f180c5b43dc27e917d6bd468369f53d76686f7fc9e68eb
6
+ metadata.gz: 3f14fec50a6fea2ccc9c71f8386b459f463b9f99bffe7e8380dd4b194df3b5430a82366a3dd4941f62b2d12f8b169ce6694de54588204ee243934622e8ddaa73
7
+ data.tar.gz: fdf3718b08e263d150953fbd49c8b52bdb1f16323a7d26a9999a05fcec52067e7fc3c4b889bb8366dcef7ab4c1f2fdbb435c194d213f86d697cbf58c5ac7fcfb
@@ -0,0 +1,14 @@
1
+ slack:
2
+ notify_channel: eng-services-alerts
3
+
4
+ github:
5
+ maintainer_group: chef/engineering-services
6
+ version_tag_format: v{{version}}
7
+
8
+ merge_actions:
9
+ built_in:bump_version:
10
+ ignore_labels: "Version: Skip Bump"
11
+ bash:.expeditor/update_version.sh:
12
+ only_if: built_in:bump_version
13
+ built_in:update_changelog:
14
+ ignore_labels: "Changelog: Skip Update"
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ #
3
+ # After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
4
+ # It then executes this file to update any other files/components with that new version.
5
+ #
6
+
7
+ set -evx
8
+
9
+ sed -i -r "s/VERSION = \".+\"/VERSION = \"$(cat VERSION)\"/" lib/mixlib/install/version.rb
@@ -0,0 +1,3 @@
1
+ # Order is important. The last matching pattern has the most precedence.
2
+
3
+ * @chef/engineering-services
data/.travis.yml CHANGED
@@ -36,9 +36,7 @@ matrix:
36
36
  - rvm: 2.3
37
37
  env: SUITE=ubuntu
38
38
  - rvm: 2.3
39
- env: SUITE=windows-server-2012r2
40
- # - rvm: 2.3
41
- # env: SUITE=windows-nano
39
+ env: SUITE=windows-server
42
40
 
43
41
  before_script:
44
42
  - ci/before-script.sh
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
- # Change Log
1
+ # Mixlib::Install Changes
2
+
3
+ <!-- latest_release -->
4
+ ## [v3.3.3](https://github.com/chef/mixlib-install/tree/v3.3.3) (2017-08-02)
5
+
6
+ #### Merged Pull Requests
7
+ - mixlib-versioning backwards compatability for PartialSemVer support [#229](https://github.com/chef/mixlib-install/pull/229) ([wrightp](https://github.com/wrightp))
8
+ <!-- latest_release -->
9
+
10
+
2
11
 
3
12
  ## [3.3.2]
4
13
  - Fix bug where calling `products_available_on_downloads_site` would corrupt the product map.
@@ -171,4 +180,4 @@
171
180
 
172
181
  ## [1.0.0]
173
182
  - Ability to query product artifacts from multiple channels
174
- - Ability to generate installation scripts for `sh` and `ps1`
183
+ - Ability to generate installation scripts for `sh` and `ps1`
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.3.3
@@ -0,0 +1,3 @@
1
+ execute "terraform destroy -force" do
2
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
3
+ end
@@ -0,0 +1,11 @@
1
+ execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.install_ps1, 'install'\" > ../.acceptance_data/powershell_install_fips.ps1" do
2
+ cwd node['chef-acceptance']['suite-dir']
3
+ end
4
+
5
+ execute "terraform plan" do
6
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
7
+ end
8
+
9
+ execute "terraform apply" do
10
+ cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
11
+ end
@@ -0,0 +1,14 @@
1
+ ruby_block "get ip" do
2
+ block do
3
+ tf_state = JSON.parse(File.read("#{node['chef-acceptance']['suite-dir']}/terraform/terraform.tfstate"))
4
+ node.default["ip"] = tf_state["modules"].first["resources"]["aws_instance.mixlib_install_ps1"]["primary"]["attributes"]["public_ip"]
5
+ end
6
+ end
7
+
8
+ execute "run inspec" do
9
+ command lazy { "inspec exec verify.rb -t winrm://Administrator@#{node['ip']} --password $WINDOWS_PASSWORD" }
10
+ cwd "#{node['chef-acceptance']['suite-dir']}/inspec"
11
+ environment(
12
+ "WINDOWS_PASSWORD" => ENV["TF_VAR_admin_password"] || "Pas5w0rD"
13
+ )
14
+ end
@@ -0,0 +1,3 @@
1
+ describe package("Chef Client v13*") do
2
+ it { should be_installed }
3
+ end
@@ -0,0 +1,90 @@
1
+ data "aws_ami" "windows_ami" {
2
+ most_recent = true
3
+
4
+ filter {
5
+ name = "owner-alias"
6
+ values = ["amazon"]
7
+ }
8
+
9
+ filter {
10
+ name = "name"
11
+ values = ["Windows_Server-2012-R2*-English-*-Base-*"]
12
+ }
13
+
14
+ filter {
15
+ name = "architecture"
16
+ values = ["x86_64"]
17
+ }
18
+
19
+ filter {
20
+ name = "virtualization-type"
21
+ values = ["hvm"]
22
+ }
23
+
24
+ filter {
25
+ name = "block-device-mapping.volume-type"
26
+ values = ["gp2"]
27
+ }
28
+
29
+ filter {
30
+ name = "image-type"
31
+ values = ["machine"]
32
+ }
33
+ }
34
+
35
+ resource "aws_instance" "mixlib_install_ps1" {
36
+ count = 1
37
+
38
+ ami = "${data.aws_ami.windows_ami.id}"
39
+ instance_type = "${var.aws_instance_type}"
40
+ key_name = "es-infrastructure"
41
+
42
+ associate_public_ip_address = true
43
+
44
+ subnet_id = "subnet-11ac0174" # Planet Releng Public Subnet
45
+ source_dest_check = false
46
+
47
+ vpc_security_group_ids = [
48
+ "sg-96274af3",
49
+ ]
50
+
51
+ connection {
52
+ type = "winrm"
53
+ user = "Administrator"
54
+ password = "${var.admin_password}"
55
+ timeout = "10m"
56
+ }
57
+
58
+ user_data = <<EOF
59
+ <script>
60
+ winrm quickconfig -q & winrm set winrm/config/winrs @{MaxMemoryPerShellMB="300"} & winrm set winrm/config @{MaxTimeoutms="1800000"} & winrm set winrm/config/service @{AllowUnencrypted="true"} & winrm set winrm/config/service/auth @{Basic="true"}
61
+ </script>
62
+ <powershell>
63
+ Set-ExecutionPolicy -ExecutionPolicy Bypass
64
+ netsh advfirewall firewall add rule name="WinRM in" protocol=TCP dir=in profile=any localport=5985 remoteip=any localip=any action=allow
65
+ $admin = [adsi]("WinNT://./administrator, user")
66
+ $admin.psbase.invoke("SetPassword", "${var.admin_password}")
67
+ Set-ItemProperty -path HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy -name Enabled -value 1
68
+ </powershell>
69
+ EOF
70
+
71
+ tags {
72
+ # ChefOps's AWS standard tags:
73
+ X-Dept = "EngServ"
74
+ X-Contact = "pwright"
75
+ X-Production = "false"
76
+ X-Environment = "acceptance"
77
+ X-Application = "mixlib-install"
78
+ }
79
+
80
+ provisioner "file" {
81
+ source = "../../.acceptance_data/powershell_install_fips.ps1"
82
+ destination = "/tmp/install.ps1"
83
+ }
84
+
85
+ provisioner "remote-exec" {
86
+ inline = [
87
+ "powershell.exe -file /tmp/install.ps1",
88
+ ]
89
+ }
90
+ }
@@ -0,0 +1,8 @@
1
+ # Restrict operation of terraform to chef-es profile so that
2
+ # we do not create resources in other aws profiles.
3
+ # We assume user has configured standard aws credentials
4
+ # under ~/.aws/credentials or with $AWS_SHARED_CREDENTIALS_FILE
5
+ provider "aws" {
6
+ region = "${var.aws_region}"
7
+ profile = "chef-aws"
8
+ }
@@ -0,0 +1,16 @@
1
+ # Region to create infrastructure in
2
+ variable "aws_region" {
3
+ type = "string"
4
+ default = "us-west-2"
5
+ }
6
+
7
+ variable "aws_instance_type" {
8
+ type = "string"
9
+ default = "t2.micro"
10
+ }
11
+
12
+ variable "admin_password" {
13
+ description = "Set Windows Administrator password"
14
+ type = "string"
15
+ default = "Pas5w0rD"
16
+ }
@@ -1,7 +1,7 @@
1
1
  [Console]::OutputEncoding = New-Object -typename System.Text.ASCIIEncoding
2
2
 
3
3
  function Get-PlatformVersion {
4
- switch -regex ((Get-WMIQuery win32_operatingsystem).version) {
4
+ switch -regex ((Get-Win32OS).version) {
5
5
  '10\.0\.\d+' {$platform_version = '2016'}
6
6
  '6\.3\.\d+' {$platform_version = '2012r2'}
7
7
  '6\.2\.\d+' {$platform_version = '2012'}
@@ -18,7 +18,7 @@ function Get-PlatformVersion {
18
18
  }
19
19
 
20
20
  function Get-PlatformArchitecture {
21
- if ((Get-WMIQuery win32_operatingsystem).osarchitecture -like '64-bit') {
21
+ if ((Get-Win32OS).osarchitecture -like '64-bit') {
22
22
  $architecture = 'x86_64'
23
23
  } else {
24
24
  $architecture = 'i386'
@@ -26,6 +26,14 @@ function Get-PlatformArchitecture {
26
26
  return $architecture
27
27
  }
28
28
 
29
+ function Get-Win32OS {
30
+ if(!$env:win32OS)
31
+ {
32
+ $env:win32OS = Get-WMIQuery win32_operatingsystem
33
+ }
34
+ $env:win32OS
35
+ }
36
+
29
37
  function New-Uri {
30
38
  param ($baseuri, $newuri)
31
39
 
@@ -110,20 +118,21 @@ function Get-WebContentOnCore {
110
118
  function Test-ProjectPackage {
111
119
  [cmdletbinding()]
112
120
  param ($Path, $Algorithm = 'SHA256', $Hash)
113
-
114
- Write-Verbose "Testing the $Algorithm hash for $path."
115
- $ActualHash = (Get-FileHash -Algorithm $Algorithm -Path $Path).Hash.ToLower()
116
-
117
- Write-Verbose "`tDesired Hash - '$Hash'"
118
- Write-Verbose "`tActual Hash - '$ActualHash'"
119
- $Valid = $ActualHash -eq $Hash
120
- if (-not $Valid) {
121
- Write-Error "Failed to validate the downloaded installer. The expected $Algorithm hash was '$Hash' and the actual hash was '$ActualHash' for $path"
121
+ if (!$env:Valid_ProjectPackage){
122
+ Write-Verbose "Testing the $Algorithm hash for $path."
123
+ $ActualHash = (Custom-GetFileHash -Algorithm $Algorithm -Path $Path).Hash.ToLower()
124
+
125
+ Write-Verbose "`tDesired Hash - '$Hash'"
126
+ Write-Verbose "`tActual Hash - '$ActualHash'"
127
+ $env:Valid_ProjectPackage = $ActualHash -eq $Hash
128
+ if (-not $env:Valid_ProjectPackage) {
129
+ Write-Error "Failed to validate the downloaded installer. The expected $Algorithm hash was '$Hash' and the actual hash was '$ActualHash' for $path"
130
+ }
122
131
  }
123
- return $Valid
132
+ return $env:Valid_ProjectPackage
124
133
  }
125
134
 
126
- function Get-FileHash ($Path, $Algorithm) {
135
+ function Custom-GetFileHash ($Path, $Algorithm) {
127
136
  function disposable($o){($o -is [IDisposable]) -and (($o | get-member | foreach-object {$_.name}) -contains 'Dispose')}
128
137
  function use($obj, [scriptblock]$sb){try {& $sb} catch [exception]{throw $_} finally {if (disposable $obj) {$obj.Dispose()}} }
129
138
  $Path = (resolve-path $Path).providerpath
@@ -137,7 +146,7 @@ function Get-FileHash ($Path, $Algorithm) {
137
146
  }
138
147
 
139
148
  function Get-SHA256Converter {
140
- if (Is-FIPS) {
149
+ if ($(Is-FIPS) -ge 1) {
141
150
  New-Object -TypeName Security.Cryptography.SHA256Cng
142
151
  } else {
143
152
  if($PSVersionTable.PSEdition -eq 'Core') {
@@ -150,7 +159,10 @@ function Get-SHA256Converter {
150
159
  }
151
160
 
152
161
  function Is-FIPS {
153
- (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy).Enabled
162
+ if (!$env:fips){
163
+ $env:fips = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy).Enabled
164
+ }
165
+ return $env:fips
154
166
  }
155
167
 
156
168
  function Get-WMIQuery {
@@ -58,8 +58,10 @@ function Install-Project {
58
58
  )
59
59
 
60
60
  # Set http_proxy as env var
61
- $env:http_proxy = $http_proxy
62
-
61
+ if(-not [string]::IsNullOrEmpty($http_proxy)) {
62
+ $env:http_proxy = $http_proxy
63
+ }
64
+
63
65
  if (-not [string]::IsNullOrEmpty($download_url_override)) {
64
66
  $download_url = $download_url_override
65
67
  $sha256 = $checksum
@@ -126,18 +128,18 @@ set-alias install -value Install-Project
126
128
 
127
129
  Function Install-ChefMsi($msi, $addlocal) {
128
130
  if ($addlocal -eq "service") {
129
- $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefClientFeature,ChefServiceFeature`"" -Passthru -Wait
131
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefClientFeature,ChefServiceFeature`"" -Passthru -Wait -NoNewWindow
130
132
  }
131
133
  ElseIf ($addlocal -eq "task") {
132
- $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefClientFeature,ChefSchTaskFeature`"" -Passthru -Wait
134
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi ADDLOCAL=`"ChefClientFeature,ChefSchTaskFeature`"" -Passthru -Wait -NoNewWindow
133
135
  }
134
136
  ElseIf ($addlocal -eq "auto") {
135
- $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
137
+ $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait -NoNewWindow
136
138
  }
137
139
 
138
140
  $p.WaitForExit()
139
141
  if ($p.ExitCode -eq 1618) {
140
- Write-Host "Another msi install is in progress (exit code 1618), retrying ($($installAttempts))..."
142
+ Write-Host "$((Get-Date).ToString()) - Another msi install is in progress (exit code 1618), retrying ($($installAttempts))..."
141
143
  return $false
142
144
  } elseif ($p.ExitCode -ne 0) {
143
145
  throw "msiexec was not successful. Received exit code $($p.ExitCode)"
@@ -112,7 +112,17 @@ module Mixlib
112
112
  end
113
113
 
114
114
  def partial_version?
115
- !latest_version? && !Mixlib::Versioning.parse(product_version)
115
+ # If PartialSemVer is defined than the version of mixlib-versioning loaded can parse partial versions
116
+ # Otherwise parsing a partial version will return nil
117
+ is_partial = if defined?(Mixlib::Versioning::Format::PartialSemVer)
118
+ # remove if there's a trailing period for mixlib-versioning compatibility
119
+ options[:product_version] = product_version.chomp(".") if product_version.is_a? String
120
+ Mixlib::Versioning.parse(product_version).is_a?(Mixlib::Versioning::Format::PartialSemVer)
121
+ else
122
+ !Mixlib::Versioning.parse(product_version)
123
+ end
124
+
125
+ !latest_version? && is_partial
116
126
  end
117
127
 
118
128
  def include_metadata?
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class Install
3
- VERSION = "3.3.2"
3
+ VERSION = "3.3.3"
4
4
  end
5
5
  end
@@ -29,7 +29,7 @@ Function Get-SHA256($src) {
29
29
  }
30
30
 
31
31
  function Get-SHA256Converter {
32
- if (Is-FIPS) {
32
+ if ($(Is-FIPS) -ge 1) {
33
33
  New-Object -TypeName Security.Cryptography.SHA256Cng
34
34
  } else {
35
35
  if($PSVersionTable.PSEdition -eq 'Core') {
@@ -42,7 +42,10 @@ function Get-SHA256Converter {
42
42
  }
43
43
 
44
44
  function Is-FIPS {
45
- (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy).Enabled
45
+ if (!$env:fips){
46
+ $env:fips = (Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy).Enabled
47
+ }
48
+ return $env:fips
46
49
  }
47
50
 
48
51
  Function Download-Chef($url, $sha256, $dst) {
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: 3.3.2
4
+ version: 3.3.3
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: 2017-07-18 00:00:00.000000000 Z
12
+ date: 2017-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mixlib-shellout
@@ -62,7 +62,10 @@ executables:
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
+ - ".expeditor/config.yml"
66
+ - ".expeditor/update_version.sh"
65
67
  - ".gitattributes"
68
+ - ".github/CODEOWNERS"
66
69
  - ".gitignore"
67
70
  - ".rspec"
68
71
  - ".rubocop.yml"
@@ -74,6 +77,7 @@ files:
74
77
  - PRODUCT_MATRIX.md
75
78
  - README.md
76
79
  - Rakefile
80
+ - VERSION
77
81
  - acceptance/.gitignore
78
82
  - acceptance/Gemfile
79
83
  - acceptance/README.md
@@ -105,6 +109,15 @@ files:
105
109
  - acceptance/windows-nano/terraform/application.tf
106
110
  - acceptance/windows-nano/terraform/aws.tf
107
111
  - acceptance/windows-nano/terraform/variables.tf
112
+ - acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/.gitignore
113
+ - acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/metadata.rb
114
+ - acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/recipes/destroy.rb
115
+ - acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/recipes/provision.rb
116
+ - acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/recipes/verify.rb
117
+ - acceptance/windows-server-2012r2-fips/inspec/verify.rb
118
+ - acceptance/windows-server-2012r2-fips/terraform/application.tf
119
+ - acceptance/windows-server-2012r2-fips/terraform/aws.tf
120
+ - acceptance/windows-server-2012r2-fips/terraform/variables.tf
108
121
  - acceptance/windows-server-2012r2/.acceptance/acceptance-cookbook/.gitignore
109
122
  - acceptance/windows-server-2012r2/.acceptance/acceptance-cookbook/metadata.rb
110
123
  - acceptance/windows-server-2012r2/.acceptance/acceptance-cookbook/recipes/destroy.rb
@@ -166,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
179
  version: '0'
167
180
  requirements: []
168
181
  rubyforge_project:
169
- rubygems_version: 2.6.11
182
+ rubygems_version: 2.6.10
170
183
  signing_key:
171
184
  specification_version: 4
172
185
  summary: A library for interacting with Chef Software Inc's software distribution