Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 47c1480

Browse files
selzocTeal Stannard
andcommitted
Accurately reflect disk-quota in manifest diffs
We accept both `disk-quota` (older style) and `disk_quota` (preferred), but they refer to the same value, so that should be reflected in the diff [Finishes #174872722] Co-authored-by: Chris Selzo <cselzo@pivotal.io> Co-authored-by: Teal Stannard <tstannard@pivotal.io>
1 parent de6588c commit 47c1480

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

app/actions/space_diff_manifest.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def self.generate_diff(app_manifests, space)
7575
existing_app_hash = manifest_presenter.to_hash.deep_stringify_keys['applications'][0]
7676
web_process_hash = existing_app_hash['processes'].find { |p| p['type'] == 'web' }
7777
existing_app_hash = existing_app_hash.merge(web_process_hash) if web_process_hash
78+
79+
# Account for the fact that older manifests may have a hyphen for disk-quota
80+
if manifest_app_hash.key?('disk-quota')
81+
existing_app_hash['disk-quota'] = existing_app_hash['disk_quota']
82+
recognized_top_level_keys << 'disk-quota'
83+
end
7884
end
7985

8086
manifest_app_hash.each do |key, value|

spec/request/space_manifests_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@
516516
{
517517
diff: a_collection_containing_exactly(
518518
{ op: 'replace', path: '/applications/0/memory', was: '1024M', value: '256M' },
519+
{ op: 'replace', path: '/applications/0/disk-quota', was: '1024M', value: '2G' },
519520
)
520521
}
521522
end
@@ -525,7 +526,8 @@
525526
'applications' => [
526527
{
527528
'name' => app1_model.name,
528-
'memory' => '256M'
529+
'memory' => '256M',
530+
'disk-quota' => '2G',
529531
}
530532
]
531533
}.to_yaml

0 commit comments

Comments
 (0)