From aa62285b9effb2bbae4817046cf4c7702c0f3160 Mon Sep 17 00:00:00 2001 From: Nishad Mathur Date: Thu, 8 Oct 2026 18:07:51 -0700 Subject: [PATCH] Add agent_features to stemcell.MF bosh-cli needs to know whether a stemcell's agent accepts salted HMAC-SHA256 mbus password verifiers before it puts one, rather than the plaintext password, into VM metadata. Advertise agent capabilities in stemcell.MF as an agent_features list. The list stays empty until a separate PR bumps to a bosh-agent release that supports verifiers and adds "http-password-hmac-sha256" in the same change. Listing the feature with an older agent would make create-env fail with a 401. ai-assisted=yes TNZ-129825 Co-Authored-By: Chris Selzo Co-Authored-By: Claude Opus 5.5 --- bosh-stemcell/lib/bosh/stemcell/stemcell_packager.rb | 1 + .../spec/bosh/stemcell/stemcell_packager_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/bosh-stemcell/lib/bosh/stemcell/stemcell_packager.rb b/bosh-stemcell/lib/bosh/stemcell/stemcell_packager.rb index 2e339caf77..428a1b525d 100644 --- a/bosh-stemcell/lib/bosh/stemcell/stemcell_packager.rb +++ b/bosh-stemcell/lib/bosh/stemcell/stemcell_packager.rb @@ -44,6 +44,7 @@ def manifest(disk_format) "sha1" => image_checksum, "operating_system" => "#{definition.operating_system.name}-#{definition.operating_system.version}", "stemcell_formats" => infrastructure.stemcell_formats, + "agent_features" => [], "cloud_properties" => manifest_cloud_properties(disk_format, infrastructure, stemcell_name) } end diff --git a/bosh-stemcell/spec/bosh/stemcell/stemcell_packager_spec.rb b/bosh-stemcell/spec/bosh/stemcell/stemcell_packager_spec.rb index a7edc31c90..e94f76a863 100644 --- a/bosh-stemcell/spec/bosh/stemcell/stemcell_packager_spec.rb +++ b/bosh-stemcell/spec/bosh/stemcell/stemcell_packager_spec.rb @@ -105,6 +105,7 @@ def additional_cloud_properties "version" => "1234", "bosh_protocol" => 1, "api_version" => 3, + "agent_features" => [], "sha1" => "c1ebdefc3f8282a9d7d47803fb5030b61ffc793d", # SHA-1 of image above "operating_system" => "ubuntu-jammy", "stemcell_formats" => ["stemcell-format-a", "stemcell-format-b"], @@ -124,6 +125,16 @@ def additional_cloud_properties }) end + it "includes the agent feature list in the packaged manifest" do + packager.package(disk_format) + + manifest = YAML.load_file(File.join(work_dir, "stemcell/stemcell.MF")) + expect(manifest["agent_features"]).to eq([]) + contents, _, status = Open3.capture3("tar", "xOf", File.join(tarball_dir, "bosh-stemcell-1234-fake_infra-fake_hypervisor-ubuntu-jammy-go_agent.tgz"), "stemcell.MF") + expect(status.success?).to be(true) + expect(YAML.safe_load(contents)["agent_features"]).to eq(manifest["agent_features"]) + end + it "returns the path of the created tarball" do expect(packager.package(disk_format)).to eq( File.join(tarball_dir, "bosh-stemcell-1234-fake_infra-fake_hypervisor-ubuntu-jammy-go_agent.tgz")