diff --git a/debian/aic-valet-core.dirs b/debian/aic-valet-core.dirs new file mode 100644 index 0000000..fb83db3 --- /dev/null +++ b/debian/aic-valet-core.dirs @@ -0,0 +1,4 @@ +/var/lib/valet +/var/log/valet +/var/log/apache2/valet +/var/run/valet diff --git a/debian/aic-valet-core.docs b/debian/aic-valet-core.docs new file mode 100644 index 0000000..e69de29 diff --git a/debian/aic-valet-core.install b/debian/aic-valet-core.install new file mode 100644 index 0000000..eb8773c --- /dev/null +++ b/debian/aic-valet-core.install @@ -0,0 +1,6 @@ +valet/valet/api/app.wsgi var/www/valet/ +valet/valet/api/config.py var/www/valet/ +valet/etc/apache2/180-valet.conf etc/apache2/sites-available/ +valet/etc/valet/valet.conf etc/valet/ +valet/tools/utils/* opt/app/valet/tools/ +valet/bin/valet-engine usr/bin diff --git a/debian/aic-valet-core.logrotate b/debian/aic-valet-core.logrotate new file mode 100644 index 0000000..6e6be54 --- /dev/null +++ b/debian/aic-valet-core.logrotate @@ -0,0 +1,12 @@ +/var/log/apache2/valet/*.log +/var/log/valet/*.log +{ + daily + rotate 14 + compress + delaycompress + missingok + copytruncate + notifempty +} + diff --git a/debian/aic-valet-core.postinst b/debian/aic-valet-core.postinst new file mode 100644 index 0000000..e5f6e8c --- /dev/null +++ b/debian/aic-valet-core.postinst @@ -0,0 +1,16 @@ +chown -R valet:valet /etc/valet +chmod 0750 /etc/valet + +chown -R valet:valet /opt/app/valet/tools +chmod 755 /opt/app/valet/tools/* + +chown valet:valet /var/log/valet +chmod 0750 /var/log/valet + +chown valet:valet /var/run/valet +chown valet:valet /var/www/valet/app.wsgi +chown valet:valet /var/www/valet/config.py + +find /var/lib/valet -xdev -type d -exec chown valet:valet {} \; + +ln -s /etc/apache2/sites-available/180-valet.conf /etc/apache2/sites-enabled/180-valet.conf diff --git a/debian/aic-valet-core.postrm b/debian/aic-valet-core.postrm new file mode 100644 index 0000000..1314033 --- /dev/null +++ b/debian/aic-valet-core.postrm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +case "$1" in + purge) + # Remove swift user if possible + userdel valet || true + rm -rf /var/lib/valet + ;; +esac + +#DEBHELPER# + +exit 0 + diff --git a/debian/aic-valet-core.preinst b/debian/aic-valet-core.preinst new file mode 100644 index 0000000..4d287d0 --- /dev/null +++ b/debian/aic-valet-core.preinst @@ -0,0 +1,47 @@ +#!/bin/sh + +set -e + +case "$1" in + install|upgrade) + + # create the valet group + if ! getent group valet > /dev/null 2>&1 + then + addgroup --system valet >/dev/null + fi + + # create the valet user to avoid running as root + if ! getent passwd valet > /dev/null 2>&1 + then + adduser --quiet \ + --system \ + --home /var/lib/valet \ + --no-create-home \ + --ingroup valet \ + --shell /bin/false \ + valet + fi + + if [ "$(id -gn valet)" = "nogroup" ] + then + usermod -g valet valet + fi + ;; + configure) + ;; + abort-upgrade) + ;; + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/debian/aic-valet-core.prerm b/debian/aic-valet-core.prerm new file mode 100644 index 0000000..dcb5103 --- /dev/null +++ b/debian/aic-valet-core.prerm @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +case $1 in + remove|purge) + unlink /etc/apache2/sites-enabled/180-valet.conf + service apache2 restart + ;; +esac + +#DEBHELPER# + diff --git a/debian/aic-valet-openstack-plugins.docs b/debian/aic-valet-openstack-plugins.docs new file mode 100644 index 0000000..e69de29 diff --git a/debian/aic-valet-openstack-plugins.postinst b/debian/aic-valet-openstack-plugins.postinst new file mode 100644 index 0000000..f417e54 --- /dev/null +++ b/debian/aic-valet-openstack-plugins.postinst @@ -0,0 +1,4 @@ +#!/bin/sh + +ln -s /usr/lib/python2.7/dist-packages/valet/valet/plugins/nova/valet_filter.py /usr/lib/python2.7/dist-packages/nova/scheduler/filters/valet_filter.py + diff --git a/debian/aic-valet-openstack-plugins.prerm b/debian/aic-valet-openstack-plugins.prerm new file mode 100644 index 0000000..7d0ca73 --- /dev/null +++ b/debian/aic-valet-openstack-plugins.prerm @@ -0,0 +1,3 @@ +#!/bin/sh + +unlink /usr/lib/python2.7/dist-packages/nova/scheduler/filters/valet_filter.py diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..7f1094d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,12 @@ +aic-valet-core (1.0.0-00) stable; urgency=low + + * This is Valet release 1.0.0-00 + + -- Jenkins job Thu, 23 Jun 2016 14:48:02 +0000 + +aic-valet-openstack-plugins (1.0.0-00) stable; urgency=low + + * This is Valet release 1.0.0-00 + + -- Jenkins job Thu, 23 Jun 2016 14:48:02 +0000 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..bda8106 --- /dev/null +++ b/debian/control @@ -0,0 +1,43 @@ +Source: aic-valet-core +Section: python +Priority: optional +Maintainer: valet +Build-Depends: debhelper (>= 8.0.0) +Standards-Version: 1.0.0 +XS-Python-Version: >= 2.7 +Homepage: https://valet.research.att.com + +Package: aic-valet-core +Architecture: any +Depends: + apache2, + libapache2-mod-wsgi, + python-dev, + python-keystoneauth, + python-keystoneauth1, + python-keystoneclient, + python-notario, + python-novaclient, + python-oslo.config, + python-oslo.context, + python-oslo.i18n, + python-oslo.log, + python-oslo.messaging, + python-oslo.middleware, + python-oslo.serialization, + python-oslo.utils, + python-pbr (>=1.8), + python-pecan, + python-pecan-notario, + python-pika, + python-positional, + python-simplejson, + python-six, + python-tz +Description: Valet OpenStack service application + +Package: aic-valet-openstack-plugins +Architecture: any +Depends: python-nova, python-heat +Description: Valet plugins for the OpenStack scheduler and orchestration services + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..8022f45 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,35 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: valet +Source: + +Files: * +Copyright: + +License: GPL-3.0+ + +Files: debian/* +Copyright: 2016 root +License: GPL-3.0+ + +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid to pick license terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. + diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..e5b8e0b --- /dev/null +++ b/debian/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ --with python2 --buildsystem=python_distutils -D valet + +override_dh_usrlocal: + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..435dd71 --- /dev/null +++ b/debian/source/format @@ -0,0 +1,2 @@ +3.0 (native) + diff --git a/etc/valet/api/valet_apache.conf b/etc/apache2/180-valet.conf similarity index 100% rename from etc/valet/api/valet_apache.conf rename to etc/apache2/180-valet.conf diff --git a/etc/valet/api/app.wsgi b/etc/valet/api/app.wsgi deleted file mode 100644 index f32d0f4..0000000 --- a/etc/valet/api/app.wsgi +++ /dev/null @@ -1,4 +0,0 @@ -# /var/www/valet/app.wsgi -from valet.api.app import load_app - -application = load_app(config_file='/var/www/valet/config.py') \ No newline at end of file diff --git a/etc/valet/openstack/notification_listener/notification_listener.py b/etc/valet/openstack/notification_listener/notification_listener.py deleted file mode 100644 index 357da55..0000000 --- a/etc/valet/openstack/notification_listener/notification_listener.py +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright 2014-2017 AT&T Intellectual Property -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Notification Listener.""" - -import json -from oslo_config import cfg -import oslo_messaging - - -class NotificationEndpoint(object): - """Endponit for a notifcation (info, warn, error).""" - - def info(self, ctxt, publisher_id, event_type, payload, metadata): - """Print notifaction was received and dumb json data to print.""" - print('recv notification:') - print(json.dumps(payload, indent=4)) - - def warn(self, ctxt, publisher_id, event_type, payload, metadata): - """Warn.""" - None - - def error(self, ctxt, publisher_id, event_type, payload, metadata): - """Error.""" - None - -transport = oslo_messaging.get_notification_transport(cfg.CONF) -targets = [oslo_messaging.Target(topic='notifications')] -endpoints = [NotificationEndpoint()] - -server = oslo_messaging.get_notification_listener( - transport, targets, endpoints) -server.start() -server.wait() diff --git a/setup.cfg b/setup.cfg index 4e86934..ca509aa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = openstack-valet +name = valet summary = Valet Placement Service description-file = README.md keywords = placement, service, openstack diff --git a/valet/api/app.wsgi b/valet/api/app.wsgi new file mode 100644 index 0000000..bfb673a --- /dev/null +++ b/valet/api/app.wsgi @@ -0,0 +1,26 @@ +# -*- mode: python -*- +# +# Copyright 2013 New Dream Network, LLC (DreamHost) +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# /var/www/valet/app.wsgi + +"""Use this file for deploying the API under mod_wsgi. +See http://pecan.readthedocs.org/en/latest/deployment.html for details. +""" + +from valet import service +from valet.api import app +conf = service.prepare_service([]) +application = app.load_app(config_file='/var/www/valet/config.py') diff --git a/etc/valet/api/config.py b/valet/api/config.py similarity index 100% rename from etc/valet/api/config.py rename to valet/api/config.py