Bug 1070395
| Summary: | Error in PREUN scriptlet in rpm package puppet-3.4.2-5.fc21.noarch | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | poma <pomidorabelisima> |
| Component: | puppet | Assignee: | Lukas Zapletal <lzap> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | fedora, jose.p.oliveira.oss, k.georgiou, lzap, mastahnke, mmagr, moses, skottler, tmz, vanmeeuwen+fedora |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-04-08 13:36:25 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
poma
2014-02-26 17:39:16 UTC
The scriptlets have grown complicated with the dance required for systemd, it seems. I don't know what command might have failed to exit cleanly in %preun, it could have been 'systemctl is-enabled puppetagent.service' or the various tests and commands that put the pending upgrade file in place, neither of which are guarded with '|| :' or an explicit exit statement.
A bare minimum fix for this is to add 'exit 0' at the end of %preun (and similar for other scriptlets). E.g.:
diff --git i/puppet.spec w/puppet.spec
index bbfd947..8f7829e 100644
--- i/puppet.spec
+++ w/puppet.spec
d@@ -334,6 +329,7 @@ if [ "$1" = 0 ] ; then
/sbin/chkconfig --del puppet || :
fi
%endif
+exit 0
I would also replace the nested if tests for making the pending upgrade dir with a single call to the install command:
diff --git i/puppet.spec w/puppet.spec
index bbfd947..8f7829e 100644
--- i/puppet.spec
+++ w/puppet.spec
@@ -320,12 +320,7 @@ if [ "$1" == "1" ]; then
/bin/systemctl /bin/systemctl --no-reload disable puppetagent.service > /dev/null 2>&1 ||:
/bin/systemctl stop puppetagent.service > /dev/null 2>&1 ||:
/bin/systemctl daemon-reload >/dev/null 2>&1 ||:
- if [ ! -e %{pending_upgrade_file} ]; then
- if [ ! -d %{pending_upgrade_path} ]; then
- mkdir %{pending_upgrade_path}
- end
- touch %{pending_upgrade_file}
- fi
+ install -D -m 644 /dev/null %{pending_upgrade_file} > /dev/null 2>&1
fi
fi
%else
Cleaning up the scriptlets to avoid all the trailing '|| :' would be a nice bonus while in the area, but I don't run puppet on fedora, so I won't be making any attempts to push such fixes or cleanups. Here's what I might do for the puppet %preun, with similar changes for the other scriptlets:
diff --git a/puppet.spec b/puppet.spec
index bbfd947..7f7f73d 100644
--- a/puppet.spec
+++ b/puppet.spec
@@ -309,31 +309,27 @@ fi
%preun
%if 0%{?_with_systemd}
if [ "$1" -eq 0 ] ; then
- /bin/systemctl --no-reload disable puppet.service > /dev/null 2>&1 || :
- /bin/systemctl stop puppet.service > /dev/null 2>&1 || :
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ /bin/systemctl --no-reload disable puppet.service > /dev/null 2>&1
+ /bin/systemctl stop puppet.service > /dev/null 2>&1
+ /bin/systemctl daemon-reload >/dev/null 2>&1
fi
if [ "$1" == "1" ]; then
/bin/systemctl is-enabled puppetagent.service > /dev/null 2>&1
if [ "$?" == "0" ]; then
- /bin/systemctl /bin/systemctl --no-reload disable puppetagent.service > /dev/null 2>&1 ||:
- /bin/systemctl stop puppetagent.service > /dev/null 2>&1 ||:
- /bin/systemctl daemon-reload >/dev/null 2>&1 ||:
- if [ ! -e %{pending_upgrade_file} ]; then
- if [ ! -d %{pending_upgrade_path} ]; then
- mkdir %{pending_upgrade_path}
- end
- touch %{pending_upgrade_file}
- fi
+ /bin/systemctl /bin/systemctl --no-reload disable puppetagent.service > /dev/null 2>&1
+ /bin/systemctl stop puppetagent.service > /dev/null 2>&1
+ /bin/systemctl daemon-reload >/dev/null 2>&1
+ install -D -m 644 /dev/null %{pending_upgrade_file} > /dev/null 2>&1
fi
fi
%else
if [ "$1" = 0 ] ; then
/sbin/service puppet stop >/dev/null 2>&1
- /sbin/chkconfig --del puppet || :
+ /sbin/chkconfig --del puppet >/dev/null 2>&1
fi
%endif
+exit 0
%preun server
%if 0%{?_with_systemd}
Reproduced, I will fix this using what you recommend. Thanks. I did all above plus also unified if statements (all now using numeric equation). http://koji.fedoraproject.org/koji/taskinfo?taskID=6718006 puppet-3.4.3-3.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/puppet-3.4.3-3.fc20 puppet-3.4.3-3.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report. # yum update puppet Loaded plugins: langpacks Resolving Dependencies --> Running transaction check ---> Package puppet.noarch 0:3.4.2-5.fc21 will be updated ---> Package puppet.noarch 0:3.5.1-1.fc21 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: puppet noarch 3.5.1-1.fc21 rawhide 1.2 M Transaction Summary ================================================================================ Upgrade 1 Package Total download size: 1.2 M Is this ok [y/d/N]: y Downloading packages: puppet-3.5.1-1.fc21.noarch.rpm | 1.2 MB 00:02 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : puppet-3.5.1-1.fc21.noarch 1/2 /var/tmp/rpm-tmp.h6gZqX: line 21: syntax error: unexpected end of file error: %preun(puppet-3.4.2-5.fc21.noarch) scriptlet failed, exit status 2 Error in PREUN scriptlet in rpm package puppet-3.4.2-5.fc21.noarch Verifying : puppet-3.5.1-1.fc21.noarch 1/2 Verifying : puppet-3.4.2-5.fc21.noarch 2/2 Updated: puppet.noarch 0:3.5.1-1.fc21 Failed: puppet.noarch 0:3.4.2-5.fc21 Complete! # rpm -evh --nopreun puppet-3.4.2-5.fc21.noarch Preparing... ################################# [100%] Cleaning up / removing... 1:puppet-3.4.2-5.fc21 ################################# [100%] # rpm -q puppet puppet-3.5.1-1.fc21.noarch # yum install puppet-3.5.1-2.fc21.noarch.rpm Loaded plugins: langpacks Examining puppet-3.5.1-2.fc21.noarch.rpm: puppet-3.5.1-2.fc21.noarch Marking puppet-3.5.1-2.fc21.noarch.rpm as an update to puppet-3.5.1-1.fc21.noarch Resolving Dependencies --> Running transaction check ---> Package puppet.noarch 0:3.5.1-1.fc21 will be updated ---> Package puppet.noarch 0:3.5.1-2.fc21 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: puppet noarch 3.5.1-2.fc21 /puppet-3.5.1-2.fc21.noarch 3.9 M Transaction Summary ================================================================================ Upgrade 1 Package Total size: 3.9 M Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : puppet-3.5.1-2.fc21.noarch 1/2 Cleanup : puppet-3.5.1-1.fc21.noarch 2/2 Verifying : puppet-3.5.1-2.fc21.noarch 1/2 Verifying : puppet-3.5.1-1.fc21.noarch 2/2 Updated: puppet.noarch 0:3.5.1-2.fc21 Complete! # rpm -q puppet puppet-3.5.1-2.fc21.noarch Super duper. |