Skip to content
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

tasks(repackage_boshreleases_fallback): fix deserialization #443

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RepackageReleasesFallback

def initialize(repackaged_error_filepath = "")
@repackaged_errors = if File.exist?(repackaged_error_filepath)
YAML.load_file(repackaged_error_filepath, aliases: true) || {}
YAML.load_file(repackaged_error_filepath, aliases: true, permitted_classes: [Tasks::Bosh::BoshCliError]) || {}
else
{}
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
Bosh director: !ruby/exception:Tasks::Bosh::BoshCliError
message: |-
Stderr:
Stdout:
{
"Tables": null,
"Blocks": null,
"Lines": [
"Fetching info:\n Performing request GET 'https://192.168.116.158:25555/info':\n Performing GET request:\n Retry: Get \"https://192.168.116.158:25555/info\": dial tcp 192.168.116.158:25555: connect: connection refused",
"Exit code 1"
]
}
backtrace:
- "/tmp/build/22f65861/cf-ops-automation/lib/tasks/bosh/executor.rb:39:in `handle_bosh_cli_response'"
- "/tmp/build/22f65861/cf-ops-automation/lib/tasks/bosh/executor.rb:34:in `run_command'"
- "/tmp/build/22f65861/cf-ops-automation/lib/tasks/bosh/list_releases.rb:7:in `execute'"
- "/tmp/build/22f65861/cf-ops-automation/concourse/tasks/repackage_boshreleases/repackage_releases.rb:133:in `filter_releases'"
- "/tmp/build/22f65861/cf-ops-automation/concourse/tasks/repackage_boshreleases/repackage_releases.rb:32:in `process'"
- cf-ops-automation/concourse/tasks/repackage_boshreleases/run.rb:42:in `<main>'
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
context "when errors file contains errors" do
let(:repackaged_releases_path) { File.join(basedir, 'download_failures') }

it "creates an object with errors" do
expect(repackage_releases_fallback.has_errors?).to be_truthy
end
end

context "when bosh returns an errors" do
let(:repackaged_releases_path) { File.join(basedir, 'bosh_connection_refused') }

it "creates an object with errors" do
expect(repackage_releases_fallback.has_errors?).to be_truthy
end
Expand Down