From 7576296b6cc98b29adeca79f8e01ca3aff602148 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Wed, 1 Oct 2014 13:38:02 -0400 Subject: [PATCH] Update repository after OpenStack migration * Add .gitignore * Update .gitreview (we thought it would be on Stackforge, but finally it's on OpenStack) * Add .testr.conf * Update run-flake8 script to avoid error when running flake8 without elements. * Update setup.cfg with correct name & description * Add no_dup_filenames unit test (required to have py27 gate working) Change-Id: Iea79eb5ccaa5ea765730ca99e146e54a3c0812f9 --- .gitignore | 10 +++++++++ .gitreview | 2 +- .testr.conf | 8 +++++++ run-flake8 | 9 +++++--- setup.cfg | 8 +++---- tests/test_no_dup_filenames.py | 41 ++++++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100644 .testr.conf create mode 100644 tests/test_no_dup_filenames.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ed21a9d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +*~ +.testrepository +*.sw? +*.pyc +.tox +*.egg-info +dist +build +AUTHORS +ChangeLog diff --git a/.gitreview b/.gitreview index e5086489..8cd4a77b 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=stackforge/tripleo-puppet-elements.git +project=openstack/tripleo-puppet-elements.git diff --git a/.testr.conf b/.testr.conf new file mode 100644 index 00000000..d3026e87 --- /dev/null +++ b/.testr.conf @@ -0,0 +1,8 @@ +[DEFAULT] +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ + ${PYTHON:-python} -m subunit.run discover -t ./ ./tests $LISTOPT $IDOPTION + +test_id_option=--load-list $IDFILE +test_list_option=--list diff --git a/run-flake8 b/run-flake8 index 54d9180c..be0774cc 100755 --- a/run-flake8 +++ b/run-flake8 @@ -18,6 +18,9 @@ set -o pipefail flake8 -extra_python_files=$(egrep -R --null-data --files-with-matches "^#!/usr/bin/env python" elements/) -echo $extra_python_files -flake8 ${extra_python_files} +# TODO (EmilienM) disable elements flake8 check, since we don't have elements yet. +# if we don't comment this, egrep will return '1' and flake8 will fail. +# +# extra_python_files=$(egrep -R --null-data --files-with-matches "^#!/usr/bin/env python" elements/) +# echo $extra_python_files +# flake8 ${extra_python_files} diff --git a/setup.cfg b/setup.cfg index 07ee5c9c..8d342046 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,12 +1,12 @@ [metadata] -name = tripleo-image-elements -summary = Disk image builder elements for deploying OpenStack. +name = tripleo-puppet-elements +summary = Puppet building rules for OpenStack images. description-file = README.md author = OpenStack author_email = openstack-dev@lists.openstack.org license = Apache License (2.0) -home-page = https://git.openstack.org/cgit/openstack/tripleo-image-elements +home-page = https://git.openstack.org/cgit/openstack/tripleo-puppet-elements classifier = Environment :: OpenStack Development Status :: 3 - Alpha @@ -17,7 +17,7 @@ classifier = [files] data_files = - share/tripleo-image-elements = elements/* + share/tripleo-puppet-elements = elements/* [wheel] universal = 1 diff --git a/tests/test_no_dup_filenames.py b/tests/test_no_dup_filenames.py new file mode 100644 index 00000000..f9320cda --- /dev/null +++ b/tests/test_no_dup_filenames.py @@ -0,0 +1,41 @@ +# Copyright 2014 Red Hat, Inc. +# +# 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. + +import glob +import os + + +import testtools + + +class TestNoDupFilenames(testtools.TestCase): + + def test_no_dup_filenames(self): + topdir = os.path.normpath(os.path.dirname(__file__) + '/../') + elements_glob = os.path.join(topdir, "elements", "*") + + filenames = [] + dirs_to_check = ['block-device.d', 'cleanup.d', 'extra-data.d', + 'finalise.d', 'install.d', 'post-install.d', + 'pre-install.d', 'root.d'] + + for element_dir in glob.iglob(elements_glob): + for dir_to_check in dirs_to_check: + target_dir = os.path.join(element_dir, dir_to_check, "*") + for target in glob.iglob(target_dir): + short_path = target[len(element_dir) + 1:] + if not os.path.isdir(target): + err_msg = 'Duplicate file name found %s' % short_path + self.assertFalse(short_path in filenames, err_msg) + filenames.append(short_path)