cloud-mu 3.1.1 → 3.1.2beta2
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 +4 -4
- data/Berksfile.lock +179 -0
- data/bin/mu-adopt +1 -1
- data/bin/mu-azure-tests +46 -0
- data/bin/mu-cleanup +3 -1
- data/bin/mu-configure +7 -0
- data/cloud-mu.gemspec +4 -3
- data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
- data/extras/clean-stock-amis +0 -0
- data/extras/generate-stock-images +0 -0
- data/extras/list-stock-amis +0 -0
- data/extras/vault_tools/export_vaults.sh +0 -0
- data/extras/vault_tools/recreate_vaults.sh +0 -0
- data/extras/vault_tools/test_vaults.sh +0 -0
- data/modules/mu/cleanup.rb +15 -3
- data/modules/mu/clouds/aws/bucket.rb +6 -0
- data/modules/mu/clouds/aws/endpoint.rb +2 -0
- data/modules/mu/clouds/aws/firewall_rule.rb +31 -0
- data/modules/mu/clouds/aws/function.rb +45 -2
- data/modules/mu/clouds/aws/loadbalancer.rb +3 -1
- data/modules/mu/clouds/aws/role.rb +3 -1
- data/modules/mu/clouds/aws/server.rb +10 -4
- data/modules/mu/clouds/aws/server_pool.rb +4 -3
- data/modules/mu/clouds/aws/vpc.rb +28 -3
- data/modules/mu/clouds/google/function.rb +679 -0
- data/modules/mu/clouds/google/vpc.rb +1 -1
- data/modules/mu/clouds/google.rb +54 -9
- data/modules/mu/config/function.rb +12 -40
- data/modules/mu/config.rb +2 -1
- data/modules/mu/groomers/ansible.rb +7 -5
- data/modules/mu/kittens.rb +22134 -0
- data/modules/mu/mu.yaml.rb +282 -0
- data/modules/mu.rb +4 -1
- metadata +41 -20
@@ -1924,24 +1924,46 @@ MU.log "association I don't understand in #{@cloud_id}", MU::WARN, details: rtb_
|
|
1924
1924
|
|
1925
1925
|
# Remove all network interfaces associated with the currently loaded deployment.
|
1926
1926
|
# @param noop [Boolean]: If true, will only print what would be done
|
1927
|
-
# @param
|
1927
|
+
# @param filters [Array<Hash>]: EC2 tags to filter against when search for resources to purge
|
1928
1928
|
# @param region [String]: The cloud provider region
|
1929
1929
|
# @return [void]
|
1930
|
-
def self.purge_interfaces(noop = false,
|
1930
|
+
def self.purge_interfaces(noop = false, filters = [{name: "tag:MU-ID", values: [MU.deploy_id]}], region: MU.curRegion, credentials: nil)
|
1931
1931
|
resp = MU::Cloud::AWS.ec2(credentials: credentials, region: region).describe_network_interfaces(
|
1932
|
-
filters:
|
1932
|
+
filters: filters
|
1933
1933
|
)
|
1934
1934
|
ifaces = resp.data.network_interfaces
|
1935
1935
|
|
1936
1936
|
return if ifaces.nil? or ifaces.size == 0
|
1937
1937
|
|
1938
1938
|
ifaces.each { |iface|
|
1939
|
+
if iface.vpc_id
|
1940
|
+
default_sg_resp = MU::Cloud::AWS.ec2(region: region, credentials: credentials).describe_security_groups(
|
1941
|
+
filters: [
|
1942
|
+
{ name: "group-name", values: ["default"] },
|
1943
|
+
{ name: "vpc-id", values: [iface.vpc_id] }
|
1944
|
+
]
|
1945
|
+
).security_groups
|
1946
|
+
if default_sg_resp and default_sg_resp.size == 1
|
1947
|
+
default_sg = default_sg_resp.first.group_id
|
1948
|
+
if iface.groups.size != 1 or
|
1949
|
+
iface.groups.first.group_id != default_sg
|
1950
|
+
MU.log "Removing extra security groups from ENI #{iface.network_interface_id}"
|
1951
|
+
MU::Cloud::AWS.ec2(credentials: credentials, region: region).modify_network_interface_attribute(
|
1952
|
+
network_interface_id: iface.network_interface_id,
|
1953
|
+
groups: [default_sg]
|
1954
|
+
)
|
1955
|
+
end
|
1956
|
+
end
|
1957
|
+
end
|
1939
1958
|
begin
|
1940
1959
|
if iface.attachment and iface.attachment.status == "attached"
|
1941
1960
|
MU.log "Detaching Network Interface #{iface.network_interface_id} from #{iface.attachment.instance_owner_id}"
|
1942
1961
|
tried_lbs = false
|
1943
1962
|
begin
|
1944
1963
|
MU::Cloud::AWS.ec2(credentials: credentials, region: region).detach_network_interface(attachment_id: iface.attachment.attachment_id) if !noop
|
1964
|
+
rescue Aws::EC2::Errors::OperationNotPermitted => e
|
1965
|
+
MU.log "Can't detach #{iface.network_interface_id}: #{e.message}", MU::WARN, details: iface.attachment
|
1966
|
+
next
|
1945
1967
|
rescue Aws::EC2::Errors::InvalidAttachmentIDNotFound => e
|
1946
1968
|
# suits me just fine
|
1947
1969
|
rescue Aws::EC2::Errors::AuthFailure => e
|
@@ -1997,6 +2019,9 @@ MU.log "association I don't understand in #{@cloud_id}", MU::WARN, details: rtb_
|
|
1997
2019
|
if retries < 19
|
1998
2020
|
loglevel = (retries > 0 and (retries % 3) == 0) ? MU::NOTICE : MU::DEBUG
|
1999
2021
|
MU.log "#{e.message} (retry #{retries.to_s}/20)", loglevel
|
2022
|
+
if loglevel == MU::NOTICE
|
2023
|
+
MU::Cloud::AWS::VPC.purge_interfaces(noop, [{name: "subnet-id", values: [subnet.subnet_id]}], region: region, credentials: credentials)
|
2024
|
+
end
|
2000
2025
|
sleep 30
|
2001
2026
|
retries = retries + 1
|
2002
2027
|
retry
|