Skip to content

Commit 7f75ccc

Browse files
authored
Merge pull request #865 from jrafanie/psych4_support
Psych 4 support
2 parents 1e16e6a + 4edca26 commit 7f75ccc

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

app/models/manageiq/providers/openstack/cloud_manager/orchestration_template.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def self.display_name(number = 1)
105105

106106
def parse
107107
return JSON.parse(content) if format == 'json'
108-
YAML.safe_load(content, [Date])
108+
YAML.safe_load(content, :permitted_classes => [Date])
109109
end
110110

111111
def validate_format_yaml

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)