Skip to content

Commit

Permalink
Follow up to #2484, which broke everything...
Browse files Browse the repository at this point in the history
Although those changes worked for full deploys, the way that manifests
get parsed when doing things such as recreates causes the jobs to trip over the
"cannot specify both name and os for stemcell" validation.

It would probably be possible to find some way to work around this, but the
validation just isn't very useful anyway.

This commit removes that validation, making it valid now to specify both name and os.

When both are specified, name is given priority and os is ignored (as name has the os included
in it anyway). It is now possible to make an invalid manifest, where the name and os don't
actually match, but it will deploy anyway as long as the name is valid. This doesn't
seem like a compelling reason to keep this validation around.
  • Loading branch information
jpalermo committed Jan 9, 2024
1 parent cf2adba commit 6e9af42
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ def validate(manifest)
'resource_pools is no longer supported. You must now define resources in a cloud-config'
end

if manifest.key?('stemcells')
manifest['stemcells'].each do |stemcell|
if stemcell['name'] && stemcell['os']
raise StemcellBothNameAndOS, "Properties 'os' and 'name' are both specified for stemcell, choose one. (#{stemcell})"
end
end
end

Config.event_log.warn_deprecated("Global 'properties' are deprecated. Please define 'properties' at the job level.") if manifest.key?('properties')
end

Expand Down
1 change: 0 additions & 1 deletion src/bosh-director/lib/bosh/director/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def self.err(error_code, response_code = BAD_REQUEST)
StemcellNotFound = err(50003, NOT_FOUND)
StemcellInUse = err(50004)
StemcellAliasAlreadyExists = err(50005)
StemcellBothNameAndOS = err(50006)
StemcellSha1DoesNotMatch = err(50007)
StemcellNotSupported = err(50008)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ module Director
'resource_pools is no longer supported. You must now define resources in a cloud-config',
)
end

it 'raises error when both os and name are specified for a stemcell' do
manifest_hash['stemcells'][0]['name'] = 'the-name'

expect do
manifest_validator.validate(manifest_hash)
end.to raise_error(
Bosh::Director::StemcellBothNameAndOS,
%[Properties 'os' and 'name' are both specified for stemcell, choose one. ({"alias"=>"default", "os"=>"toronto-os", "version"=>"latest", "name"=>"the-name"})],
)
end
end
end
end
Expand Down

0 comments on commit 6e9af42

Please sign in to comment.