From 919b1b7fa91ddb0d13cac74459ffc505ed8959e0 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Thu, 5 Feb 2015 15:36:15 -0500 Subject: [PATCH] Perform an oslo-sync Removed run_cross_tests from openstack-common.conf Removed all of oslo_policy/openstack/common Performed sync from latest master of oslo-incubator Undid the delete to oslo_policy/openstack/common/_i18n.py since it is still required, until we move to oslo.i18n. oslo-incubator was at commit level: 9a1970b3708114cc52f89a7b4d048eeae9140fef Change-Id: I55288e618b268b73012784481c00285195edbf3b --- openstack-common.conf | 1 - oslo_policy/openstack/common/fileutils.py | 7 +- oslo_policy/openstack/common/local.py | 45 ----------- tools/run_cross_tests.sh | 91 ----------------------- 4 files changed, 5 insertions(+), 139 deletions(-) delete mode 100644 oslo_policy/openstack/common/local.py delete mode 100755 tools/run_cross_tests.sh diff --git a/openstack-common.conf b/openstack-common.conf index aad54712..3c7a522a 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -1,7 +1,6 @@ [DEFAULT] # The list of modules to copy from oslo-incubator.git -script = tools/run_cross_tests.sh modules=fileutils # The base module to hold the copy of openstack.common diff --git a/oslo_policy/openstack/common/fileutils.py b/oslo_policy/openstack/common/fileutils.py index ec26eaf9..6cacf22b 100644 --- a/oslo_policy/openstack/common/fileutils.py +++ b/oslo_policy/openstack/common/fileutils.py @@ -17,6 +17,7 @@ import contextlib import errno import logging import os +import stat import tempfile from oslo.utils import excutils @@ -24,15 +25,17 @@ from oslo.utils import excutils LOG = logging.getLogger(__name__) _FILE_CACHE = {} +DEFAULT_MODE = stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO -def ensure_tree(path): +def ensure_tree(path, mode=DEFAULT_MODE): """Create a directory (and any ancestor directories required) :param path: Directory to create + :param mode: Directory creation permissions """ try: - os.makedirs(path) + os.makedirs(path, mode) except OSError as exc: if exc.errno == errno.EEXIST: if not os.path.isdir(path): diff --git a/oslo_policy/openstack/common/local.py b/oslo_policy/openstack/common/local.py deleted file mode 100644 index 0819d5b9..00000000 --- a/oslo_policy/openstack/common/local.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# 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. - -"""Local storage of variables using weak references""" - -import threading -import weakref - - -class WeakLocal(threading.local): - def __getattribute__(self, attr): - rval = super(WeakLocal, self).__getattribute__(attr) - if rval: - # NOTE(mikal): this bit is confusing. What is stored is a weak - # reference, not the value itself. We therefore need to lookup - # the weak reference and return the inner value here. - rval = rval() - return rval - - def __setattr__(self, attr, value): - value = weakref.ref(value) - return super(WeakLocal, self).__setattr__(attr, value) - - -# NOTE(mikal): the name "store" should be deprecated in the future -store = WeakLocal() - -# A "weak" store uses weak references and allows an object to fall out of scope -# when it falls out of scope in the code that uses the thread local storage. A -# "strong" store will hold a reference to the object so that it never falls out -# of scope. -weak_store = WeakLocal() -strong_store = threading.local() diff --git a/tools/run_cross_tests.sh b/tools/run_cross_tests.sh deleted file mode 100755 index 5e7bc118..00000000 --- a/tools/run_cross_tests.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Run cross-project tests -# -# Usage: -# -# run_cross_tests.sh project_dir venv - -# Fail the build if any command fails -set -e - -project_dir="$1" -venv="$2" - -if [ -z "$project_dir" -o -z "$venv" ] -then - cat - < ./subunit_log.txt - fi - .tox/$venv/bin/python /usr/local/jenkins/slave_scripts/subunit2html.py ./subunit_log.txt testr_results.html - gzip -9 ./subunit_log.txt - gzip -9 ./testr_results.html - - export PYTHON=.tox/$venv/bin/python - set -e - rancount=$(.tox/$venv/bin/testr last | sed -ne 's/Ran \([0-9]\+\).*tests in.*/\1/p') - if [ "$rancount" -eq "0" ] ; then - echo - echo "Zero tests were run. At least one test should have been run." - echo "Failing this test as a result" - echo - exit 1 - fi -fi - -# If we make it this far, report status based on the tests that were -# run. -exit $result