Add Fuel Nailgun fixture

The wizzard of Fuel UI is defined within nailgun fixture(newrelease.yaml)
while a standard fuel plugin can only add additional sections to setting tab.

FPB postinstall hook could be the best way to deploy newrelease.xml,
but this feature will be delivered with MOS Fuel 7.0. And now deploy.sh
will do this work temporarily.

Moreover nailgun database will constrain the combination of the name
and version of new release but cannot, by far, delete the old version.
This function is included in cleardb.py and invoked by deploy.sh.
This commit is contained in:
John Hua 2015-07-15 14:09:47 +08:00
parent 2b3d9391aa
commit a36677c55b
6 changed files with 1435 additions and 9 deletions

View File

@ -14,17 +14,11 @@ Environment Setup
cd xenserver-fuel-plugin
cp localrc.sample localrc
vi localrc #configure your local environment
source localrc
Deployment
----------
fpb --build .
scp xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm root@$FUELMASTER:$PLUGIN_PATH
ssh root@$FUELMASTER fuel plugins --install $PLUGIN_PATH/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm
#or
ssh root@$FUELMASTER fuel plugins --update $PLUGIN_PATH/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm
ssh root@$FUELMASTER fuel plugins --list
./deploy.sh
Check out on Fuel Web UI
------------------------

12
cleardb.py Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env python
import os
import yaml
settings = yaml.load(open('/etc/nailgun/settings.yaml'))
os.environ["PGPASSWORD"] = settings['DATABASE']['passwd']
cmd = ('psql -h {host} -p {port} -U {user} -w -d {name} '
'-c "delete from releases where name like \'%Xen%\';" '
).format(**settings['DATABASE'])
os.system(cmd)

19
deploy.sh Executable file
View File

@ -0,0 +1,19 @@
source localrc
scp cleardb.py root@$FUELMASTER:$PLUGIN_PATH
ssh root@$FUELMASTER dockerctl copy cleardb.py nailgun:/tmp/cleardb.py
ssh root@$FUELMASTER dockerctl shell nailgun /tmp/cleardb.py
scp newrelease.yaml root@$FUELMASTER:$PLUGIN_PATH
ssh root@$FUELMASTER dockerctl copy newrelease.yaml nailgun:/tmp/newrelease.yaml
ssh root@$FUELMASTER dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml
fpb --check ./
fpb --build .
scp xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm root@$FUELMASTER:$PLUGIN_PATH
ssh root@$FUELMASTER fuel plugins --install $PLUGIN_PATH/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm ||
ssh root@$FUELMASTER fuel plugins --update $PLUGIN_PATH/xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm
ssh root@$FUELMASTER fuel plugins --list

View File

@ -1,4 +1,4 @@
#!/bin/bash
# It's a script which deploys your plugin
echo xenserver-fuel-plugin > /tmp/xenserver-fuel-plugin
dockerctl copy newrelease.yaml nailgun:/tmp/newrelease.yaml
dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml

1400
newrelease.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,3 +3,4 @@
# Add here any the actions which are required before plugin build
# like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors.