Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build F5 dashboard package #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

zhaoqin-github
Copy link

No description provided.

@zhaoqin-github zhaoqin-github added the enhancement New feature or request label Sep 19, 2018
@zhaoqin-github zhaoqin-github self-assigned this Sep 19, 2018
#!/bin/bash

git checkout -- setup.cfg
rm -rf build dist *.egg *.egg-info
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As good practice in shell, we should not suppose the current running directory is just the directory where build_rpm.sh is.

We should use the following way to get the absolute path to build_rpm.sh.


cdir=`cd $(dirname $0); pwd`
(
cd $cdir
# you logic here. 
)

In that way, we can run build_rpm.sh anywhere, like ./build_rpm.sh works, /path/to/build_rpm.sh also can work..
I don't need to navigate to that folder to run the script..

VERSION=$(rpmspec -q --qf "%{version}" f5-neutron-lbaas-dashboard.spec)

OLD=neutron-lbaas-dashboard-${VERSION}
NEW=f5-neutron-lbaas-dashboard-${VERSION}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about using f5-openstack-dashboard, as we talked, the installed package name.

python setup.py bdist_rpm --spec-only \
--release=1 \
--provides=f5-neutron-lbaas-dashboard \
--packager="Qin Zhao <q.zhao@f5.com>" \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have a common name instead of using personal?


# Repackage source tarball

cd dist
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use ( ) to start a sub shell for the work.. changing directory in shell script is not convenient when we want to add more logic, we have to glance over the whole script to see where(which directory) I'm now.


/bin/cp -f f5-setup.cfg setup.cfg

python setup.py bdist_rpm --spec-only \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if python setup.py run failed? we may need error handling.


mv ${OLD} ${NEW}

cd ${NEW}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too.
wrap the logic into ():

(
cd $cdir
echo logic..
)


rm -rf neutron_lbaas_dashboard.egg-info

cp -rp ../../f5_neutron_lbaas_dashboard.egg-info ./
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the benefits for using absolute path in script is when we need to debug the script with 'sh -x', it's very easy to navigate to each (called) file. Relative path is not so clear where and where.. also not convenient to debug..


sed -i "s/^neutron_lbaas_dashboard/f5_neutron_lbaas_dashboard/g" f5_neutron_lbaas_dashboard.egg-info/SOURCES.txt

sed -i "s/_1481_project_ng_loadbalancersv2_panel.py/_1491_project_ng_loadbalancersv2_panel.py" f5_neutron_lbaas_dashboard.egg-info/SOURCES.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about remove the empty lines and group them together..

@@ -0,0 +1,3 @@
mkdir -p /usr/share/openstack-dashboard/openstack_dashboard/local/enabled/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Report error and prompt user the installation failed (exit 1) when /usr/share/openstack-dashboard not exists(openstack-dashboard is not installed yet.).
mkdir and put f5-xxxxx there is useless, cannot run either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants