Skip to content

Commit 71f6059

Browse files
committed
Fix pulpcore assets directory permissions
Prior to Katello 3.18 assets were built by root. Katello 3.18 runs it as pulp and this corrects the permissions.
1 parent 6bff926 commit 71f6059

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Prior to Katello 3.18 assets were built by root. Katello 3.18 runs it as pulp
2+
# and this corrects the permissions.
3+
unless app_value(:noop)
4+
DIRECTORY = '/var/lib/pulp/assets'.freeze
5+
USER = 'pulp'.freeze
6+
7+
if File.directory?(DIRECTORY) && File.stat(DIRECTORY).uid == 0
8+
require 'fileutils'
9+
FileUtils.chown_R(USER, USER, DIRECTORY)
10+
end
11+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# hooks/pre/33-pulpcore_assets_permissions.rb needs user pulp
2+
DIRECTORY = '/var/lib/pulp/assets'.freeze
3+
USER = 'pulp'.freeze
4+
if File.directory?(DIRECTORY)
5+
require 'etc'
6+
7+
begin
8+
Etc.getpwnam(USER)
9+
rescue ArgumentError
10+
fail_and_exit("Detected incorrect permissions on #{DIRECTORY} but user #{USER} doesn't exist")
11+
end
12+
end

0 commit comments

Comments
 (0)