Commit 3efce740 authored by Scott Hain's avatar Scott Hain

Fixed regression with package ownership in staging directory

parent 825096bb
......@@ -173,7 +173,7 @@ module Omnibus
# This implies that if we are in /tmp/staging/project/dir/things,
# we will chown from 'project' on, rather than 'project/dir', which leaves
# project owned by the build user (which is incorrect)
shellout!("sudo chown -R 0:0 #{File.join(staging_dir, project.install_dir)}")
shellout!("sudo chown -R 0:0 #{File.join(staging_dir, project.install_dir.match(/^\/?(\w+)/).to_s)}")
log.info(log_key) { "Creating .bff file" }
# Since we want the owner to be root, we need to sudo the mkinstallp
......
......@@ -163,6 +163,15 @@ module Omnibus
allow(Dir).to receive(:chdir) { |_, &b| b.call }
end
it 'chowns the directory' do
# A note - the /opt/ here is essentially project.install_dir one level up.
# There is nothing magical about 'opt' as a directory.
expect(subject).to receive(:shellout!)
.with(/chown -R 0:0 #{staging_dir}\/opt$/)
subject.create_bff_file
end
it 'logs a message' do
output = capture_logging { subject.create_bff_file }
expect(output).to include('Creating .bff file')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment