Skip to content

Commit 7d8df27

Browse files
committed
Enable cloud-init apt-configure module for Azure stemcells
Azure stemcells now properly use Azure-optimized APT mirrors (azure.archive.ubuntu.com) by enabling the apt-configure module in cloud-init configuration. The LISA (Linux Integration Services Automation) test suite's verify_repository_installed test was failing because Azure VMs were using archive.ubuntu.com instead of azure.archive.ubuntu.com for APT package repositories. While the Azure mirror configuration existed in /etc/cloud/cloud.cfg.d/90-azure-apt-sources.cfg, it was never applied because the apt-configure module was not enabled in cloud-init's module list. Added apt-configure to the cloud_init_modules list in cloud.cfg, which instructs cloud-init to read and apply the Azure APT mirror configuration at VM boot time. This ensures /etc/apt/sources.list is automatically updated to use Azure-optimized mirrors.
1 parent f7df8b8 commit 7d8df27

File tree

2 files changed

+13
-0
lines changed
  • bosh-stemcell/spec/stemcells
  • stemcell_builder/stages/system_azure_init/assets/etc/cloud-init

2 files changed

+13
-0
lines changed

bosh-stemcell/spec/stemcells/azure_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@
4343
end
4444
end
4545

46+
context 'cloud-init Azure APT mirror configuration' do
47+
describe file('/etc/cloud/cloud.cfg.d/90-azure-apt-sources.cfg') do
48+
it { should be_file }
49+
its(:content) { should include('http://azure.archive.ubuntu.com/ubuntu/') }
50+
end
51+
52+
describe file('/etc/cloud/cloud.cfg') do
53+
it { should be_file }
54+
its(:content) { should include('apt-configure') }
55+
end
56+
end
57+
4658
context 'installed by system_azure_network', {
4759
exclude_on_alicloud: true,
4860
exclude_on_aws: true,

stemcell_builder/stages/system_azure_init/assets/etc/cloud-init/cloud.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ cloud_init_modules:
1010
- update_etc_hosts
1111
- users-groups
1212
- ssh
13+
- apt-configure
1314
cloud_config_modules:
1415
- ssh-import-id
1516
- set-passwords

0 commit comments

Comments
 (0)