Skip to content

Commit 4edca26

Browse files
committed
We explicitly serialize objects so we need to permit yaml loading them
1 parent 029a151 commit 4edca26

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/models/manageiq/providers/openstack/helper_methods.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ def parse_error_message_excon_http_status(exception)
6464
end
6565

6666
def with_notification(type, options: {})
67+
# We're explicitly serializing objects in the options subject key so we should permit yaml loading those classes
68+
if options[:subject]
69+
ActiveRecord::Base.yaml_column_permitted_classes = ActiveRecord::Base.yaml_column_permitted_classes | [options[:subject].class]
70+
end
71+
6772
# extract success and error options from options
6873
# :success and :error keys respectively
6974
# with all other keys common for both cases

spec/models/manageiq/providers/openstack/cloud_manager/provision/volume_attachment_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@flavor = FactoryBot.create(:flavor_openstack)
66
@volume = FactoryBot.create(:cloud_volume_openstack)
77

8+
# We're storing objects in the instance_type, so we must permit loading this class
9+
ActiveRecord::Base.yaml_column_permitted_classes = ActiveRecord::Base.yaml_column_permitted_classes | [@flavor.class]
810
@task = FactoryBot.create(:miq_provision_openstack,
911
:source => @template,
1012
:state => 'pending',

0 commit comments

Comments
 (0)