gluster / gluster-block

A framework for gluster block storage
GNU General Public License v2.0
74 stars 32 forks source link

version: fall back to rpm package nvr if needed #269

Closed pkalever closed 4 years ago

pkalever commented 4 years ago

What does this PR achieve? Why do we need it?

If the version is not provided by the package itself, check if the rpm nvr has the version string that can be used.

Signed-off-by: Prasanna Kumar Kalever prasanna.kalever@redhat.com

lxbsz commented 4 years ago

Test it, works for me:

[root@lxbceph0 gluster-block]# rpm -qa|grep configshell
python-configshell-1.1.fb25-1.el7.noarch

Without this PR:

● gluster-blockd.service - Gluster block storage utility
   Loaded: loaded (/usr/local/lib/systemd/system/gluster-blockd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-04-13 08:56:04 EDT; 3s ago
 Main PID: 1243 (gluster-blockd)
    Tasks: 3
   CGroup: /system.slice/gluster-blockd.service
           ├─1243 /usr/local/sbin/gluster-blockd --glfs-lru-count 5 --log-level INFO
           └─1403 python -c from configshell_fb import __version__; print(__version__)

Apr 13 08:56:05 lxbceph0 python[1293]: detected unhandled Python exception in 'interactive mode (python -c ...)'
Apr 13 08:56:05 lxbceph0 gluster-blockd[1243]: Traceback (most recent call last):
Apr 13 08:56:05 lxbceph0 gluster-blockd[1243]: File "<string>", line 1, in <module>
Apr 13 08:56:05 lxbceph0 gluster-blockd[1243]: ImportError: cannot import name __version__
Apr 13 08:56:06 lxbceph0 gluster-blockd[1243]: Parameter loglevel_file is now 'info'.
Apr 13 08:56:06 lxbceph0 gluster-blockd[1243]: Parameter max_backup_files is now '100'.
Apr 13 08:56:06 lxbceph0 gluster-blockd[1243]: Parameter auto_enable_tpgt is now 'false'.
Apr 13 08:56:06 lxbceph0 gluster-blockd[1243]: Parameter auto_add_default_portal is now 'false'.
Apr 13 08:56:06 lxbceph0 gluster-blockd[1243]: Parameter auto_save_on_exit is now 'false'.
Apr 13 08:56:06 lxbceph0 gluster-blockd[1243]: Parameter logfile is now '/var/log/gluster-block/gluster-block-configshell.log'.
Apr 13 08:56:07 lxbceph0 python[1403]: detected unhandled Python exception in 'interactive mode (python -c ...)'
Apr 13 08:56:07 lxbceph0 gluster-blockd[1243]: Traceback (most recent call last):
Apr 13 08:56:07 lxbceph0 gluster-blockd[1243]: File "<string>", line 1, in <module>
Apr 13 08:56:07 lxbceph0 gluster-blockd[1243]: ImportError: cannot import name __version__

With this PR:

[root@lxbceph0 gluster-block]# systemctl status gluster-blockd
● gluster-blockd.service - Gluster block storage utility
   Loaded: loaded (/usr/local/lib/systemd/system/gluster-blockd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-04-13 08:49:13 EDT; 3s ago
 Main PID: 29505 (gluster-blockd)
    Tasks: 6
   CGroup: /system.slice/gluster-blockd.service
           ├─29505 /usr/local/sbin/gluster-blockd --glfs-lru-count 5 --log-level INFO
           ├─29542 sh -c rpm -qa | grep rtslib | awk -F- '{print $(NF-1)}'
           ├─29543 rpm -qa
           ├─29544 grep rtslib
           └─29545 awk -F- {print $(NF-1)}

Apr 13 08:49:13 lxbceph0 systemd[1]: Stopped Gluster block storage utility.
Apr 13 08:49:13 lxbceph0 systemd[1]: Started Gluster block storage utility.
pkalever commented 4 years ago

Updated tags, and merged now. Thanks @lxbsz