Skip to content

Commit

Permalink
Revert "feat: Implements placement options and license specifications (
Browse files Browse the repository at this point in the history
…#607)"

This reverts commit 9a269b4.
  • Loading branch information
damacus authored Nov 27, 2023
1 parent 9a269b4 commit 8047e9b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 75 deletions.
37 changes: 0 additions & 37 deletions lib/kitchen/driver/aws/instance_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,43 +189,6 @@ def ec2_instance_data
i[:placement] = { tenancy: }
end
end
placement = config[:placement]
if placement
unless i.key?(:placement)
i[:placement] = {}
end
if placement[:affinity]
i[:placement][:affinity] = placement[:affinity]
end
if placement[:availability_zone]
i[:placement][:availability_zone] = placement[:availability_zone]
end
if placement[:group_id] && !placement[:group_name]
i[:placement][:group_id] = placement[:group_id]
end
if placement[:group_name] && !placement[:group_id]
i[:placement][:group_name] = placement[:group_name]
end
if placement[:host_id]
i[:placement][:host_id] = placement[:host_id]
end
if placement[:host_resource_group_arn]
i[:placement][:host_resource_group_arn] = placement[:host_resource_group_arn]
end
if placement[:partition_number]
i[:placement][:partition_number] = placement[:partition_number]
end
if placement[:tenancy]
i[:placement][:tenancy] = placement[:tenancy]
end
end
license_specifications = config[:licenses]
if license_specifications
i[:licenses] = {}
license_specifications.each do |license_configuration_arn|
i[:licenses].append({ license_configuration_arn: license_configuration_arn[:license_configuration_arn] })
end
end
unless config[:instance_initiated_shutdown_behavior].nil? ||
config[:instance_initiated_shutdown_behavior].empty?
i[:instance_initiated_shutdown_behavior] = config[:instance_initiated_shutdown_behavior]
Expand Down
39 changes: 1 addition & 38 deletions spec/kitchen/driver/aws/instance_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -675,37 +675,6 @@
}
end

context "when placement host resource group arn and licenses are provided" do
let(:config) do
{
region: "eu-east-1",
placement: {
host_resource_group_arn: "arn:aws:ec2:us-east-1:123456789012:resource-group/my-group",
},
licenses: [
{
license_configuration_arn: "arn:aws:ec2:us-east-1:123456789012:license-configuration/my-license",
}
],
}
end

it "adds the region to it in the instance data" do
expect(generator.ec2_instance_data).to eq(
instance_type: nil,
ebs_optimized: nil,
image_id: nil,
key_name: nil,
subnet_id: nil,
private_ip_address: nil,
max_count: 1,
min_count: 1,
placement: { availability_zone: "eu-east-1c",
tenancy: "dedicated" }
)
end
end

it "returns the maximum data" do
expect(generator.ec2_instance_data).to eq(
instance_type: "micro",
Expand All @@ -725,9 +694,6 @@
},
],
iam_instance_profile: { name: "iam-123" },
licenses: [{
license_configuration_arn: "arn:aws:ec2:us-east-1:123456789012:license-configuration/my-license",
}],
network_interfaces: [{
device_index: 0,
associate_public_ip_address: true,
Expand All @@ -736,10 +702,7 @@
groups: ["sg-789"],
private_ip_address: "0.0.0.0",
}],
placement: {
availability_zone: "eu-west-1a",
host_resource_group_arn: "arn:aws:ec2:us-east-1:123456789012:resource-group/my-group"
},
placement: { availability_zone: "eu-west-1a" },
user_data: Base64.encode64("foo"),
max_count: 1,
min_count: 1,
Expand Down

0 comments on commit 8047e9b

Please sign in to comment.