Skip to content

Commit

Permalink
Merge pull request #195 from SUSE/fix_product_license_permissions
Browse files Browse the repository at this point in the history
Set the correct permissions for product.license directory
  • Loading branch information
ikapelyukhin authored Jun 25, 2018
2 parents 83db4fd + 8cf96e2 commit c1b2f10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/rmt/mirror.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def replace_directory(source_dir, destination_dir)
FileUtils.remove_entry(old_directory) if Dir.exist?(old_directory)
FileUtils.mv(destination_dir, old_directory) if Dir.exist?(destination_dir)
FileUtils.mv(source_dir, destination_dir)
FileUtils.chmod(0o755, destination_dir)
rescue StandardError => e
raise RMT::Mirror::Exception.new("Error while moving directory #{source_dir} to #{destination_dir}: #{e}")
end
Expand Down
1 change: 1 addition & 0 deletions package/rmt-server.changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Tue Jun 19 15:01:19 UTC 2018 - [email protected]

- Version 1.0.2
- Improved handling of errors during mirroring (bsc#1096967)
- Set correct permissions for product.license directory (bsc#1097367)
- Log version on service startup

-------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions spec/lib/rmt/mirror_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@
expect(Dir).to receive(:exist?).with(destination_dir).and_return(false)
end

it 'removes it and moves src to dst' do
it 'removes it, moves src to dst and sets permissions' do
expect(FileUtils).to receive(:remove_entry).with(old_dir)
expect(FileUtils).to receive(:mv).with(source_dir, destination_dir)
expect(FileUtils).to receive(:chmod).with(0o755, destination_dir)
replace_directory
end
end
Expand All @@ -452,9 +453,10 @@
expect(Dir).to receive(:exist?).with(destination_dir).and_return(true)
end

it 'renames it as .old and moves src to dst' do
it 'renames it as .old, moves src to dst and sets permissions' do
expect(FileUtils).to receive(:mv).with(destination_dir, old_dir)
expect(FileUtils).to receive(:mv).with(source_dir, destination_dir)
expect(FileUtils).to receive(:chmod).with(0o755, destination_dir)
replace_directory
end
end
Expand Down

0 comments on commit c1b2f10

Please sign in to comment.