Skip to content

Commit

Permalink
Use sudo -u root
Browse files Browse the repository at this point in the history
  • Loading branch information
BanzaiMan committed Dec 17, 2015
1 parent 98e3e6a commit bd69f3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/travis/build/appliances/limit_hostname_length.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class LimitHostnameLength < Base
def_delegators :data, :job

def apply
sh.raw "sudo hostname \"$(hostname -f | cut -d. -f1 | cut -d\- -f1-2)-job-#{job[:id]}-$(hostname -f | cut -d. -f2-5)\""
sh.raw "sudo -u root hostname \"$(hostname -f | cut -d. -f1 | cut -d\- -f1-2)-job-#{job[:id]}-$(hostname -f | cut -d. -f2-5)\""
sh.raw "sed -e \"s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname -f | cut -d. -f1 | cut -d\- -f1-2)-job-#{job[:id]}-$(hostname -f | cut -d. -f2-5)/\" /etc/hosts | sudo tee /etc/hosts"
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shared_examples_for 'fix hostname' do
let(:limit_hostname_length) { "sudo hostname \"$(hostname | cut -d. -f1 | cut -d\- -f1-2)-job-1-$(hostname -f | cut -d. -f2-5)\"" }
let(:limit_hostname_length) { "sudo -u root hostname \"$(hostname | cut -d. -f1 | cut -d\- -f1-2)-job-1-$(hostname -f | cut -d. -f2-5)\"" }

it 'adds an sexp to shorten hostname' do
should include_sexp [:raw, limit_hostname_length]
Expand Down

0 comments on commit bd69f3a

Please sign in to comment.