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

changed FileUtils, tar_path and profile_path behavior #51

Merged
merged 1 commit into from May 24, 2016

Conversation

Projects
None yet
3 participants
@cjohannsen81
Contributor

cjohannsen81 commented May 23, 2016

Description

This change copies instead of moving, due to an Windows access error

Issues Resolved

#48

Check List

Checked using test-kitchen against Ubuntu and Windows

@iennae iennae added the in progress label May 23, 2016

@chris-rock

View changes

libraries/profile.rb Outdated
@@ -76,7 +76,7 @@ class ComplianceProfile < Chef::Resource # rubocop:disable Metrics/ClassLength
end
end
FileUtils.move(tf.path, path) unless tf.nil?
FileUtils.cp(tf.path, path) unless tf.nil?

This comment has been minimized.

@chris-rock

chris-rock May 24, 2016

Collaborator

Should we delete content from tf.path? Please add a comment, why we use cp instead of mv.

This comment has been minimized.

@cjohannsen81

cjohannsen81 May 24, 2016

Contributor

It´s deleted by ruby :)

@@ -145,12 +145,24 @@ def normalize_owner_profile
def tar_path
return path if path
o, p = normalize_owner_profile
::File.join(Chef::Config[:file_cache_path], 'compliance', "#{o}_#{p}.tgz")
case node['platform']

This comment has been minimized.

@chris-rock

chris-rock May 24, 2016

Collaborator

An idea for improvement:

def determine_path(file)
case node['platform']
when 'windows'
      windows_path = Chef::Config[:file_cache_path].tr('\\', '/')
      ::File.join(windows_path, 'compliance', file)
    else
     ::File.join(Chef::Config[:file_cache_path], 'compliance', file)
    end
end

then we are able to use

determine_path("#{o}_#{p}.tgz")
determine_path("#{o}_#{p}_report.json")

This allows us to handle further improvement in one function only

This comment has been minimized.

@chris-rock

chris-rock May 24, 2016

Collaborator

As discussed with @cjohannsen81 we harmonize the implementation in another PR

This comment has been minimized.

@cjohannsen81

cjohannsen81 May 24, 2016

Contributor

I will open another branch for this.

@chris-rock chris-rock merged commit 48cd9c0 into master May 24, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@chris-rock chris-rock deleted the cjohannsen/windows-path-fix branch May 24, 2016

@iennae iennae removed the in progress label May 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment