mixlib-install 3.9.0 → 3.9.3
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 +5 -5
- data/lib/mixlib/install/options.rb +1 -1
- data/lib/mixlib/install/version.rb +1 -1
- data/mixlib-install.gemspec +1 -1
- metadata +3 -112
- data/.expeditor/config.yml +0 -20
- data/.expeditor/update_version.sh +0 -9
- data/.gitattributes +0 -3
- data/.github/CODEOWNERS +0 -3
- data/.gitignore +0 -13
- data/.rspec +0 -2
- data/.rubocop.yml +0 -2
- data/.travis.yml +0 -61
- data/CHANGELOG.md +0 -220
- data/CONTRIBUTING.md +0 -14
- data/VERSION +0 -1
- data/acceptance/.gitignore +0 -8
- data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/.gitignore +0 -8
- data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -24
- data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -11
- data/acceptance/.suites/ubuntu_install_checksum/inspec/verify.rb +0 -78
- data/acceptance/.suites/ubuntu_install_checksum/terraform/application.tf +0 -95
- data/acceptance/.suites/ubuntu_install_checksum/terraform/aws.tf +0 -8
- data/acceptance/.suites/ubuntu_install_checksum/terraform/variables.tf +0 -27
- data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/libraries/chef_extentions.rb +0 -74
- data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -49
- data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -9
- data/acceptance/.suites/windows-nano/inspec/verify.rb +0 -11
- data/acceptance/.suites/windows-nano/terraform/application.tf +0 -59
- data/acceptance/.suites/windows-nano/terraform/aws.tf +0 -8
- data/acceptance/.suites/windows-nano/terraform/variables.tf +0 -10
- data/acceptance/Gemfile +0 -8
- data/acceptance/README.md +0 -6
- data/acceptance/centos_install_checksum/.acceptance/acceptance-cookbook/.gitignore +0 -8
- data/acceptance/centos_install_checksum/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/centos_install_checksum/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/centos_install_checksum/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -24
- data/acceptance/centos_install_checksum/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -11
- data/acceptance/centos_install_checksum/inspec/verify.rb +0 -78
- data/acceptance/centos_install_checksum/terraform/application.tf +0 -95
- data/acceptance/centos_install_checksum/terraform/aws.tf +0 -8
- data/acceptance/centos_install_checksum/terraform/variables.tf +0 -27
- data/acceptance/ubuntu_install_command/.acceptance/acceptance-cookbook/.gitignore +0 -8
- data/acceptance/ubuntu_install_command/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/ubuntu_install_command/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/ubuntu_install_command/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -12
- data/acceptance/ubuntu_install_command/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -11
- data/acceptance/ubuntu_install_command/inspec/verify.rb +0 -3
- data/acceptance/ubuntu_install_command/terraform/application.tf +0 -78
- data/acceptance/ubuntu_install_command/terraform/aws.tf +0 -8
- data/acceptance/ubuntu_install_command/terraform/variables.tf +0 -27
- data/acceptance/ubuntu_install_command_once/.acceptance/acceptance-cookbook/.gitignore +0 -8
- data/acceptance/ubuntu_install_command_once/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/ubuntu_install_command_once/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/ubuntu_install_command_once/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -12
- data/acceptance/ubuntu_install_command_once/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -11
- data/acceptance/ubuntu_install_command_once/inspec/verify.rb +0 -7
- data/acceptance/ubuntu_install_command_once/terraform/application.tf +0 -78
- data/acceptance/ubuntu_install_command_once/terraform/aws.tf +0 -8
- data/acceptance/ubuntu_install_command_once/terraform/variables.tf +0 -27
- data/acceptance/ubuntu_install_sh/.acceptance/acceptance-cookbook/.gitignore +0 -8
- data/acceptance/ubuntu_install_sh/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/ubuntu_install_sh/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/ubuntu_install_sh/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -12
- data/acceptance/ubuntu_install_sh/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -11
- data/acceptance/ubuntu_install_sh/inspec/verify.rb +0 -3
- data/acceptance/ubuntu_install_sh/terraform/application.tf +0 -78
- data/acceptance/ubuntu_install_sh/terraform/aws.tf +0 -8
- data/acceptance/ubuntu_install_sh/terraform/variables.tf +0 -27
- data/acceptance/windows-server-2012r2-checksum/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/windows-server-2012r2-checksum/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/windows-server-2012r2-checksum/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/windows-server-2012r2-checksum/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -22
- data/acceptance/windows-server-2012r2-checksum/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -14
- data/acceptance/windows-server-2012r2-checksum/inspec/verify.rb +0 -21
- data/acceptance/windows-server-2012r2-checksum/terraform/application.tf +0 -94
- data/acceptance/windows-server-2012r2-checksum/terraform/aws.tf +0 -8
- data/acceptance/windows-server-2012r2-checksum/terraform/variables.tf +0 -16
- data/acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/metadata.rb +0 -1
- data/acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -12
- data/acceptance/windows-server-2012r2-fips/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -14
- data/acceptance/windows-server-2012r2-fips/inspec/verify.rb +0 -3
- data/acceptance/windows-server-2012r2-fips/terraform/application.tf +0 -90
- data/acceptance/windows-server-2012r2-fips/terraform/aws.tf +0 -8
- data/acceptance/windows-server-2012r2-fips/terraform/variables.tf +0 -16
- data/acceptance/windows-server-2012r2-once/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/windows-server-2012r2-once/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/windows-server-2012r2-once/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/windows-server-2012r2-once/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -13
- data/acceptance/windows-server-2012r2-once/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -14
- data/acceptance/windows-server-2012r2-once/inspec/verify.rb +0 -7
- data/acceptance/windows-server-2012r2-once/terraform/application.tf +0 -89
- data/acceptance/windows-server-2012r2-once/terraform/aws.tf +0 -8
- data/acceptance/windows-server-2012r2-once/terraform/variables.tf +0 -16
- data/acceptance/windows-server-2012r2-ps1/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/windows-server-2012r2-ps1/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/windows-server-2012r2-ps1/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -3
- data/acceptance/windows-server-2012r2-ps1/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -12
- data/acceptance/windows-server-2012r2-ps1/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -14
- data/acceptance/windows-server-2012r2-ps1/inspec/verify.rb +0 -3
- data/acceptance/windows-server-2012r2-ps1/terraform/application.tf +0 -89
- data/acceptance/windows-server-2012r2-ps1/terraform/aws.tf +0 -8
- data/acceptance/windows-server-2012r2-ps1/terraform/variables.tf +0 -16
- data/ci/before-script.sh +0 -18
- data/ci/es-infrastructure.pem.enc +0 -0
- data/ci/run-acceptance-tests.sh +0 -13
data/CONTRIBUTING.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
This project is maintained by the contribution guidelines identified for
|
|
2
|
-
[chef](https://github.com/chef/chef) project. You can find the guidelines here:
|
|
3
|
-
|
|
4
|
-
https://github.com/chef/chef/blob/master/CONTRIBUTING.md
|
|
5
|
-
|
|
6
|
-
Pull requests in this project are merged when they have two :+1:s from maintainers.
|
|
7
|
-
|
|
8
|
-
## Maintainers
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- [Thom May](https://github.com/thommay)
|
|
12
|
-
- [Patrick Wright](https://github.com/patrick-wright)
|
|
13
|
-
- [Serdar Sutay](https://github.com/sersut)
|
|
14
|
-
- [Seth Chisamore](https://github.com/schisamo)
|
data/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.9.0
|
data/acceptance/.gitignore
DELETED
data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/recipes/provision.rb
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Generate install script then write to disk for terraform to copy to the instance for execution
|
|
2
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.new(product_name: 'chef', product_version: :latest, channel: :stable, install_command_options: {download_url_override: 'https://packages.chef.io/files/stable/chef/13.2.20/ubuntu/14.04/chef_13.2.20-1_amd64.deb', cmdline_dl_dir: '/tmp/checksum'}).install_command\" > ../.acceptance_data/ubuntu_install_url.sh" do
|
|
3
|
-
cwd node['chef-acceptance']['suite-dir']
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.new(product_name: 'chef', product_version: :latest, channel: :stable, install_command_options: {download_url_override: 'https://packages.chef.io/files/stable/chef/13.2.20/ubuntu/14.04/chef_13.2.20-1_amd64.deb', checksum: '88cd274a694bfe23d255937794744d50af972097958fa681a544479e2bfb7f6b', cmdline_dl_dir: '/tmp/checksum'}).install_command\" > ../.acceptance_data/ubuntu_install_checksum.sh" do
|
|
7
|
-
cwd node['chef-acceptance']['suite-dir']
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.new(product_name: 'chef', product_version: :latest, channel: :stable, install_command_options: {cmdline_dl_dir: '/tmp/metadata'}).install_command\" > ../.acceptance_data/ubuntu_install_metadata.sh" do
|
|
11
|
-
cwd node['chef-acceptance']['suite-dir']
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
execute "bundle exec ruby -e \"require 'mixlib/install'; puts Mixlib::Install.new(product_name: 'chef', product_version: :latest, channel: :stable, install_command_options: {download_url_override: 'https://packages.chef.io/files/stable/chef/13.2.20/ubuntu/14.04/chef_13.2.20-1_amd64.deb', checksum: 'FOOOOOOOOOOOOOO', cmdline_dl_dir: '/tmp/bad'}).install_command\" > ../.acceptance_data/ubuntu_install_bad.sh" do
|
|
15
|
-
cwd node['chef-acceptance']['suite-dir']
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
execute "terraform plan" do
|
|
19
|
-
cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
execute "terraform apply" do
|
|
23
|
-
cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
|
|
24
|
-
end
|
data/acceptance/.suites/ubuntu_install_checksum/.acceptance/acceptance-cookbook/recipes/verify.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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_sh"]["primary"]["attributes"]["public_ip"]
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
execute "run inspec" do
|
|
9
|
-
command lazy { "inspec exec verify.rb -t ssh://ubuntu@#{node['ip']} -i ~/.ssh/es-infrastructure.pem" }
|
|
10
|
-
cwd "#{node['chef-acceptance']['suite-dir']}/inspec"
|
|
11
|
-
end
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Uncomment when re-running for local development
|
|
2
|
-
describe command("sudo rm -rf /tmp/metadata /tmp/checksum /tmp/bad; sudo dpkg -r chef") do
|
|
3
|
-
its("exit_status") { should eq 0 }
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
# DOWNLOAD URL TESTS
|
|
8
|
-
#
|
|
9
|
-
# No checksum provided
|
|
10
|
-
describe command("sudo /tmp/install.sh") do
|
|
11
|
-
its("stdout") { should match /Download URL override specified/ }
|
|
12
|
-
its("stdout") { should match /tmp\/checksum\/chef.* not found/ }
|
|
13
|
-
its("stdout") { should match /Thank you/ }
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Running same script again
|
|
17
|
-
describe command("sudo /tmp/install.sh") do
|
|
18
|
-
its("stdout") { should match /Download URL override specified/ }
|
|
19
|
-
its("stdout") { should match /Verifying local file/ }
|
|
20
|
-
its("stdout") { should match /Checksum not specified/ }
|
|
21
|
-
its("stdout") { should match /Thank you/ }
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Now with a valid checksum
|
|
25
|
-
describe command("sudo /tmp/install_checksum.sh") do
|
|
26
|
-
its("stdout") { should match /Download URL override specified/ }
|
|
27
|
-
its("stdout") { should match /Verifying local file/ }
|
|
28
|
-
its("stdout") { should match /Checksum match/ }
|
|
29
|
-
its("stdout") { should match /Thank you/ }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Corrupt the file we just downloaded
|
|
33
|
-
describe command("sudo chown ubuntu /tmp/checksum; sudo chown ubuntu /tmp/checksum/*; for i in /tmp/checksum/*; do echo 'oops'>>$i; done;") do
|
|
34
|
-
its("exit_status") { should eq 0 }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Run with checksum and it should download and re-verify the checksum
|
|
38
|
-
describe command("sudo /tmp/install_checksum.sh") do
|
|
39
|
-
its("stdout") { should match /Download URL override specified/ }
|
|
40
|
-
its("stdout") { should match /Verifying local file/ }
|
|
41
|
-
its("stdout") { should match /Checksum mismatch/ }
|
|
42
|
-
its("stdout") { should match /Thank you/ }
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# clean up
|
|
46
|
-
describe command("sudo dpkg -r chef") do
|
|
47
|
-
its("stdout") { should match /Removing chef/ }
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
# METADATA URL TESTS
|
|
52
|
-
#
|
|
53
|
-
# Default behavior when specifying a download location (otherwise caching is unavailable)
|
|
54
|
-
describe command("sudo /tmp/install_metadata.sh") do
|
|
55
|
-
its("stdout") { should_not match /tmp\/metadata\/chef.* exists/ }
|
|
56
|
-
its("stdout") { should match /Thank you/ }
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Running same script again
|
|
60
|
-
describe command("sudo /tmp/install_metadata.sh") do
|
|
61
|
-
its("stdout") { should match /tmp\/metadata\/chef.* exists/ }
|
|
62
|
-
its("stdout") { should match /Thank you/ }
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# clean up
|
|
66
|
-
describe command("sudo dpkg -r chef") do
|
|
67
|
-
its("stdout") { should match /Removing chef/ }
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
#
|
|
71
|
-
# DOWNLOAD URL BAD CHECKSUM TESTS
|
|
72
|
-
#
|
|
73
|
-
describe command("sudo /tmp/install_bad.sh") do
|
|
74
|
-
its("stdout") { should match /Download URL override specified/ }
|
|
75
|
-
its("stdout") { should match /tmp\/bad\/chef.* not found/ }
|
|
76
|
-
its("stdout") { should match /Package checksum mismatch/ }
|
|
77
|
-
its("exit_status") { should eq 1 }
|
|
78
|
-
end
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
data "aws_ami" "ubuntu_14_ami" {
|
|
2
|
-
most_recent = true
|
|
3
|
-
|
|
4
|
-
filter {
|
|
5
|
-
name = "owner-id"
|
|
6
|
-
values = ["099720109477"]
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
filter {
|
|
10
|
-
name = "name"
|
|
11
|
-
values = ["ubuntu/images/*/ubuntu-*-14.04-*-server-*"]
|
|
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 = ["standard"]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
filter {
|
|
30
|
-
name = "image-type"
|
|
31
|
-
values = ["machine"]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
resource "aws_instance" "mixlib_install_sh" {
|
|
36
|
-
count = 1
|
|
37
|
-
|
|
38
|
-
ami = "${data.aws_ami.ubuntu_14_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
|
-
user = "ubuntu"
|
|
53
|
-
private_key = "${file("${var.connection_private_key}")}"
|
|
54
|
-
agent = "${var.connection_agent}"
|
|
55
|
-
timeout = "10m"
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
tags {
|
|
59
|
-
# ChefOps's AWS standard tags:
|
|
60
|
-
X-Dept = "EngServ"
|
|
61
|
-
X-Contact = "pwright"
|
|
62
|
-
X-Production = "false"
|
|
63
|
-
X-Environment = "acceptance"
|
|
64
|
-
X-Application = "mixlib-install"
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
provisioner "file" {
|
|
68
|
-
source = "../../.acceptance_data/ubuntu_install_url.sh"
|
|
69
|
-
destination = "/tmp/install.sh"
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
provisioner "file" {
|
|
73
|
-
source = "../../.acceptance_data/ubuntu_install_checksum.sh"
|
|
74
|
-
destination = "/tmp/install_checksum.sh"
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
provisioner "file" {
|
|
78
|
-
source = "../../.acceptance_data/ubuntu_install_metadata.sh"
|
|
79
|
-
destination = "/tmp/install_metadata.sh"
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
provisioner "file" {
|
|
83
|
-
source = "../../.acceptance_data/ubuntu_install_bad.sh"
|
|
84
|
-
destination = "/tmp/install_bad.sh"
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
provisioner "remote-exec" {
|
|
88
|
-
inline = [
|
|
89
|
-
"chmod +x /tmp/install.sh",
|
|
90
|
-
"chmod +x /tmp/install_checksum.sh",
|
|
91
|
-
"chmod +x /tmp/install_metadata.sh",
|
|
92
|
-
"chmod +x /tmp/install_bad.sh",
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
# Used to indicidate whether the environment should be treated as "prod"
|
|
13
|
-
# This is mainly used for the `X-Production` AWS tag.
|
|
14
|
-
variable "production" {
|
|
15
|
-
default = "false"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
# SSH Connection info used for remote provisioning instances
|
|
19
|
-
variable "connection_agent" {
|
|
20
|
-
description = "Set to false to disable using ssh-agent to authenticate"
|
|
21
|
-
default = false
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
variable "connection_private_key" {
|
|
25
|
-
description = "File path to AWS keypair private key to provision with"
|
|
26
|
-
default = "~/.ssh/es-infrastructure.pem"
|
|
27
|
-
}
|
data/acceptance/.suites/windows-nano/.acceptance/acceptance-cookbook/libraries/chef_extentions.rb
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
class Chef
|
|
2
|
-
class Recipe
|
|
3
|
-
def run_tf(command)
|
|
4
|
-
execute "terraform #{command}" do
|
|
5
|
-
cwd "#{node['chef-acceptance']['suite-dir']}/terraform"
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
class Resource
|
|
11
|
-
def instance_ip
|
|
12
|
-
@instance_ip ||= tf_state["modules"].first["resources"]["aws_instance.windows_server_nano_ami"]["primary"]["attributes"]["public_ip"]
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def instance_id
|
|
16
|
-
@instance_id ||= tf_state["modules"].first["resources"]["aws_instance.windows_server_nano_ami"]["primary"]["id"]
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def windows_password
|
|
20
|
-
@windows_password ||= begin
|
|
21
|
-
require "aws-sdk"
|
|
22
|
-
|
|
23
|
-
ec2 = Aws::EC2::Resource.new
|
|
24
|
-
instance = ec2.instance(instance_id)
|
|
25
|
-
instance.wait_until_running
|
|
26
|
-
|
|
27
|
-
# AWS periodically needs more time to retrieve the windows password. Retry.
|
|
28
|
-
time = 3 * 60 # try up to 3 minutes
|
|
29
|
-
interval = 5 # every 5 seconds
|
|
30
|
-
tries = time / interval
|
|
31
|
-
begin
|
|
32
|
-
password = instance.decrypt_windows_password("#{ENV['HOME']}/.ssh/es-infrastructure.pem")
|
|
33
|
-
rescue RuntimeError => e
|
|
34
|
-
if e.message =~ /password not available yet/
|
|
35
|
-
unless (tries -= 1).zero?
|
|
36
|
-
sleep interval
|
|
37
|
-
retry
|
|
38
|
-
end
|
|
39
|
-
else
|
|
40
|
-
raise e
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
password
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def run_shell(script, type = :powershell)
|
|
49
|
-
require "winrm"
|
|
50
|
-
|
|
51
|
-
opts = {
|
|
52
|
-
endpoint: "http://#{instance_ip}:5985/wsman",
|
|
53
|
-
user: "Administrator",
|
|
54
|
-
password: windows_password
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
conn = WinRM::Connection.new(opts)
|
|
58
|
-
|
|
59
|
-
conn.shell(type) do |shell|
|
|
60
|
-
output = shell.run(script) do |stdout, stderr|
|
|
61
|
-
STDOUT.print stdout
|
|
62
|
-
STDERR.print stderr
|
|
63
|
-
end
|
|
64
|
-
Chef::Log.info "The script exited with exit code #{output.exitcode}"
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
private
|
|
69
|
-
|
|
70
|
-
def tf_state
|
|
71
|
-
@tfstate ||= JSON.parse(::File.read("#{node['chef-acceptance']['suite-dir']}/terraform/terraform.tfstate"))
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
run_tf "destroy -force"
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
run_tf "plan"
|
|
2
|
-
|
|
3
|
-
run_tf "apply"
|
|
4
|
-
|
|
5
|
-
ruby_block "install via winrm api" do
|
|
6
|
-
block do
|
|
7
|
-
# We do this hackery to ensure we load mixlib-install from source
|
|
8
|
-
install_command = "install -project angry-omnibus-toolchain -channel current -version 1.1.57"
|
|
9
|
-
|
|
10
|
-
shellout_command = <<-EOF.gsub /^\s*/, ""
|
|
11
|
-
bundle exec ruby -e "require 'mixlib/install';\
|
|
12
|
-
puts Mixlib::Install.install_ps1, '#{install_command}'"
|
|
13
|
-
EOF
|
|
14
|
-
|
|
15
|
-
require "mixlib/shellout"
|
|
16
|
-
|
|
17
|
-
print_script = Mixlib::ShellOut.new(
|
|
18
|
-
shellout_command,
|
|
19
|
-
cwd: node['chef-acceptance']['suite-dir']
|
|
20
|
-
)
|
|
21
|
-
print_script.run_command
|
|
22
|
-
|
|
23
|
-
run_shell(print_script.stdout)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
ruby_block "set omnibus paths" do
|
|
28
|
-
block do
|
|
29
|
-
toolchain_install_dir = File.join('c:', 'opscode', 'angry-omnibus-toolchain')
|
|
30
|
-
|
|
31
|
-
omnibus_env = []
|
|
32
|
-
omnibus_env << File.join(toolchain_install_dir, 'embedded', 'bin')
|
|
33
|
-
omnibus_env << File.join(toolchain_install_dir, 'embedded', 'bin', 'mingw64', 'bin')
|
|
34
|
-
omnibus_env << File.join(toolchain_install_dir, 'embedded', 'bin', 'usr', 'bin')
|
|
35
|
-
omnibus_env << File.join(toolchain_install_dir, 'embedded', 'git', 'cmd')
|
|
36
|
-
omnibus_env << File.join(toolchain_install_dir, 'embedded', 'git', 'mingw64', 'libexec', 'git-core')
|
|
37
|
-
|
|
38
|
-
# Join paths by semi-colons then replace forwardslashes with backslashes
|
|
39
|
-
omnibus_path = omnibus_env.join(";").gsub("/", "\\")
|
|
40
|
-
|
|
41
|
-
# Permanently set omnibus path to machine PATH
|
|
42
|
-
script = <<-EOF.gsub /^\s*/, ""
|
|
43
|
-
$env:path += ';#{omnibus_path}'
|
|
44
|
-
setx PATH $env:path /M
|
|
45
|
-
EOF
|
|
46
|
-
|
|
47
|
-
run_shell(script)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
execute "run inspec" do
|
|
2
|
-
command lazy { "inspec exec verify.rb -t winrm://Administrator@#{instance_ip} --password $WINDOWS_PASSWORD" }
|
|
3
|
-
cwd "#{node['chef-acceptance']['suite-dir']}/inspec"
|
|
4
|
-
environment(
|
|
5
|
-
lazy {
|
|
6
|
-
{ "WINDOWS_PASSWORD" => windows_password }
|
|
7
|
-
}
|
|
8
|
-
)
|
|
9
|
-
end
|