-
Notifications
You must be signed in to change notification settings - Fork 124
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
Make send_file
aware of user
option
#277
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c7f201b
Make `send_file` aware of `user` option
pocke f6eeb8b
Add warning message for dev Ruby to integration local spec runner
pocke fcc1f1f
WIP Base for test with ordinary user
pocke 0b6c17a
Write itamae recipe and serverspec for ordinary user integration test
pocke 2f426bc
Read the tempfile by itamae process execution user, and write it by `…
pocke acdba48
Add regression test for user option
pocke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
describe file('/tmp/file_as_ordinary_user') do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
require 'spec_helper' | ||
|
||
describe file('/tmp/remote_file') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/Hello Itamae/) } | ||
end | ||
|
||
describe file('/tmp/remote_file_root') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/Hello Itamae/) } | ||
end | ||
|
||
%w[/tmp/remote_file_another_ordinary /tmp/remote_file_another_ordinary_with_root].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/Hello Itamae/) } | ||
end | ||
end | ||
|
||
### | ||
|
||
describe file('/tmp/file') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/Hello World/) } | ||
end | ||
|
||
describe file('/tmp/file_root') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/Hello World/) } | ||
end | ||
|
||
%w[/tmp/file_another_ordinary /tmp/file_another_ordinary_with_root].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/Hello World/) } | ||
end | ||
end | ||
|
||
### | ||
|
||
describe file('/tmp/template') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/Hello/) } | ||
its(:content) { should match(/Good bye/) } | ||
its(:content) { should match(/^total memory: \d+kB$/) } | ||
its(:content) { should match(/^uninitialized node key: $/) } | ||
end | ||
|
||
describe file('/tmp/template_root') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/Hello/) } | ||
its(:content) { should match(/Good bye/) } | ||
its(:content) { should match(/^total memory: \d+kB$/) } | ||
its(:content) { should match(/^uninitialized node key: $/) } | ||
end | ||
|
||
%w[/tmp/template_another_ordinary /tmp/template_another_ordinary_with_root].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/Hello/) } | ||
its(:content) { should match(/Good bye/) } | ||
its(:content) { should match(/^total memory: \d+kB$/) } | ||
its(:content) { should match(/^uninitialized node key: $/) } | ||
end | ||
end | ||
|
||
### | ||
|
||
describe file('/tmp/http_request.html') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/"from":\s*"itamae"/) } | ||
end | ||
|
||
describe file('/tmp/http_request_root.html') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/"from":\s*"itamae"/) } | ||
end | ||
|
||
%w[/tmp/http_request_another_ordinary.html /tmp/http_request_another_ordinary_with_root.html].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/"from":\s*"itamae"/) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
remote_file "/tmp/remote_file" do | ||
source "hello.txt" | ||
end | ||
|
||
remote_file "/tmp/remote_file_root" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
source "hello.txt" | ||
end | ||
|
||
remote_file "/tmp/remote_file_another_ordinary" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.txt" | ||
end | ||
|
||
remote_file "/tmp/remote_file_another_ordinary_with_root" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.txt" | ||
end | ||
|
||
### | ||
|
||
file "/tmp/file" do | ||
content "Hello World" | ||
end | ||
|
||
file "/tmp/file_root" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
content 'Hello World' | ||
end | ||
|
||
file "/tmp/file_another_ordinary" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
content 'Hello World' | ||
end | ||
|
||
file "/tmp/file_another_ordinary_with_root" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
content 'Hello World' | ||
end | ||
|
||
### | ||
|
||
template "/tmp/template" do | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
template "/tmp/template_root" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
template "/tmp/template_another_ordinary" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
template "/tmp/template_another_ordinary_with_root" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
### | ||
|
||
http_request "/tmp/http_request.html" do | ||
url "https://httpbin.org/get?from=itamae" | ||
end | ||
|
||
http_request "/tmp/http_request_root.html" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
url "https://httpbin.org/get?from=itamae" | ||
end | ||
|
||
http_request "/tmp/http_request_another_ordinary.html" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
url "https://httpbin.org/get?from=itamae" | ||
end | ||
|
||
http_request "/tmp/http_request_another_ordinary_with_root.html" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
url "https://httpbin.org/get?from=itamae" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to add the following code to
recipes/default.rb
, but it does not work.Because docker backend raises an error with this code.
Docker backend's
send_file
sends a file with the root user, and currently, it is not configurable, unfortunately.I guess we can move the code to
recipes/default.rb
by fixing docker backend, but this pull request does not focus this problem. I guess this problem already exists before this pull request because I do not touch docker backend in this pull request.