summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-horizon_git.bb
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2017-11-22 11:09:30 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-11-27 10:39:51 -0500
commit64d36f6a9546f0c6d1d2a220b20164e32a03e8a8 (patch)
treee373999f1ebc76d5620f4afb23efa520821738b9 /meta-openstack/recipes-devtools/python/python-horizon_git.bb
parent8fdbf26a2b1fc798c10699424199663c036745af (diff)
downloadmeta-cloud-services-64d36f6a9546f0c6d1d2a220b20164e32a03e8a8.tar.gz
python-horizon: fixups to get things working with stable/pike
A number of changes to get the openstack-dashboard up and running. We replace the old copy of local_setttings.py with a new version from source. Along with this we avoid touches to settings.py (it 'sources' local_settings.py so we should consolidate our changes there). We run django's 'collectstatic' as a postinst, this matches other distros and the openstack documentation, as well as easing the procedure to move from debug to production. For some operations horizon is attempting to use keystone v2.0 instead of v3 so there remain some issues. Overall, horizon is functional so we will call this 'working' and complete any additional fixups individually which will allow for better tracking of the changes. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-horizon_git.bb')
-rw-r--r--meta-openstack/recipes-devtools/python/python-horizon_git.bb93
1 files changed, 55 insertions, 38 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-horizon_git.bb b/meta-openstack/recipes-devtools/python/python-horizon_git.bb
index 51025e7..5e12e87 100644
--- a/meta-openstack/recipes-devtools/python/python-horizon_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-horizon_git.bb
@@ -74,18 +74,25 @@ RDEPENDS_${PN} += " \
74SRCNAME = "horizon" 74SRCNAME = "horizon"
75 75
76SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/pike \ 76SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/pike \
77 file://horizon.init \ 77 file://wsgi-horizon.conf \
78 file://fix_bindir_path.patch \ 78 file://fix_bindir_path.patch \
79 file://openstack-dashboard-apache.conf \
80 file://local_settings.py \ 79 file://local_settings.py \
81 file://horizon-use-full-package-path-to-test-directories.patch \ 80 file://horizon-use-full-package-path-to-test-directories.patch \
82 " 81 "
82# file://openstack-dashboard-apache.conf
83 83
84SRCREV = "246ff9f81248a00a434e66d18fad70519ba811cc" 84SRCREV = "246ff9f81248a00a434e66d18fad70519ba811cc"
85PV = "12.0.0+git${SRCPV}" 85PV = "12.0.0+git${SRCPV}"
86S = "${WORKDIR}/git" 86S = "${WORKDIR}/git"
87 87
88inherit setuptools update-rc.d python-dir default_configs monitor 88inherit setuptools systemd python-dir default_configs monitor useradd
89
90USER = "horizon"
91GROUP = "horizon"
92
93USERADD_PACKAGES = "${PN}"
94GROUPADD_PARAM_${PN} = "--system ${GROUP}"
95USERADD_PARAM_${PN} = "--system -m -d ${localstatedir}/lib/openstack-dashboard -s /bin/false -g ${GROUP} ${USER}"
89 96
90# no longer required. kept as reference. 97# no longer required. kept as reference.
91# do_install[dirs] += "${D}/usr/share/bin" 98# do_install[dirs] += "${D}/usr/share/bin"
@@ -94,56 +101,70 @@ do_install_append() {
94 SYSCONF_DIR=${D}${sysconfdir} 101 SYSCONF_DIR=${D}${sysconfdir}
95 DASHBOARD_CONF_DIR=${SYSCONF_DIR}/openstack-dashboard 102 DASHBOARD_CONF_DIR=${SYSCONF_DIR}/openstack-dashboard
96 DASHBOARD_SHARE_DIR=${D}${datadir}/openstack-dashboard 103 DASHBOARD_SHARE_DIR=${D}${datadir}/openstack-dashboard
97 HORIZON_CONF_DIR=${D}${sysconfdir}/horizon 104 APACHE_CONF_DIR=${D}${sysconfdir}/apache2/conf.d/
98
99 install -d ${HORIZON_CONF_DIR}
100 105
106 # Fixup to allow running standalone. Currently broken.
101 DASHBOARD_DIR=${D}${PYTHON_SITEPACKAGES_DIR}/openstack_dashboard 107 DASHBOARD_DIR=${D}${PYTHON_SITEPACKAGES_DIR}/openstack_dashboard
102 sed -e "s:^LANGUAGE_CODE =.*:LANGUAGE_CODE = 'en-us':g" \ 108 #sed -e "s:^LANGUAGE_CODE =.*:LANGUAGE_CODE = 'en-us':g" \
103 -i ${DASHBOARD_DIR}/settings.py 109 # -i ${DASHBOARD_DIR}/settings.py
104 sed -e "s:^# from horizon.utils:from horizon.utils:g" \ 110 #sed -e "s:^# from horizon.utils:from horizon.utils:g" \
105 ${DASHBOARD_DIR}/local/local_settings.py.example > \ 111 # ${DASHBOARD_DIR}/local/local_settings.py.example > \
106 ${DASHBOARD_DIR}/local/local_settings.py 112 # ${DASHBOARD_DIR}/local/local_settings.py
107 sed -e "s:^# SECRET_KEY =:SECRET_KEY =:g" \ 113 #sed -e "s:^# SECRET_KEY =:SECRET_KEY =:g" \
108 -i ${DASHBOARD_DIR}/local/local_settings.py 114 # -i ${DASHBOARD_DIR}/local/local_settings.py
109 install -m 644 ${S}/manage.py ${DASHBOARD_DIR}/manage.py 115 install -m 644 ${S}/manage.py ${DASHBOARD_DIR}/manage.py
110 116
111 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)};
112 then
113 install -d ${D}${sysconfdir}/init.d
114 sed 's:@PYTHON_SITEPACKAGES@:${PYTHON_SITEPACKAGES_DIR}:' \
115 ${WORKDIR}/horizon.init >${WORKDIR}/horizon
116 install -m 0755 ${WORKDIR}/horizon ${D}${sysconfdir}/init.d/horizon
117 fi
118 sed -i -e 's#%PYTHON_SITEPACKAGES%#${PYTHON_SITEPACKAGES_DIR}#g' \ 117 sed -i -e 's#%PYTHON_SITEPACKAGES%#${PYTHON_SITEPACKAGES_DIR}#g' \
119 ${D}${PYTHON_SITEPACKAGES_DIR}/horizon/test/settings.py 118 ${D}${PYTHON_SITEPACKAGES_DIR}/horizon/test/settings.py
120 119
121 # no longer required. kept as reference. 120 # no longer required. kept as reference.
122 # mv ${D}${datadir}/bin ${DASHBOARD_DIR}/bin 121 # mv ${D}${datadir}/bin ${DASHBOARD_DIR}/bin
123 122
124 cp run_tests.sh ${HORIZON_CONF_DIR} 123 install -d ${DASHBOARD_CONF_DIR}
124 cp run_tests.sh ${DASHBOARD_CONF_DIR}
125 125
126 # the following are setup required for horizon-apache 126 # The following allows horizon to be run from apache. This
127 # is the preffered way to run horizon.
127 install -d ${DASHBOARD_SHARE_DIR} 128 install -d ${DASHBOARD_SHARE_DIR}
128 cp -a --no-preserve=ownership ${S}/openstack_dashboard ${DASHBOARD_SHARE_DIR} 129 cp -a --no-preserve=ownership ${S}/openstack_dashboard ${DASHBOARD_SHARE_DIR}
129 cp ${S}/manage.py ${DASHBOARD_SHARE_DIR} 130 cp ${S}/manage.py ${DASHBOARD_SHARE_DIR}
130 131
131 install -D -m 644 ${WORKDIR}/local_settings.py \ 132 # Copy our version of the local-settings.py file, create a convienence link
132 ${DASHBOARD_CONF_DIR}/local_settings.py 133 # between /etc/openstack-dashboard and the apache2 files installed above,
134 # lastly make a few substitions to match our installation locations.
135 SETTINGS_FILE=${DASHBOARD_CONF_DIR}/local_settings.py
136 install -D -m 644 ${WORKDIR}/local_settings.py ${SETTINGS_FILE}
137 # Link only valid on the target.
133 ln -fs ${sysconfdir}/openstack-dashboard/local_settings.py \ 138 ln -fs ${sysconfdir}/openstack-dashboard/local_settings.py \
134 ${DASHBOARD_SHARE_DIR}/openstack_dashboard/local/local_settings.py 139 ${DASHBOARD_SHARE_DIR}/openstack_dashboard/local/local_settings.py
135 140 # Be sure to edit the real file in ${D}${sysconfdir}
136 install -D -m 644 ${WORKDIR}/openstack-dashboard-apache.conf \ 141 sed -e "s:%LOCAL_PATH%:${localstatedir}/lib/openstack-dashboard/static:g" \
137 ${SYSCONF_DIR}/apache2/conf.d/openstack-dashboard-apache.conf 142 -i ${SETTINGS_FILE}
138 sed -i -e 's#%PYTHON_SITEPACKAGES%#${PYTHON_SITEPACKAGES_DIR}#' \ 143
139 ${SYSCONF_DIR}/apache2/conf.d/openstack-dashboard-apache.conf 144 # Configure apache to run horizon at http://localhost/horizon
140 sed -i -e 's#%LIBDIR%#${libdir}#' \ 145 install -m 755 -d ${APACHE_CONF_DIR}
141 ${SYSCONF_DIR}/apache2/conf.d/openstack-dashboard-apache.conf 146 APACHE_WSGI_FILE=${APACHE_CONF_DIR}/openstack-dashboard.conf
147 install -m 644 ${WORKDIR}/wsgi-horizon.conf ${APACHE_WSGI_FILE}
148 sed -e "s#%DATADIR%#${datadir}#g" -i ${APACHE_WSGI_FILE}
149 sed -e "s#%USER%#${USER}#g" -i ${APACHE_WSGI_FILE}
150 sed -e "s#%GROUP%#${GROUP}#g" -i ${APACHE_WSGI_FILE}
151 sed -e "s#%LOCALSTATEDIR%#${localstatedir}#g" -i ${APACHE_WSGI_FILE}
152
153 #HZ_SETTINGS_FILE=${DASHBOARD_SHARE_DIR}/openstack_dashboard/settings.py
154 #sed -e "s:^\(WEBROOT\ =\ \).*$:\1'/horizon':" -i ${HZ_SETTINGS_FILE}
155 #sed -e "s:^\(STATIC_ROOT\ =\ \).*$:\1'${localstatedir}/lib/openstack-dashboard/static':" \
156 # -i ${HZ_SETTINGS_FILE}
142 157
143 ln -fs openstack_dashboard/static ${DASHBOARD_SHARE_DIR}/static 158 ln -fs openstack_dashboard/static ${DASHBOARD_SHARE_DIR}/static
159}
144 160
145 # daemon is UID 1 161pkg_postinst_${SRCNAME} () {
146 chown -R 1 ${DASHBOARD_SHARE_DIR}/openstack_dashboard/static 162 if [ -n "$D" ]; then
163 exit 1
164 else
165 # Regenerate the django static files
166 sudo -u horizon /usr/bin/env python ${datadir}/openstack-dashboard/manage.py collectstatic --noinput --clear
167 fi
147} 168}
148 169
149PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-apache ${SRCNAME}-standalone" 170PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-apache ${SRCNAME}-standalone"
@@ -153,7 +174,7 @@ RDEPENDS_${SRCNAME}-tests += " bash"
153 174
154FILES_${PN} = "${libdir}/*" 175FILES_${PN} = "${libdir}/*"
155 176
156FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh" 177FILES_${SRCNAME}-tests = "${sysconfdir}/openstack-dashboard/run_tests.sh"
157 178
158FILES_${SRCNAME} = "${bindir}/* \ 179FILES_${SRCNAME} = "${bindir}/* \
159 ${datadir}/* \ 180 ${datadir}/* \
@@ -179,10 +200,6 @@ RDEPENDS_${PN} += " \
179 200
180RDEPENDS_${SRCNAME} = "${PN}" 201RDEPENDS_${SRCNAME} = "${PN}"
181 202
182INITSCRIPT_PACKAGES = "${SRCNAME}"
183INITSCRIPT_NAME_${SRCNAME} = "horizon"
184INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
185
186RDEPENDS_${SRCNAME}-apache = "\ 203RDEPENDS_${SRCNAME}-apache = "\
187 apache2 \ 204 apache2 \
188 mod-wsgi \ 205 mod-wsgi \