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

file: add support for sensitive files #325

Merged
merged 1 commit into from Dec 27, 2020

Conversation

terceiro
Copy link
Contributor

sensitive files will not get changes to their contents logged.

@unasuke unasuke self-requested a review December 14, 2020 02:17
@unasuke
Copy link
Member

unasuke commented Dec 14, 2020

@terceiro That's a good idea. In my opinion, print "diff existing but not show content because it's sensitive" in show_content_diff is more friendly. What do you think about it? 👀

def show_content_diff
if attributes.modified
Itamae.logger.info "diff:"
diff = run_command(["diff", "-u", compare_to, @temppath], error: false)
diff.stdout.each_line do |line|
color = if line.start_with?('+')
:green
elsif line.start_with?('-')
:red
else
:clear
end
Itamae.logger.color(color) do
Itamae.logger.info line.chomp
end
end
runner.handler.event(:file_content_changed, diff: diff.stdout)
else
# no change
Itamae.logger.debug "file content will not change"
end
end

sensitive files will not get changes to their contents logged.
@terceiro
Copy link
Contributor Author

@unasuke yes I agree, that is better. Modified the PR accordingly.

Copy link
Member

@unasuke unasuke left a comment

Choose a reason for hiding this comment

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

@terceiro Sorry, late. I checked changes and behavior on my local machine. It's looking good to me.

@unasuke unasuke merged commit 96ca2e2 into itamae-kitchen:master Dec 27, 2020
@unasuke
Copy link
Member

unasuke commented Dec 27, 2020

Released as v1.11.0

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

2 participants