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

Always write lockfiles for local top-level profiles #1116

Merged
merged 2 commits into from
Sep 22, 2016

Conversation

stevendanna
Copy link
Contributor

This commit threads through some state related to whether or not a
profile is "local", that is whether it is a directory on disk. If it
is, we then write out the lockfile to disk.

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

@stevendanna
Copy link
Contributor Author

This is based on #1113

@@ -60,6 +60,8 @@ def self.exec_options
desc: 'Load attributes file (experimental)'
option :cache, type: :string,
desc: 'Use the given path for caching dependencies. (default: ~/.inspec/cache)'
option :no_write_lockfile, type: :boolean, default: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

that is leading to a strange cli output:
[--no-write-lockfile], [--no-no-write-lockfile] # Do not write out a lockfile based on this execution
I think we need to switch to write-lockfile with default true

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe create-lockfile, since otherwise I am thinking its overwriting the old lockfile

@@ -55,6 +55,10 @@ def archive_path
@target
end

def writable?
File.directory?(@target)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not all directories are writable

Copy link
Contributor Author

@stevendanna stevendanna Sep 21, 2016

Choose a reason for hiding this comment

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

True, in this context by writable? we simply mean "is this the type of source that I actually want to write new files into on disk". We may still fail with EACCESS or something when we go to write.

if profile.lockfile_exists?
Inspec::Log.debug "Using existing lockfile #{profile.lockfile_path}"
else
Inspec::Log.debug "Writing lockfile: #{profile.lockfile_path}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Writing == Creating?

This commit threads through some state related to whether or not a
profile is "local", that is whether it is a directory on disk.  If it
is, we then write out the lockfile to disk.

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

Thanks @stevendanna

@chris-rock chris-rock merged commit 3d726a2 into master Sep 22, 2016
@chris-rock chris-rock deleted the ssd/write-lockfiles branch September 22, 2016 08:15
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