From b8043b56c570cc81e31a6788892a131716638234 Mon Sep 17 00:00:00 2001 From: ramonskie Date: Mon, 25 Nov 2024 15:02:39 +0100 Subject: [PATCH 1/2] remove anything related to building softlayer. --- .../lib/bosh/stemcell/build_environment.rb | 2 - .../lib/bosh/stemcell/infrastructure.rb | 17 --- .../lib/bosh/stemcell/stage_collection.rb | 22 --- ...-list-ubuntu-noble-softlayer-additions.txt | 14 -- .../spec/bosh/stemcell/infrastructure_spec.rb | 16 --- .../bosh/stemcell/stage_collection_spec.rb | 29 ---- bosh-stemcell/spec/stemcells/azure_spec.rb | 1 - bosh-stemcell/spec/stemcells/cis_spec.rb | 1 - bosh-stemcell/spec/stemcells/fips_spec.rb | 21 --- .../spec/stemcells/softlayer_spec.rb | 19 --- bosh-stemcell/spec/stemcells/stig_spec.rb | 7 - .../spec/stemcells/ubuntu_noble_spec.rb | 136 ------------------ .../spec/support/os_image_shared_examples.rb | 14 +- bosh-stemcell/spec/support/stemcell_image.rb | 40 ++---- .../bosh_softlayer_agent_settings/apply.sh | 34 ----- .../apply.sh | 68 --------- .../config.sh | 17 --- .../apply.sh | 125 ---------------- .../config.sh | 8 -- .../system_softlayer_multipath_tools/apply.sh | 17 --- .../assets/etc/multipath.conf | 11 -- .../stages/system_softlayer_netplan/apply.sh | 8 -- .../system_softlayer_open_iscsi/apply.sh | 20 --- 23 files changed, 11 insertions(+), 636 deletions(-) delete mode 100644 bosh-stemcell/spec/assets/dpkg-list-ubuntu-noble-softlayer-additions.txt delete mode 100755 bosh-stemcell/spec/stemcells/softlayer_spec.rb delete mode 100755 stemcell_builder/stages/bosh_softlayer_agent_settings/apply.sh delete mode 100755 stemcell_builder/stages/image_create_softlayer_two_partitions/apply.sh delete mode 100755 stemcell_builder/stages/image_create_softlayer_two_partitions/config.sh delete mode 100755 stemcell_builder/stages/image_install_grub_softlayer_two_partitions/apply.sh delete mode 100755 stemcell_builder/stages/image_install_grub_softlayer_two_partitions/config.sh delete mode 100755 stemcell_builder/stages/system_softlayer_multipath_tools/apply.sh delete mode 100644 stemcell_builder/stages/system_softlayer_multipath_tools/assets/etc/multipath.conf delete mode 100755 stemcell_builder/stages/system_softlayer_netplan/apply.sh delete mode 100755 stemcell_builder/stages/system_softlayer_open_iscsi/apply.sh diff --git a/bosh-stemcell/lib/bosh/stemcell/build_environment.rb b/bosh-stemcell/lib/bosh/stemcell/build_environment.rb index 8e1488c2b..f81f2e678 100644 --- a/bosh-stemcell/lib/bosh/stemcell/build_environment.rb +++ b/bosh-stemcell/lib/bosh/stemcell/build_environment.rb @@ -189,8 +189,6 @@ def exclude_exclusions ' --tag ~exclude_on_cloudstack' when 'azure' ' --tag ~exclude_on_azure' - when 'softlayer' - ' --tag ~exclude_on_softlayer' when 'google' ' --tag ~exclude_on_google' else diff --git a/bosh-stemcell/lib/bosh/stemcell/infrastructure.rb b/bosh-stemcell/lib/bosh/stemcell/infrastructure.rb index d728c7a42..1ff5ee35d 100644 --- a/bosh-stemcell/lib/bosh/stemcell/infrastructure.rb +++ b/bosh-stemcell/lib/bosh/stemcell/infrastructure.rb @@ -18,8 +18,6 @@ def self.for(name) Vcloud.new when 'azure' Azure.new - when 'softlayer' - Softlayer.new when 'cloudstack' CloudStack.new when 'null' @@ -212,20 +210,5 @@ def additional_cloud_properties end end - class Softlayer < Base - def initialize - super( - name: 'softlayer', - hypervisor: 'esxi', - default_disk_size: 25600, - disk_formats: ['ovf'], - stemcell_formats: ['softlayer-ovf'] - ) - end - - def additional_cloud_properties - {'root_device_name' => '/dev/sda1'} - end - end end end diff --git a/bosh-stemcell/lib/bosh/stemcell/stage_collection.rb b/bosh-stemcell/lib/bosh/stemcell/stage_collection.rb index e548f1ce7..ae4520a82 100644 --- a/bosh-stemcell/lib/bosh/stemcell/stage_collection.rb +++ b/bosh-stemcell/lib/bosh/stemcell/stage_collection.rb @@ -65,8 +65,6 @@ def build_stemcell_image_stages warden_stages when Infrastructure::Azure then azure_stages - when Infrastructure::Softlayer then - softlayer_stages end stages.concat(finish_stemcell_stages) @@ -238,26 +236,6 @@ def azure_stages ] end - def softlayer_stages - [ - :system_network, - :system_softlayer_open_iscsi, - :system_softlayer_multipath_tools, - :system_softlayer_netplan, - :system_parameters, - :bosh_clean, - :bosh_harden, - :bosh_softlayer_agent_settings, - :bosh_config_root_ssh_login, - :bosh_clean_ssh, - # when adding a stage that changes files in the image, do so before - # this line. Image create will make the image so any changes to the - # filesystem after it won't apply. - :image_create_softlayer_two_partitions, - :image_install_grub_softlayer_two_partitions, - ] - end - def finish_stemcell_stages [ :bosh_package_list, diff --git a/bosh-stemcell/spec/assets/dpkg-list-ubuntu-noble-softlayer-additions.txt b/bosh-stemcell/spec/assets/dpkg-list-ubuntu-noble-softlayer-additions.txt deleted file mode 100644 index 3135ab803..000000000 --- a/bosh-stemcell/spec/assets/dpkg-list-ubuntu-noble-softlayer-additions.txt +++ /dev/null @@ -1,14 +0,0 @@ -busybox-initramfs -initramfs-tools -initramfs-tools-core -libibverbs1:amd64 -libnl-route-3-200:amd64 -librados2 -liburcu6:amd64 -multipath-tools -sg3-utils-udev -libisns0:amd64 -open-iscsi -libnetplan0:amd64 -netplan.io -python3-netifaces diff --git a/bosh-stemcell/spec/bosh/stemcell/infrastructure_spec.rb b/bosh-stemcell/spec/bosh/stemcell/infrastructure_spec.rb index ba607f41d..dbd3614df 100644 --- a/bosh-stemcell/spec/bosh/stemcell/infrastructure_spec.rb +++ b/bosh-stemcell/spec/bosh/stemcell/infrastructure_spec.rb @@ -12,7 +12,6 @@ module Bosh::Stemcell expect(Infrastructure.for('warden')).to be_a(Infrastructure::Warden) expect(Infrastructure.for('vcloud')).to be_a(Infrastructure::Vcloud) expect(Infrastructure.for('azure')).to be_a(Infrastructure::Azure) - expect(Infrastructure.for('softlayer')).to be_a(Infrastructure::Softlayer) expect(Infrastructure.for('cloudstack')).to be_a(Infrastructure::CloudStack) expect(Infrastructure.for('null')).to be_an(Infrastructure::NullInfrastructure) end @@ -72,7 +71,6 @@ module Bosh::Stemcell expect(subject).to_not eq(Infrastructure.for('aws')) expect(subject).to_not eq(Infrastructure.for('vsphere')) expect(subject).to_not eq(Infrastructure.for('azure')) - expect(subject).to_not eq(Infrastructure.for('softlayer')) end it 'defaults to no additional cloud properties' do @@ -185,18 +183,4 @@ module Bosh::Stemcell end end - describe Infrastructure::Softlayer do - its(:name) { should eq('softlayer') } - its(:hypervisor) { should eq('esxi') } - its(:default_disk_size) { should eq(25600) } - its(:disk_formats) { should eq(['ovf']) } - its(:stemcell_formats) { should eq(['softlayer-ovf']) } - - it { should eq Infrastructure.for('softlayer') } - it { should_not eq Infrastructure.for('vsphere') } - - it 'has softlayer specific additional cloud properties' do - expect(subject.additional_cloud_properties).to eq({'root_device_name' => '/dev/sda1'}) - end - end end diff --git a/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb b/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb index 9238ba2ed..178dc5f90 100644 --- a/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb +++ b/bosh-stemcell/spec/bosh/stemcell/stage_collection_spec.rb @@ -323,35 +323,6 @@ module Bosh::Stemcell end end - context 'when using softlayer' do - let(:infrastructure) { Infrastructure.for('softlayer') } - - context 'when the operating system is Ubuntu' do - let(:operating_system) { OperatingSystem.for('ubuntu') } - - it 'has the correct stages' do - expect(stage_collection.build_stemcell_image_stages).to eq( - [ - :system_network, - :system_softlayer_open_iscsi, - :system_softlayer_multipath_tools, - :system_softlayer_netplan, - :system_parameters, - :bosh_clean, - :bosh_harden, - :bosh_softlayer_agent_settings, - :bosh_config_root_ssh_login, - :bosh_clean_ssh, - :image_create_softlayer_two_partitions, - :image_install_grub_softlayer_two_partitions, - :bosh_package_list - ] - ) - expect(stage_collection.package_stemcell_stages('ovf')).to eq(vmware_package_stemcell_steps) - end - end - end - context 'when using Warden' do let(:infrastructure) { Infrastructure.for('warden') } let(:build_stemcell_image_stages) { diff --git a/bosh-stemcell/spec/stemcells/azure_spec.rb b/bosh-stemcell/spec/stemcells/azure_spec.rb index ca7eb9dbe..eeff069eb 100755 --- a/bosh-stemcell/spec/stemcells/azure_spec.rb +++ b/bosh-stemcell/spec/stemcells/azure_spec.rb @@ -28,7 +28,6 @@ exclude_on_vsphere: true, exclude_on_warden: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } diff --git a/bosh-stemcell/spec/stemcells/cis_spec.rb b/bosh-stemcell/spec/stemcells/cis_spec.rb index 4ba7afa31..5fae52988 100644 --- a/bosh-stemcell/spec/stemcells/cis_spec.rb +++ b/bosh-stemcell/spec/stemcells/cis_spec.rb @@ -62,7 +62,6 @@ exclude_on_warden: true, exclude_on_openstack: true, exclude_on_cloudstack: true, - exclude_on_softlayer: true, } do it 'confirms that all CIS test cases ran' do expect($cis_test_cases.to_a).to match_array(base_cis_test_cases) diff --git a/bosh-stemcell/spec/stemcells/fips_spec.rb b/bosh-stemcell/spec/stemcells/fips_spec.rb index 326a44a4c..5aaef4f12 100644 --- a/bosh-stemcell/spec/stemcells/fips_spec.rb +++ b/bosh-stemcell/spec/stemcells/fips_spec.rb @@ -60,7 +60,6 @@ let(:dpkg_list_vsphere_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-jammy-vsphere-additions.txt')).map(&:chop) } let(:dpkg_list_azure_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-jammy-azure-additions.txt')).map(&:chop) } let(:dpkg_list_cloudstack_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-jammy-cloudstack-additions.txt')).map(&:chop) } - let(:dpkg_list_softlayer_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-jammy-softlayer-additions.txt')).map(&:chop) } let(:infrastructure) { ENV['STEMCELL_INFRASTRUCTURE'] } describe command(dpkg_list_packages), { @@ -71,7 +70,6 @@ exclude_on_warden: true, exclude_on_azure: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus aws-specific kernel packages' do skip "Test skipped due to generic kernel" unless use_iaas_kernel @@ -88,7 +86,6 @@ exclude_on_vcloud: true, exclude_on_vsphere: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages for alicloud, aws, openstack, warden' do skip "Test skipped due to IAAS-specific kernel" if use_iaas_kernel @@ -105,7 +102,6 @@ exclude_on_warden: true, exclude_on_azure: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus google-specific packages' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_fips_ubuntu, dpkg_list_google_ubuntu)) @@ -120,7 +116,6 @@ exclude_on_warden: true, exclude_on_azure: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus vsphere-specific packages' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_fips_ubuntu, dpkg_list_vsphere_ubuntu)) @@ -136,7 +131,6 @@ exclude_on_google: true, exclude_on_warden: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus azure-specific packages' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_fips_ubuntu, dpkg_list_azure_ubuntu)) @@ -158,20 +152,5 @@ end end - describe command(dpkg_list_packages), { - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_vcloud: true, - exclude_on_vsphere: true, - exclude_on_google: true, - exclude_on_warden: true, - exclude_on_azure: true, - exclude_on_openstack: true, - } do - it 'contains only the base set of packages plus softlayer-specific packages' do - expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_fips_ubuntu, dpkg_list_softlayer_ubuntu)) - end - end end end diff --git a/bosh-stemcell/spec/stemcells/softlayer_spec.rb b/bosh-stemcell/spec/stemcells/softlayer_spec.rb deleted file mode 100755 index 8283bfe8c..000000000 --- a/bosh-stemcell/spec/stemcells/softlayer_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'spec_helper' - -describe 'Softlayer Stemcell', stemcell_image: true do - it_behaves_like 'udf module is disabled' - - context 'installed by system_parameters' do - describe file('/var/vcap/bosh/etc/infrastructure') do - its(:content) { should include('softlayer') } - end - end - - context 'installed by base_ssh' do - describe 'disallows password authentication' do - subject { file('/etc/ssh/sshd_config') } - - its(:content) { should match /^PasswordAuthentication no$/ } - end - end -end diff --git a/bosh-stemcell/spec/stemcells/stig_spec.rb b/bosh-stemcell/spec/stemcells/stig_spec.rb index 2f3289c6d..95ceab4f3 100644 --- a/bosh-stemcell/spec/stemcells/stig_spec.rb +++ b/bosh-stemcell/spec/stemcells/stig_spec.rb @@ -142,13 +142,6 @@ ] end - case ENV['IAAS'] - when 'softlayer' - expected_stig_test_cases = expected_stig_test_cases - [ - 'V-38613' - ] - end - expect($stig_test_cases.to_a).to match_array expected_stig_test_cases end end diff --git a/bosh-stemcell/spec/stemcells/ubuntu_noble_spec.rb b/bosh-stemcell/spec/stemcells/ubuntu_noble_spec.rb index a20d38337..bd22a22cb 100644 --- a/bosh-stemcell/spec/stemcells/ubuntu_noble_spec.rb +++ b/bosh-stemcell/spec/stemcells/ubuntu_noble_spec.rb @@ -9,7 +9,6 @@ linux_version_regex = 's/linux-(.+)-([0-9]+).([0-9]+).([0-9]+)-([0-9]+)/linux-\1-\2.\3/' context 'installed by image_install_grub', { - exclude_on_softlayer: true, exclude_on_vsphere: true, exclude_on_google: true, exclude_on_aws: true, @@ -61,7 +60,6 @@ end context 'installed by image_install_grub', { - exclude_on_softlayer: true, } do describe file('/boot/efi/EFI/grub/grub.cfg') do it { should be_file } @@ -92,41 +90,6 @@ end end - context 'installed by image_install_grub_softlayer_two_partitions', { - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_google: true, - exclude_on_vsphere: true, - exclude_on_vcloud: true, - exclude_on_warden: true, - exclude_on_openstack: true, - exclude_on_azure: true, - } do - describe file(grub_cfg_path) do - it { should be_file } - its(:content) { should match 'set default="0"' } - its(:content) { should match(/^set root=\(hd0,2\)$/) } - its(:content) { should match %r{linux\t/vmlinuz-\S+-generic root=UUID=\S* ro } } - its(:content) { should match ' selinux=0' } - its(:content) { should match ' cgroup_enable=memory swapaccount=1' } - its(:content) { should match ' console=ttyS0,115200n8' } - its(:content) { should match ' earlyprintk=ttyS0 rootdelay=300' } - its(:content) { should match %r{initrd\t/initrd.img-\S+-generic} } - - it('should set the grub menu password (stig: V-38585)') { expect(subject.content).to match /password_pbkdf2 vcap/ } - it('should be of mode 600 (stig: V-38583)') { expect(subject).to be_mode(0600) } - it('should be owned by root (stig: V-38579)') { expect(subject).to be_owned_by('root') } - it('should be grouped into root (stig: V-38581)') { expect(subject.group).to eq('root') } - it('audits processes that start prior to auditd (CIS-8.1.3)') { expect(subject.content).to match ' audit=1' } - end - - describe file('/boot/grub/menu.lst') do - before { skip 'until alicloud/aws/openstack stop clobbering the symlink with "update-grub"' } - it { should be_linked_to('./grub.cfg') } - end - end - context 'installs recent version of unshare so it gets the -p flag', { exclude_on_alicloud: true, exclude_on_aws: true, @@ -136,7 +99,6 @@ exclude_on_vcloud: true, exclude_on_vsphere: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do context 'so we can run upstart in as PID 1 in the container' do describe file('/var/vcap/bosh/bin/unshare') do @@ -199,7 +161,6 @@ exclude_on_vcloud: true, exclude_on_warden: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/etc/network/interfaces') do it { should be_file } @@ -217,7 +178,6 @@ exclude_on_vsphere: true, exclude_on_warden: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do describe file('/etc/network/interfaces') do it { should be_file } @@ -235,7 +195,6 @@ exclude_on_warden: true, exclude_on_openstack: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe package('open-vm-tools') do it { should be_installed } @@ -247,54 +206,6 @@ end end - context 'installed by system_softlayer_open_iscsi', { - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_google: true, - exclude_on_vsphere: true, - exclude_on_vcloud: true, - exclude_on_warden: true, - exclude_on_openstack: true, - exclude_on_azure: true, - } do - describe package('open-iscsi') do - it { should be_installed } - end - end - - context 'installed by system_softlayer_multipath_tools', { - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_google: true, - exclude_on_vsphere: true, - exclude_on_vcloud: true, - exclude_on_warden: true, - exclude_on_openstack: true, - exclude_on_azure: true, - } do - describe package('multipath-tools') do - it { should be_installed } - end - end - - context 'installed by system_softlayer_netplan', { - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_google: true, - exclude_on_vsphere: true, - exclude_on_vcloud: true, - exclude_on_warden: true, - exclude_on_openstack: true, - exclude_on_azure: true, - } do - describe package('netplan.io') do - it { should be_installed } - end - end - context 'installed by image_vsphere_cdrom stage', { exclude_on_alicloud: true, exclude_on_aws: true, @@ -304,7 +215,6 @@ exclude_on_warden: true, exclude_on_openstack: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/etc/udev/rules.d/60-cdrom_id.rules') do it { should be_file } @@ -354,7 +264,6 @@ exclude_on_vsphere: true, exclude_on_warden: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } @@ -371,7 +280,6 @@ exclude_on_vsphere: true, exclude_on_warden: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } @@ -388,7 +296,6 @@ exclude_on_vsphere: true, exclude_on_warden: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } @@ -405,7 +312,6 @@ exclude_on_vsphere: true, exclude_on_warden: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } @@ -424,7 +330,6 @@ exclude_on_openstack: true, exclude_on_warden: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } @@ -432,25 +337,6 @@ end end - context 'installed by bosh_softlayer_agent_settings', { - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_google: true, - exclude_on_vcloud: true, - exclude_on_vsphere: true, - exclude_on_warden: true, - exclude_on_azure: true, - exclude_on_openstack: true, - } do - describe file('/var/vcap/bosh/agent.json') do - it { should be_valid_json_file } - its(:content) { should match('"Type": "HTTP"') } - its(:content) { should match('"UserDataPath": "/rest/v3.1/SoftLayer_Resource_Metadata/getUserMetadata.json"') } - its(:content) { should match('"UseRegistry": true') } - end - end - context 'installed by bosh_cloudstack_agent_settings', { exclude_on_aws: true, exclude_on_vcloud: true, @@ -459,7 +345,6 @@ exclude_on_azure: true, exclude_on_openstack: true, exclude_on_google: true, - exclude_on_softlayer: true, } do describe file('/var/vcap/bosh/agent.json') do it { should be_valid_json_file } @@ -499,7 +384,6 @@ let(:dpkg_list_vsphere_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-noble-vsphere-additions.txt')).map(&:chop) } let(:dpkg_list_azure_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-noble-azure-additions.txt')).map(&:chop) } let(:dpkg_list_cloudstack_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-noble-cloudstack-additions.txt')).map(&:chop) } - let(:dpkg_list_softlayer_ubuntu) { File.readlines(spec_asset('dpkg-list-ubuntu-noble-softlayer-additions.txt')).map(&:chop) } describe command(dpkg_list_packages), { exclude_on_fips: true, @@ -508,7 +392,6 @@ exclude_on_vcloud: true, exclude_on_vsphere: true, exclude_on_azure: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages for alicloud, aws, openstack, warden' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_kernel_ubuntu)) @@ -525,7 +408,6 @@ exclude_on_warden: true, exclude_on_azure: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus google-specific packages' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_kernel_ubuntu, dpkg_list_google_ubuntu)) @@ -541,7 +423,6 @@ exclude_on_warden: true, exclude_on_azure: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus vsphere-specific packages' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_kernel_ubuntu, dpkg_list_vsphere_ubuntu)) @@ -558,7 +439,6 @@ exclude_on_google: true, exclude_on_warden: true, exclude_on_openstack: true, - exclude_on_softlayer: true, } do it 'contains only the base set of packages plus azure-specific packages' do expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_kernel_ubuntu, dpkg_list_azure_ubuntu)) @@ -581,22 +461,6 @@ end end - describe command(dpkg_list_packages), { - exclude_on_fips: true, - exclude_on_alicloud: true, - exclude_on_aws: true, - exclude_on_cloudstack: true, - exclude_on_vcloud: true, - exclude_on_vsphere: true, - exclude_on_google: true, - exclude_on_warden: true, - exclude_on_azure: true, - exclude_on_openstack: true, - } do - it 'contains only the base set of packages plus softlayer-specific packages' do - expect(subject.stdout.split("\n")).to match_array(dpkg_list_ubuntu.concat(dpkg_list_kernel_ubuntu, dpkg_list_softlayer_ubuntu)) - end - end end end diff --git a/bosh-stemcell/spec/support/os_image_shared_examples.rb b/bosh-stemcell/spec/support/os_image_shared_examples.rb index 132bf40ac..13d5eb3bd 100644 --- a/bosh-stemcell/spec/support/os_image_shared_examples.rb +++ b/bosh-stemcell/spec/support/os_image_shared_examples.rb @@ -198,7 +198,7 @@ expect(sshd_config).to be_mode(0600) end - it 'disallows root login (stig: V-38613)', exclude_on_softlayer: true do + it 'disallows root login (stig: V-38613)' do expect(sshd_config.content).to match(/^PermitRootLogin no$/) end @@ -298,11 +298,11 @@ expect(sshd_config.content).to match(/^Protocol 2$/) end - it 'sets AllowGroups to bosh_sshers (CIS 9.3.13)', exclude_on_softlayer: true do + it 'sets AllowGroups to bosh_sshers (CIS 9.3.13)' do expect(sshd_config.content).to match(/^AllowGroups bosh_sshers$/) end - it 'sets DenyUsers to root', exclude_on_softlayer: true do + it 'sets DenyUsers to root' do expect(sshd_config.content).to match(/^DenyUsers root$/) end end @@ -447,14 +447,6 @@ expect(sshd_config.content).to match(/^PasswordAuthentication no$/) end end - - context 'unless: softlayer', { - exclude_on_softlayer: true, - } do - it 'disallows root login (stig: V-38613)' do - expect(sshd_config.content).to match(/^PermitRootLogin no$/) - end - end end describe package('xinetd') do diff --git a/bosh-stemcell/spec/support/stemcell_image.rb b/bosh-stemcell/spec/support/stemcell_image.rb index 27b3a23c9..a82e6fb49 100644 --- a/bosh-stemcell/spec/support/stemcell_image.rb +++ b/bosh-stemcell/spec/support/stemcell_image.rb @@ -7,38 +7,14 @@ unless config.inclusion_filter[:shellout_types] if ENV['STEMCELL_IMAGE'] # if `config.filter[exclude_on_softlayer]` is set, it means you're building the SoftLayer stemcell. - if config.filter[:exclude_on_softlayer] - config.filter_run_including stemcell_image: true - shell = Bosh::Core::Shell.new - verbose = true - image_file_path = ENV['STEMCELL_IMAGE'] - device = shell.run("sudo losetup --show --find #{image_file_path}", output_command: verbose) - kpartx_output = shell.run("sudo kpartx -sav #{device}", output_command: verbose) - device_partition1 = kpartx_output.lines.first.split(' ')[2] - device_partition2 = kpartx_output.lines.last.split(' ')[2] - loopback_dev1 = "/dev/mapper/#{device_partition1}" - loopback_dev2 = "/dev/mapper/#{device_partition2}" - image_mount_point = Dir.mktmpdir - config.before(:suite) do |example| - shell.run("sudo mkdir #{image_mount_point}/boot", output_command: verbose) - shell.run("sudo mount #{loopback_dev2} #{image_mount_point}", output_command: verbose) - shell.run("sudo mount #{loopback_dev1} #{image_mount_point}/boot", output_command: verbose) - ShelloutTypes::Chroot.chroot_dir = image_mount_point - end - config.after(:suite) do |example| - shell.run("sudo umount #{image_mount_point}/boot", output_command: verbose) - shell.run("sudo umount #{image_mount_point}", output_command: verbose) - end - else - config.filter_run_including stemcell_image: true - disk_image = Bosh::Stemcell::DiskImage.new(image_file_path: ENV['STEMCELL_IMAGE']) - config.before(:suite) do |example| - disk_image.mount - ShelloutTypes::Chroot.chroot_dir = disk_image.image_mount_point - end - config.after(:suite) do |example| - disk_image.unmount - end + config.filter_run_including stemcell_image: true + disk_image = Bosh::Stemcell::DiskImage.new(image_file_path: ENV['STEMCELL_IMAGE']) + config.before(:suite) do |example| + disk_image.mount + ShelloutTypes::Chroot.chroot_dir = disk_image.image_mount_point + end + config.after(:suite) do |example| + disk_image.unmount end else warning = 'All stemcell_image tests are being skipped. STEMCELL_IMAGE needs to be set' diff --git a/stemcell_builder/stages/bosh_softlayer_agent_settings/apply.sh b/stemcell_builder/stages/bosh_softlayer_agent_settings/apply.sh deleted file mode 100755 index 76dcdca7e..000000000 --- a/stemcell_builder/stages/bosh_softlayer_agent_settings/apply.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash - -base_dir=$(readlink -nf $(dirname $0)/../..) -source $base_dir/lib/prelude_apply.bash -source $base_dir/lib/prelude_agent.bash - -# Set SettingsPath but never use it because file_meta_service is available only when the settings file exists. -cat > $chroot/var/vcap/bosh/agent.json < /dev/null -parted --script ${disk_image} mklabel msdos -parted --script ${disk_image} mkpart primary ext2 $part_offset $boot_size -parted --script ${disk_image} mkpart primary ext2 $boot_size $part_size - -# unmap the loop device in case it's already mapped -timeout 100 bash -c " -until kpartx -dv ${disk_image}; do - echo 'Waiting for loop device to be free' - echo 'Running lsof' - lsof ${disk_image} - sleep 1 -done -" - -# create 64 loopback mappings. This fixes failures with losetup --show --find ${disk_image} -for i in $(seq 0 64); do - if ! mknod -m 0660 /dev/loop$i b 7 $i; then - break - fi -done - -# Map partition in image to loopback -device=$(losetup --show --find ${disk_image}) -add_on_exit "losetup --verbose --detach ${device}" - -device_partition1=$(kpartx -sav ${device} | grep "^add" | cut -d" " -f3 | head -1) -device_partition2=$(kpartx -sav ${device} | grep "^add" | cut -d" " -f3 | tail -1) -add_on_exit "kpartx -dv ${device}" - -loopback_dev1="/dev/mapper/${device_partition1}" -loopback_dev2="/dev/mapper/${device_partition2}" - -# Format partition -mkfs.ext4 ${loopback_dev1} -mkfs.ext4 ${loopback_dev2} - -# Mount partition -image_mount_point=${work}/mnt -mkdir -p ${image_mount_point} -mount ${loopback_dev2} ${image_mount_point} -add_on_exit "umount ${image_mount_point}" - -mkdir -p ${image_mount_point}/boot -mount ${loopback_dev1} ${image_mount_point}/boot -add_on_exit "umount ${image_mount_point}/boot" - -# Copy root -time rsync -aHA $chroot/boot/* ${image_mount_point}/boot -ls ${image_mount_point}/boot -pushd $chroot -time rsync -aHA $(ls | grep -v boot | xargs) ${image_mount_point} -popd -ls ${image_mount_point} \ No newline at end of file diff --git a/stemcell_builder/stages/image_create_softlayer_two_partitions/config.sh b/stemcell_builder/stages/image_create_softlayer_two_partitions/config.sh deleted file mode 100755 index e8a55f75f..000000000 --- a/stemcell_builder/stages/image_create_softlayer_two_partitions/config.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -e - -base_dir=$(readlink -nf $(dirname $0)/../..) -source $base_dir/lib/prelude_config.bash - -assert_available parted -assert_available kpartx - -if [ -z "${image_create_disk_size:-}" ] -then - image_create_disk_size=1225 -fi - -persist_value image_create_disk_size -persist_value stemcell_image_name diff --git a/stemcell_builder/stages/image_install_grub_softlayer_two_partitions/apply.sh b/stemcell_builder/stages/image_install_grub_softlayer_two_partitions/apply.sh deleted file mode 100755 index b278ece37..000000000 --- a/stemcell_builder/stages/image_install_grub_softlayer_two_partitions/apply.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env bash - -set -e - -base_dir=$(readlink -nf $(dirname $0)/../..) -source $base_dir/lib/prelude_apply.bash - -disk_image=${work}/${stemcell_image_name} - -## unmap the loop device in case it's already mapped -#umount ${image_mount_point}/proc || true -#umount ${image_mount_point}/sys || true -#umount ${image_mount_point} || true -#losetup -j ${disk_image} | cut -d ':' -f 1 | xargs --no-run-if-empty losetup -d -kpartx -dv ${disk_image} - -# note: if the above kpartx command fails, it's probably because the loopback device needs to be unmapped. -# in that case, try this: sudo dmsetup remove loop0p1 - -# Map partition in image to loopback -device=$(losetup --show --find ${disk_image}) -add_on_exit "losetup --verbose --detach ${device}" - -# totally two partitions, first is for /boot, second is for / -device_partition1=$(kpartx -sav ${device} | grep "^add" | cut -d" " -f3 | head -1) -device_partition2=$(kpartx -sav ${device} | grep "^add" | cut -d" " -f3 | tail -1) -add_on_exit "kpartx -dv ${device}" - -loopback_dev1="/dev/mapper/${device_partition1}" -loopback_dev2="/dev/mapper/${device_partition2}" - -# Mount partition -image_mount_point=${work}/mnt -mkdir -p ${image_mount_point} -mount ${loopback_dev2} ${image_mount_point} -add_on_exit "umount ${image_mount_point}" - -mkdir -p ${image_mount_point}/boot -mount ${loopback_dev1} ${image_mount_point}/boot -add_on_exit "umount ${image_mount_point}/boot" - -# == Guide to variables in this script (all paths are defined relative to the real root dir, not the chroot) - -# work: the base working directory outside the chroot -# eg: /mnt/stemcells/aws/xen/centos/work/work -# disk_image: path to the stemcell disk image -# eg: /mnt/stemcells/aws/xen/centos/work/work/aws-xen-centos.raw -# device: path to the loopback devide mapped to the entire disk image -# eg: /dev/loop0 -# loopback_dev: device node mapped to the main partition in disk_image -# eg: /dev/mapper/loop0p1 -# image_mount_point: place where loopback_dev is mounted as a filesystem -# eg: /mnt/stemcells/aws/xen/centos/work/work/mnt - -# Generate random password -random_password=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 16) - -touch ${image_mount_point}${device} -mount --bind ${device} ${image_mount_point}${device} -add_on_exit "umount ${image_mount_point}${device}" - -mkdir -p `dirname ${image_mount_point}${loopback_dev1}` -touch ${image_mount_point}${loopback_dev1} -mount --bind ${loopback_dev1} ${image_mount_point}${loopback_dev1} -add_on_exit "umount ${image_mount_point}${loopback_dev1}" - -mkdir -p `dirname ${image_mount_point}${loopback_dev2}` -touch ${image_mount_point}${loopback_dev2} -mount --bind ${loopback_dev2} ${image_mount_point}${loopback_dev2} -add_on_exit "umount ${image_mount_point}${loopback_dev2}" - -# GRUB 2 needs /sys and /proc to do its job -mount -t proc none ${image_mount_point}/proc -add_on_exit "umount ${image_mount_point}/proc" - -mount -t sysfs none ${image_mount_point}/sys -add_on_exit "umount ${image_mount_point}/sys" - -echo "(hd0) ${device}" > ${image_mount_point}/device.map - -# install bootsector into disk image file -run_in_chroot ${image_mount_point} "grub-install -v --no-floppy --grub-mkdevicemap=/device.map --target=i386-pc ${device}" - -# Enable password-less booting in openSUSE, only editing the boot menu needs to be restricted -run_in_chroot ${image_mount_point} "sed -i 's/CLASS=\\\"--class gnu-linux --class gnu --class os\\\"/CLASS=\\\"--class gnu-linux --class gnu --class os --unrestricted\\\"/' /etc/grub.d/10_linux" -cat >${image_mount_point}/etc/default/grub <> ${image_mount_point}/etc/grub.d/00_header - -# assemble config file that is read by grub2 at boot time -run_in_chroot ${image_mount_point} "GRUB_DISABLE_RECOVERY=true grub-mkconfig -o /boot/grub/grub.cfg" - -# set the correct root filesystem; use the ext2 filesystem's UUID -device_uuid_root=$(dumpe2fs $loopback_dev2 | grep UUID | awk '{print $3}') -sed -i s%root=${loopback_dev2}%root=UUID=${device_uuid_root}%g ${image_mount_point}/boot/grub/grub.cfg - -rm ${image_mount_point}/device.map - -# Figure out uuid of partition -uuid_boot=$(blkid -c /dev/null -sUUID -ovalue ${loopback_dev1}) -uuid_root=$(blkid -c /dev/null -sUUID -ovalue ${loopback_dev2}) -kernel_version=$(basename $(ls -rt ${image_mount_point}/boot/vmlinuz-* |tail -1) |cut -f2-8 -d'-') -initrd_file="initrd.img-${kernel_version}" -os_name=$(source ${image_mount_point}/etc/lsb-release ; echo -n ${DISTRIB_DESCRIPTION}) - -cat > ${image_mount_point}/etc/fstab < Date: Fri, 29 Nov 2024 16:28:35 +0100 Subject: [PATCH 2/2] remove comment mentioning softlayer --- bosh-stemcell/spec/support/stemcell_image.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/bosh-stemcell/spec/support/stemcell_image.rb b/bosh-stemcell/spec/support/stemcell_image.rb index a82e6fb49..74a9843db 100644 --- a/bosh-stemcell/spec/support/stemcell_image.rb +++ b/bosh-stemcell/spec/support/stemcell_image.rb @@ -6,7 +6,6 @@ # do not run stemcell image tests when shellout types tests are executed. unless config.inclusion_filter[:shellout_types] if ENV['STEMCELL_IMAGE'] - # if `config.filter[exclude_on_softlayer]` is set, it means you're building the SoftLayer stemcell. config.filter_run_including stemcell_image: true disk_image = Bosh::Stemcell::DiskImage.new(image_file_path: ENV['STEMCELL_IMAGE']) config.before(:suite) do |example|