Add %pretrans scriplet to remove legacy role name #4
Conversation
Change-Id: Ia249ce07284a36f94743715b332a9e432afa1eee Signed-off-by: Ondra Machacek <omachace@redhat.com>
ci build please |
path = "%{_datadir}/%{ansible_roles_dir}/%{roleprefix_legacy}%{rolename}" | ||
st = posix.stat(path) | ||
if st and st.type == "directory" then | ||
os.execute('rm -rf "'..path..'"') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe running rm -rf
here is safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe it is safe.
But if you do thi sin the pretrans
of this package, won't it remove the directory even if the ovirt-ansible-roles
package isn't updated? That would result in missing files in that package. Shouldn't this pretrans
be in the ovirt-ansible-roles
RPM itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe %pretrans will be executed only if the package is part of a transaction. It should do nothing when the package itself is not updated. Stack Overflow seems to agree with me. https://stackoverflow.com/questions/22456217/rpm-scriptlet-ordering-for-install-remove-upgrade-using-yum
I would also expect this to be part of ovirt-ansible-roles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I've added it to ovirt-ansible-roles
RPM, the script wasn't executed for some reason. But I will try it once more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you are actually updating the package, the engine patch that is posted changes the dependencies in such a way that the ovirt-ansible-roles package will not be part of the transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the issue is that the ovirt-ansible-roles
package requres ovirt-ansible-cluster-upgrade
, but the only still it don't work:
omachace ~/workspace/ovirt-ansible (master) $ rpm -q ovirt-ansible-roles
ovirt-ansible-roles-1.1.1-1.fc27.noarch
omachace ~/workspace/ovirt-ansible (master) $ rpm -qp --scripts /mnt/local_repo/ovirt-ansible-roles-1.1.3-0.1.master.20171202074932.fc27.noarch.rpm
pretrans scriptlet (using <lua>):
-- Remove the legacy directory before installing the symlink. This is known issue in RPM:
-- https://fedoraproject.org/wiki/Packaging:Directory_Replacement
path = "/usr/share/ansible/roles/ovirt-cluster-upgrade"
st = posix.stat(path)
if st and st.type == "directory" then
os.execute('rm -rf "'..path..'"')
end
omachace ~/workspace/ovirt-ansible (master) $ sudo yum clean all && sudo yum update ovirt-ansible-roles
[sudo] password for omachace:
5 files removed
My Local Repository 1.5 MB/s | 1.5 kB 00:00
Failed to synchronize cache for repo 'patternfly-patternfly1', disabling.
Last metadata expiration check: 0:00:00 ago on Sat 02 Dec 2017 09:30:55 AM CET.
Dependencies resolved.
===================================================================================================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================================================================================================
Upgrading:
ovirt-ansible-roles noarch 1.1.3-0.1.master.20171202074932.fc27 local 17 k
Installing dependencies:
ovirt-ansible-cluster-upgrade noarch 1.1.3-0.1.master.20171202075226.fc27 local 18 k
Transaction Summary
===================================================================================================================================================================================================================
Install 1 Package
Upgrade 1 Package
Total size: 35 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction check error:
file /usr/share/ansible/roles/ovirt-cluster-upgrade from install of ovirt-ansible-cluster-upgrade-1.1.3-0.1.master.20171202075226.fc27.noarch conflicts with file from package ovirt-ansible-roles-1.1.1-1.fc27.noarch
Error Summary
-------------
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If both new installation and upgrade from 4.1.z work fine, then let's merge those changes on the each roles RPM, so we can execute RC build on Monday. And if needed we can improve later.
Thanks
Martin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compose is on tuesday, so we can decide on Monday how to proceed. We dont block the build.
Change-Id: Ia249ce07284a36f94743715b332a9e432afa1eee
Signed-off-by: Ondra Machacek omachace@redhat.com
CC @mwperina