Skip to contentSkip to conversation

python-*: Set permissive perms

PATCH New Mark Asselstine 1 participant 3 messages Nov 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 python-*: Set permissive perms

Keystone will fail with permission denied if we don't set more permissive permissions for the PGK-INFO files in these packages.

---
 meta-openstack/recipes-devtools/python/python-happybase_1.1.0.bb | 3 ++-
 meta-openstack/recipes-devtools/python/python-oauth2_1.5.211.bb  | 8 ++++++++
 meta-openstack/recipes-devtools/python/python-oauthlib_0.7.2.bb  | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
meta-openstack/recipes-devtools/python/python-happybase_1.1.0.bb +2 -1
index 7b3c7d8..0981c27 100644
@@ -10,7 +10,8 @@ SRC_URI[sha256sum] = "e20376e2e32291798d2226502994134c1c4e175136d8375b3c517a234f
 inherit setuptools pypi
 
 do_install_append() {
-	perm_files=`find "${D}${PYTHON_SITEPACKAGES_DIR}/" -name "top_level.txt"`
+	perm_files=$(find "${D}${PYTHON_SITEPACKAGES_DIR}/" -name "top_level.txt")
+	perm_files="$perm_files "$(find "${D}${PYTHON_SITEPACKAGES_DIR}/" -name "PKG-INFO")
 	for f in $perm_files; do
 		chmod 644 "${f}"
 	done
meta-openstack/recipes-devtools/python/python-oauth2_1.5.211.bb +8 -0
index 21a0585..aa04663 100644
@@ -15,3 +15,11 @@ RDEPENDS_${PN} += "python-prettytable \
             python-mccabe \
             python-pep8 \
             python-pyflakes"
+
+
+do_install_append() {
+	perm_files=$(find "${D}${PYTHON_SITEPACKAGES_DIR}/" -name "PKG-INFO")
+	for f in $perm_files; do
+		chmod 644 "${f}"
+	done
+}
meta-openstack/recipes-devtools/python/python-oauthlib_0.7.2.bb +1 -0
index fe4560b..3b5d38f 100644
@@ -21,6 +21,7 @@ RDEPENDS_${PN} += " \
 
 do_install_append() {
         perm_files=`find "${D}${PYTHON_SITEPACKAGES_DIR}/" -name "top_level.txt" -o -name "requires.txt"`
+        perm_files="$perm_files "$(find "${D}${PYTHON_SITEPACKAGES_DIR}/" -name "PKG-INFO")
         for f in $perm_files; do
                 chmod 644 "${f}"
         done
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 python-keystone: set connection drivername

psycopg2 will be selected by default but this will avoid warnings in the log.

---
 meta-openstack/recipes-devtools/python/python-keystone/keystone.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-openstack/recipes-devtools/python/python-keystone/keystone.conf +1 -1
index cdeb156..2d635f3 100644
@@ -75,7 +75,7 @@ admin_token=%SERVICE_TOKEN%
 
 [database]
 # The SQLAlchemy connection string used to connect to the database
-connection = postgresql://%DB_USER%:%DB_PASSWORD%@localhost/keystone
+connection = postgresql+psycopg2://%DB_USER%:%DB_PASSWORD%@localhost/keystone
 
 # the timeout before idle sql connections are reaped
 # idle_timeout = 200
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/3 python-keystone: get things working with stable/pike

In reply to Mark Asselstine

Since we need to ensure the setup is run after postgresql is setup and running we can't use a postinst as it runs too early in the boot process. Instead we have a simple service which will run after postgresql-init to complete the setup. On completion the service disables itself, avoiding being run again on subsequent boots.

Update configuration data to match keystone setup as described on the upstream project pages.

---
 .../python/python-keystone/keystone                | 128 --------------------
 .../python/python-keystone/keystone-init           |  60 ++++++++++
 .../python/python-keystone/keystone-init.service   |  12 ++
 .../python/python-keystone/wsgi-keystone.conf      |  73 ++++++++----
 .../recipes-devtools/python/python-keystone_git.bb | 129 ++++++++-------------
 5 files changed, 170 insertions(+), 232 deletions(-)
 delete mode 100644 meta-openstack/recipes-devtools/python/python-keystone/keystone
 create mode 100644 meta-openstack/recipes-devtools/python/python-keystone/keystone-init
 create mode 100644 meta-openstack/recipes-devtools/python/python-keystone/keystone-init.service
meta-openstack/recipes-devtools/python/python-keystone/keystone deleted +0 -128
deleted file mode 100644
index 34cc3ad..0000000
@@ -1,128 +0,0 @@
-#!/bin/sh
-
-### BEGIN INIT INFO
-# Provides:          keystone
-# Required-Start: $remote_fs $network $syslog
-# Required-Stop: $remote_fs $syslog
-# Default-Start:     3 5
-# Default-Stop:      0 1 2 6
-# Short-Description: Keystone Server
-# Description: OpenStack identity Service (code-named keystone)
-### END INIT INFO
-
-DESC="keystone"
-DAEMON="uwsgi"
-DAEMON_OPTIONS="--http 127.0.0.1:35357 --wsgi-file $(which keystone-wsgi-admin)"
-PIDFILE="/var/run/keystone-all.pid"
-
-start ()
-{
-    if [ -e $PIDFILE ]; then
-        PIDDIR=/proc/$(cat $PIDFILE)
-        if [ -d ${PIDDIR} ]; then
-            echo "$DESC already running."
-            exit 1
-        else
-            echo "Removing stale PID file $PIDFILE"
-            rm -f $PIDFILE
-        fi
-    fi
-
-    if [ ! -d /var/log/keystone ]; then
-        mkdir /var/log/keystone                                                     
-    fi
-    echo -n "Starting $DESC..."
-
-    start-stop-daemon --start --quiet --background \
-        --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} \
-	-- ${DAEMON_OPTIONS}
-
-    if [ $? -eq 0 ]; then
-        echo "done."
-    else
-        echo "failed."
-    fi
-}
-
-stop ()
-{
-    echo -n "Stopping $DESC..."
-    start-stop-daemon --stop --quiet --pidfile $PIDFILE
-    if [ $? -eq 0 ]; then
-        echo "done."
-    else
-        echo "failed."
-    fi
-    rm -f $PIDFILE
-}
-
-status()
-{
-    pid=`cat $PIDFILE 2>/dev/null`
-    if [ -n "$pid" ]; then
-        if ps -p $pid > /dev/null 2>&1 ; then
-            echo "$DESC is running"
-            return
-        fi
-    fi
-    echo "$DESC is not running"
-}
-
-reset()
-{
-    # Cleanup keystone tenant
-    . /etc/nova/openrc
-    simple_delete "keystone user-list" "keystone user-delete" 1 "keystone user"
-    simple_delete "keystone tenant-list" "keystone tenant-delete" 1 "keystone tenant"
-    simple_delete "keystone role-list" "keystone role-delete" 1 "keystone role"
-    simple_delete "keystone endpoint-list" "keystone endpoint-delete" 1 "keystone endpoint"
-    simple_delete "keystone service-list" "keystone service-delete" 1 "keystone service"
-
-    stop
-
-    # This is to make sure postgres is configured and running
-    if ! pidof postmaster > /dev/null; then
-        /etc/init.d/postgresql-init
-        /etc/init.d/postgresql start
-        sleep 2
-    fi
-
-    sudo -u postgres dropdb keystone
-    sudo -u postgres createdb keystone
-    keystone-manage db_sync
-    keystone-manage pki_setup --keystone-user=root --keystone-group=root
-
-    start
-
-    sleep 2
-
-    ADMIN_PASSWORD=%ADMIN_PASSWORD% \
-    SERVICE_PASSWORD=%SERVICE_PASSWORD% \
-    SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% \
-        bash /etc/keystone/service-user-setup
-}
-
-case "$1" in
-    start)
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    restart|force-reload|reload)
-        stop
-        start
-        ;;
-    status)
-	status
-        ;;
-    reset)
-	reset
-        ;;
-    *)
-        echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}"
-        exit 1
-        ;;
-esac
-
-exit 0
meta-openstack/recipes-devtools/python/python-keystone/keystone-init new file +60 -0

60 lines not on this page · raw message

meta-openstack/recipes-devtools/python/python-keystone/keystone-init.service new file +12 -0
new file mode 100644
index 0000000..b114806
@@ -0,0 +1,12 @@
+[Unit]
+Description=Barebones OpenStack keystone initialization
+After=postgresql-init.service
+
+[Service]
+Type=oneshot
+ExecStart=%SYSCONFIGDIR%/keystone/keystone-init
+ExecStartPost=/bin/systemctl --no-reload disable keystone-init.service
+RemainAfterExit=No
+
+[Install]
+WantedBy=multi-user.target
meta-openstack/recipes-devtools/python/python-keystone/wsgi-keystone.conf +50 -23

75 lines not on this page · raw message

meta-openstack/recipes-devtools/python/python-keystone_git.bb +48 -81

211 lines not on this page · raw message

Signature · 1 line
2.7.4