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

Fail if a remote source content doesn't match lockfile #1103

Merged
merged 2 commits into from Sep 21, 2016

Conversation

stevendanna
Copy link
Contributor

If a URL based source does not match the shasum recorded in the
lockfile, it likely means a new version has been pushed to the remote
source. In this case, we fail to help ensure that when using a lockfile
we always run the same code as when the lockfile was created.

Signed-off-by: Steven Danna steve@chef.io

@stevendanna stevendanna changed the title Fail if a remote source content doesn't match lockfile WIP: Fail if a remote source content doesn't match lockfile Sep 20, 2016
@stevendanna stevendanna changed the title WIP: Fail if a remote source content doesn't match lockfile Fail if a remote source content doesn't match lockfile Sep 20, 2016
If a URL based source does not match the shasum recorded in the
lockfile, it likely means a new version has been pushed to the remote
source. In this case, we fail to help ensure that when using a lockfile
we always run the same code as when the lockfile was created.

Signed-off-by: Steven Danna <steve@chef.io>
@archive_path ||= download_archive(path)
end

def shasum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe simply sha256?

archive_shasum.to_s
end

def archive_shasum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just sha256?

end

def resolved_source
{ url: @target }
@resolved_source ||= { url: @target, shasum256: shasum }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shasum256 What do you think about sha256?


remote = open(@target, http_opts)
def remote_archive_content
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just content?

@stevendanna
Copy link
Contributor Author

Suggested renames pushed

@@ -16,7 +16,7 @@ def resolve(target)
end
end

NON_FETCHER_KEYS = [:name, :version_constraint, :cwd, :backend, :cache].freeze
NON_FETCHER_KEYS = [:name, :version_constraint, :cwd, :backend, :cache, :shasum256].freeze
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be sha256?

Signed-off-by: Steven Danna <steve@chef.io>
@chris-rock
Copy link
Contributor

fixes #1066

@chris-rock
Copy link
Contributor

Thanks @stevendanna

@chris-rock chris-rock merged commit a63149a into master Sep 21, 2016
@chris-rock chris-rock deleted the ssd/check-checksum branch September 21, 2016 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants