Skip to content

Commit

Permalink
symlink local_secret_token.rb to /etc/foreman
Browse files Browse the repository at this point in the history
  • Loading branch information
sean797 committed Feb 21, 2018
1 parent 8d08af0 commit 473a205
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/foreman/foreman/foreman.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ rm -rf %{buildroot}
%{_mandir}/man8
%config(noreplace) %{_sysconfdir}/%{name}
%ghost %attr(0640,root,%{name}) %config(noreplace) %{_sysconfdir}/%{name}/encryption_key.rb
%ghost %attr(0640,root,%{name}) %config(noreplace) %{_sysconfdir}/%{name}/local_secret_token.rb
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config %{_sysconfdir}/cron.d/%{name}
Expand All @@ -1121,7 +1122,7 @@ rm -rf %{buildroot}
%attr(-,%{name},root) %{_datadir}/%{name}/config.ru
%attr(-,%{name},root) %{_datadir}/%{name}/config/environment.rb
%ghost %{_datadir}/%{name}/config/initializers/encryption_key.rb
%ghost %attr(0640,root,%{name}) %config(noreplace) %{_datadir}/%{name}/config/initializers/local_secret_token.rb
%ghost %{_datadir}/%{name}/config/initializers/local_secret_token.rb
%{_tmpfilesdir}/%{name}.conf

# Service
Expand All @@ -1144,6 +1145,17 @@ if [ ! -f %{_datadir}/%{name}/config/initializers/local_secret_token.rb ]; then
chgrp foreman %{_datadir}/%{name}/config/initializers/local_secret_token.rb
%{foreman_rake} security:generate_token >/dev/null 2>&1 || :
chmod 0640 %{_datadir}/%{name}/config/initializers/local_secret_token.rb
mv %{_datadir}/%{name}/config/initializers/local_secret_token.rb %{_sysconfdir}/%{name}/
fi
if [ ! -e %{_datadir}/%{name}/config/initializers/local_secret_token.rb -a \
-e %{_sysconfdir}/%{name}/local_secret_token.rb ]; then
ln -s %{_sysconfdir}/%{name}/local_secret_token.rb %{_datadir}/%{name}/config/initializers/
fi

# local_secret_token.rb migration, can be removed after a couple of releases
if [ -f %{_datadir}/%{name}/config/initializers/local_secret_token.rb ] && [ ! -L %{_datadir}/%{name}/config/initializers/local_secret_token.rb ]; then
mv %{_datadir}/%{name}/config/initializers/local_secret_token.rb %{_sysconfdir}/%{name}/
ln -s %{_sysconfdir}/%{name}/local_secret_token.rb %{_datadir}/%{name}/config/initializers/
fi

# encryption key used to encrypt DB contents
Expand Down

0 comments on commit 473a205

Please sign in to comment.