-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use YAML.load to load classes beyond the basic types #407
Use YAML.load to load classes beyond the basic types #407
Conversation
Pull Request Test Coverage Report for Build 3557
💛 - Coveralls |
@@ -104,13 +104,13 @@ | |||
end | |||
|
|||
it 'loads object from yaml' do | |||
expect(YAML.safe_load(svc_service.to_yaml)).to eq(svc_service) | |||
expect(YAML.load(svc_service.to_yaml)).to eq(svc_service) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest we pass MiqAeMethodService::MiqAeServiceService
to safe_load on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to see you say Service Service Service 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need HashWithIndifferentAccess too. I'll check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, just Service ServiceService was enough
end | ||
|
||
it 'loads invalid svc_model for objects without related ar_model' do | ||
yaml = svc_service.to_yaml | ||
service.delete | ||
model_from_yaml = YAML.safe_load(yaml) | ||
model_from_yaml = YAML.load(yaml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, Pass MiqAeMethodService::MiqAeServiceService
to safe_load.
@@ -280,6 +280,6 @@ def create_restart_model(script1, script2, script3) | |||
expect(MiqQueue.count).to eq(2) | |||
q = MiqQueue.where(:state => 'ready').first | |||
expect(q[:server_guid]).to be_nil | |||
expect(YAML.safe_load(q.args.first[:ae_state_data])).to eq(ae_state_data) | |||
expect(YAML.load(q.args.first[:ae_state_data])).to eq(ae_state_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is better off using load
for now.
53b4b32
to
9c9f88b
Compare
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 The prior behavior in core was to treat YAML.safe_load like YAML.load so let's change some of these to .load for now. We'll enumerate the list of classes where we can.
https://bugzilla.redhat.com/show_bug.cgi?id=1789153 Followup to ManageIQ/manageiq#19701 Seen when run locally or in travis output: ``` 472.50s$ bundle exec rake ** ManageIQ master, codename: Jansa [Coveralls] Set up the SimpleCov formatter. [Coveralls] Using SimpleCov's 'rails' settings. ** ManageIQ master, codename: Jansa /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does /home/travis/build/ManageIQ/manageiq-automation_engine/vendor/bundle/gems/rspec-core-3.9.1/exe/rspec: No such file or directory - does Randomized with seed 8807 .... ```
9c9f88b
to
c51ae7a
Compare
Checked commits jrafanie/manageiq-automation_engine@963ffa9~...c51ae7a with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 spec/engine/miq_ae_state_machine_retry_spec.rb
|
https://bugzilla.redhat.com/show_bug.cgi?id=1789153
Followup to ManageIQ/manageiq#19701
The prior behavior in core was to treat YAML.safe_load like YAML.load so let's change
some of these to .load for now. We'll enumerate the list of classes where we
can.
Also, fix typo of backtick instead of quote.