Bug 1183700 - pulp-server rpm treats init.d files as configs
Summary: pulp-server rpm treats init.d files as configs
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: 2.6 Beta
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: 2.6.1
Assignee: Brian Bouterse
QA Contact: Irina Gulina
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-19 13:58 UTC by Chris Duryee
Modified: 2015-02-28 23:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 23:20:04 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 669 0 None None None Never

Description Chris Duryee 2015-01-19 13:58:50 UTC
Description of problem:

The pulp spec file contains the following:

# Install the init scripts
%defattr(755,root,root,-)
%config %{_initddir}/pulp_celerybeat
%config %{_initddir}/pulp_workers
%config %{_initddir}/pulp_resource_manager

This causes manual changes to the init.d files to not be overwritten during RPM upgrades as expected. Instead, a .rpmsave file is created.

The %config directive should be removed so .rpmsave is not created.

Version-Release number of selected component (if applicable): 2.6.0 beta 5


How reproducible: every time

Steps to Reproduce:
1. install pulp
2. edit /etc/rc.d/init.d/pulp_workers (perhaps add an extra newline somewhere)
3. upgrade pulp-server rpm - you can probably use "rpm -Uvh --oldpackage" to do this without waiting for a new version:)

Actual results:

A new pulp_workers file is created as /etc/rc.d/init.d/pulp_workers.rpmsave

Expected results:

The pulp_workers file with the manual change should be overwritten.

Additional info:

This only occurs if someone makes a change to the init.d file. If they do not, it gets upgraded normally.

Comment 1 Brian Bouterse 2015-01-22 17:17:03 UTC
PR available at: https://github.com/pulp/pulp/pull/1560

Comment 2 Brian Bouterse 2015-01-22 17:21:45 UTC
Merged to 2.6-testing -> 2.6-dev -> master

Comment 3 Brian Bouterse 2015-02-10 15:00:32 UTC
QE to verify this you should test it with an upgrade on EL6.

1. Start with an older version of 2.4 <= Pulp <= 2.5
2. Add a bash comment to each of the files. /etc/init.d/pulp_celerybeat, /etc/init.d/pulp_workers, and /etc/init.d/pulp_resource_manager
3. Also add a bash comment to /etc/default/pulp_celerybeat, /etc/default/pulp_workers, and /etc/default/pulp_resource_manager.
3. Upgrade to the tested version of Pulp
4. Verify that your comment is no longer present in the files contained at /etc/init.d/
5. Verify that your comment is still present in the files contained at /etc/default/
6. Verify that *.rpmsave files have been created in /etc/default/.

I'm not 100% sure on step 6, but I included for completeness. Steps 4 and 5 should definitely work. If Step 6 does not work ping me with a needsinfo.

Comment 4 Chris Duryee 2015-02-10 22:33:05 UTC
2.6.0-0.7.beta

Comment 5 Irina Gulina 2015-02-18 16:29:32 UTC
Failed QA

1) My added comment remains in /etc/init.d/pulp_resource_manager
2) File /etc/init.d/pulp_resource_manager.rpmsave has not been created

>> rpm -qa pulp-server
pulp-server-2.4.4-0.4.rc.el6.noarch

>> echo "#This is a comment" >> /etc/init.d/pulp_resource_manager 
>> echo "#This is a comment" >> /etc/init.d/pulp_workers 
>> echo "#This is a comment" >> /etc/init.d/pulp_celerybeat 
>> tail -n 5 /etc/init.d/pulp_celerybeat
    ;;
esac

exit 0
#This is a comment

>> echo "#This is a comment" >> /etc/default/pulp_celerybeat 
>> echo "#This is a comment" >> /etc/default/pulp_workers 
>> echo "#This is a comment" >> /etc/default/pulp_resource_manager 

>> tail -n 5 /etc/default/pulp_resource_manager 
DEFAULT_NODES=""

# For the resource_manager, this should be set to 0.
PULP_CONCURRENCY=0
#This is a comment

>>  vi /etc/yum.repos.d/rhel-pulp.repo to enable pulp 2.6 repo

>> yum upgrade
...

>> rpm -qa pulp-server
pulp-server-2.6.0-0.7.beta.el6.noarch

>> tail -n 5 /etc/init.d/pulp_workers
        exit 64  # EX_USAGE
    ;;
esac

exit 0

>> grep "comment" /etc/default/*
/etc/default/pulp_celerybeat:#This is a comment
/etc/default/pulp_resource_manager:#This is a comment
/etc/default/pulp_workers:#This is a comment

>> grep "comment" /etc/init.d/*
/etc/init.d/functions:# paths; it doesn't have to handle comments in fstab_file.
/etc/init.d/pulp_celerybeat.rpmsave:#This is a comment
/etc/init.d/pulp_resource_manager:#This is a comment
/etc/init.d/pulp_workers.rpmsave:#This is a comment
/etc/init.d/smartd:# Uncomment the line below to pass options to smartd on startup.

>> grep "comment" /etc/init.d/pulp_resource_manager 
#This is a comment

>> ls -la /etc/init.d/pulp*
-rwxr-xr-x. 1 root root  7124 Feb 10 16:15 /etc/init.d/pulp_celerybeat
-rwxr-xr-x. 1 root root  8308 Feb 18 10:57 /etc/init.d/pulp_celerybeat.rpmsave
-rwxr-xr-x. 1 root root   879 Feb 18 10:57 /etc/init.d/pulp_resource_manager
-rwxr-xr-x. 1 root root  9328 Feb 10 16:15 /etc/init.d/pulp_workers
-rwxr-xr-x. 1 root root 10133 Feb 18 10:57 /etc/init.d/pulp_workers.rpmsave

Comment 6 Chris Duryee 2015-02-20 21:09:25 UTC
This is expected behavior.

For the init.d scripts:

The %config directive applies to the existing file install when upgrading. In this case:

* pulp_celerybeat had %config, was updated between pulp 2.4 and 2.6, *and* had local on-disk changes. Thus, it gets updated.
* pulp_resource_manager had %config, was not updated between pulp 2.4 and 2.6, thus rpm will not even check the filesystem. It assumes that if there are local changes, they are OK since the file in the RPM didn't change.

Note that if you do an "rpm -Uvh --oldpackage pulp-server-2.6.0-0.7.beta.el6.noarch.rpm", the existing state of the init.d files will not have %config, and will get updated. This would also apply for future updates to pulp-server.

For the /etc/default files:

The files did not change between Pulp 2.4 and 2.6. Thus, any local changes will persist on-disk. These files are marked as %config(noreplace), which means that if there are changes to the files *and* local changes, the new file will be saved as *.rpmnew.

If you'd like to discuss on IRC, just let me know. It is a little confusing:) Moving BZ back to ON_QA.

Comment 7 Chris Duryee 2015-02-24 16:07:46 UTC
Moving to 2.6.1, files will be upgraded as expected when upgrading to 2.6.1.

Comment 8 Brian Bouterse 2015-02-28 23:20:04 UTC
Moved to https://pulp.plan.io/issues/669


Note You need to log in before you can comment on or make changes to this bug.