From 2583755bd9eea99f628d4dfa2210619a13583bbc Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 17 Apr 2017 19:28:34 +0200 Subject: [PATCH] Retire repo This repo was created by accident, use deb-python-os-refresh-config instead. Needed-By: I1ac1a06931c8b6dd7c2e73620a0302c29e605f03 Change-Id: I81894aea69b9d09b0977039623c26781093a397a --- .coveragerc | 7 - .gitignore | 45 ---- .gitreview | 4 - .testr.conf | 4 - LICENSE | 202 ------------------ README.rst | 36 ---- README.txt | 13 ++ os_refresh_config/__init__.py | 0 os_refresh_config/os_refresh_config.py | 166 -------------- os_refresh_config/tests/__init__.py | 0 os_refresh_config/tests/test_cmd.py | 163 -------------- os_refresh_config/tests/test_main.py | 42 ---- .../tests/test_os_refresh_config.py | 37 ---- requirements.txt | 6 - setup.cfg | 33 --- setup.py | 29 --- test-requirements.txt | 15 -- tests/configure.d/40-error | 4 - tests/pre-configure.d/01-test | 3 - tox.ini | 32 --- 20 files changed, 13 insertions(+), 828 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .gitignore delete mode 100644 .gitreview delete mode 100644 .testr.conf delete mode 100644 LICENSE delete mode 100644 README.rst create mode 100644 README.txt delete mode 100644 os_refresh_config/__init__.py delete mode 100755 os_refresh_config/os_refresh_config.py delete mode 100644 os_refresh_config/tests/__init__.py delete mode 100644 os_refresh_config/tests/test_cmd.py delete mode 100644 os_refresh_config/tests/test_main.py delete mode 100644 os_refresh_config/tests/test_os_refresh_config.py delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 test-requirements.txt delete mode 100755 tests/configure.d/40-error delete mode 100755 tests/pre-configure.d/01-test delete mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 356708b..0000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -branch = True -source = os_refresh_config -omit = os_refresh_config/tests/* - -[report] -ignore_errors = True diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 161c8b7..0000000 --- a/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -*.py[cod] - -# C extensions -*.so - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -cover -.testrepository -.tox -nosetests.xml - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# OpenStack Generated Files -AUTHORS -ChangeLog - -# Editors -*~ -*.swp diff --git a/.gitreview b/.gitreview deleted file mode 100644 index cd83bef..0000000 --- a/.gitreview +++ /dev/null @@ -1,4 +0,0 @@ -[gerrit] -host=review.openstack.org -port=29418 -project=openstack/os-refresh-config.git diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index a2ff14b..0000000 --- a/.testr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d645695..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/README.rst b/README.rst deleted file mode 100644 index 0967b63..0000000 --- a/README.rst +++ /dev/null @@ -1,36 +0,0 @@ -================= -os-refresh-config -================= - -`os-refresh-config` uses `dib-run-parts` to run scripts in a -pre-defined set of directories:: - - /opt/stack/os-config-refresh/pre-configure.d - /opt/stack/os-config-refresh/configure.d - /opt/stack/os-config-refresh/post-configure.d - /opt/stack/os-config-refresh/migration.d - /opt/stack/os-config-refresh/error.d - -`/opt/stack/os-config-refresh` is the default base directory. You can -set `OS_REFRESH_CONFIG_BASE_DIR` environment variable to override the -default one. - -Its intended purpose is to separate scripts execution into 4 phases: - -1. Quiesce(pre-configure.d), -2. Configure(configure.d), -3. Activate(post-configure.d). -4. Migrate(migration.d), - -It runs through all the phases above to ensure configuration is applied -and enabled on a machine. It will run the scripts in error.d and then -exit with a non-zero exit status if any phase has a problem. The scripts -in each phase should not depend on each other having worked properly. - -Note: Earlier versions of os-refresh-config ran migration before -post-configure. This was an oversight in the initial design, as -migrations are intended to be online migrations after the host is -fully configured. - -For things which must happen while the service is quiesced, that should -be done in the post-configure scripts which control the service state. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..8dabca7 --- /dev/null +++ b/README.txt @@ -0,0 +1,13 @@ +This project is no longer maintained. + +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". + +Use instead the project deb-python-os-refresh-config at +http://git.openstack.org/cgit/openstack/deb-python-os-refresh-config . + +For any further questions, please email +openstack-dev@lists.openstack.org or join #openstack-dev on +Freenode. diff --git a/os_refresh_config/__init__.py b/os_refresh_config/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/os_refresh_config/os_refresh_config.py b/os_refresh_config/os_refresh_config.py deleted file mode 100755 index e50776a..0000000 --- a/os_refresh_config/os_refresh_config.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env python -# Copyright 2013 Hewlett-Packard Development Company, L.P. -# 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. - -import argparse -import fcntl -import logging -import os -import signal -import subprocess -import sys -import time - -import psutil - -OLD_BASE_DIR = '/opt/stack/os-config-refresh' -DEFAULT_BASE_DIR = '/usr/libexec/os-refresh-config' - - -def default_base_dir(): - """Determine the default base directory path - - If the OS_REFRESH_CONFIG_BASE_DIR environment variable is set, - use its value. - Otherwise, prefer the new default path, but still allow the old one for - backwards compatibility. - """ - base_dir = os.environ.get('OS_REFRESH_CONFIG_BASE_DIR') - if base_dir is None: - # NOTE(bnemec): Prefer the new location, but still allow the old one. - if os.path.isdir(OLD_BASE_DIR) and not os.path.isdir(DEFAULT_BASE_DIR): - logging.warning('Base directory %s is deprecated. The recommended ' - 'base directory is %s', - OLD_BASE_DIR, DEFAULT_BASE_DIR) - base_dir = OLD_BASE_DIR - else: - base_dir = DEFAULT_BASE_DIR - return base_dir - - -BASE_DIR = default_base_dir() - -PHASES = ['pre-configure', - 'configure', - 'post-configure', - 'migration'] - - -def timeout(): - p = psutil.Process() - children = list(p.get_children(recursive=True)) - for child in children: - child.kill() - - -def exit(lock, statuscode=0): - signal.alarm(0) - if lock: - lock.truncate(0) - lock.close() - return statuscode - - -def main(argv=sys.argv): - parser = argparse.ArgumentParser( - description="""Runs through all of the phases to ensure - configuration is applied and enabled on a machine. Will exit with - an error if any phase has a problem. Scripts should not depend on - eachother having worked properly. Set OS_REFRESH_CONFIG_BASE_DIR - environment variable to override the default - """) - parser.add_argument('--print-base', default=False, action='store_true', - help='Print base dir and exit') - parser.add_argument('--print-phases', default=False, action='store_true', - help='Print phases (tab separated) and exit') - parser.add_argument('--log-level', default='INFO', - choices=['ERROR', 'WARN', 'CRITICAL', 'INFO', 'DEBUG']) - parser.add_argument('--lockfile', - default='/var/run/os-refresh-config.lock', - help='Lock file to prevent multiple running copies.') - parser.add_argument('--timeout', - type=int, - help='Seconds until the current run will be ' - 'terminated.') - options = parser.parse_args(argv[1:]) - - if options.print_base: - print(BASE_DIR) - return 0 - - if options.print_phases: - print("\t".join(PHASES)) - return 0 - - log = logging.getLogger('os-refresh-config') - handler = logging.StreamHandler(sys.stderr) - handler.setFormatter( - logging.Formatter( - '[%(asctime)s] (%(name)s) [%(levelname)s] %(message)s')) - log.addHandler(handler) - log.setLevel(options.log_level) - - # Keep open (and thus, locked) for duration of program - lock = open(options.lockfile, 'a') - try: - fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError as e: - log.error('Could not lock %s. %s' % (options.lockfile, e)) - return e.errno - - lock.truncate(0) - lock.write("Locked by pid==%d at %s\n" % (os.getpid(), time.localtime())) - - def timeout_handler(signum, frame): - log.error('Timeout reached: %ss. Sending SIGKILL to all children' % - options.timeout) - timeout() - - if options.timeout: - signal.signal(signal.SIGALRM, timeout_handler) - signal.alarm(options.timeout) - - for phase in PHASES: - phase_dir = os.path.join(BASE_DIR, '%s.d' % phase) - log.debug('Checking %s' % phase_dir) - if os.path.exists(phase_dir): - args = ['dib-run-parts'] - args.append(phase_dir) - try: - log.info('Starting phase %s' % phase) - log.debug('Running %s' % args) - subprocess.check_call(args, close_fds=True) - sys.stdout.flush() - sys.stderr.flush() - log.info('Completed phase %s' % phase) - except subprocess.CalledProcessError as e: - log.error("during %s phase. [%s]\n" % (phase, e)) - error_dir = os.path.join(BASE_DIR, 'error.d') - if os.path.exists(error_dir): - log.info('Calling error handlers.') - try: - subprocess.call(['dib-run-parts', error_dir]) - except OSError: - pass - log.error("Aborting...") - return exit(lock, 1) - else: - log.debug('No dir for phase %s' % phase) - - return exit(lock) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/os_refresh_config/tests/__init__.py b/os_refresh_config/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/os_refresh_config/tests/test_cmd.py b/os_refresh_config/tests/test_cmd.py deleted file mode 100644 index 49038a8..0000000 --- a/os_refresh_config/tests/test_cmd.py +++ /dev/null @@ -1,163 +0,0 @@ -# -# 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 os -import subprocess -import time - -import fixtures -import testtools - -script_path = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - '../os_refresh_config.py') - - -class TestCmd(testtools.TestCase): - - def setUp(self): - super(TestCmd, self).setUp() - self.assertTrue(os.path.exists(script_path)) - self.useFixture(fixtures.NestedTempfile()) - self.base_dir = self.useFixture(fixtures.TempDir()) - self.lockdir = self.useFixture(fixtures.TempDir()) - self.lockfile = os.path.join(self.lockdir.path, 'lock') - - def _run_cmd(self, args, env={}, input_str=None): - subproc = subprocess.Popen(args, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - env=env) - stdout, stderr = subproc.communicate(input=input_str) - return (subproc.returncode, - stdout.decode('utf-8'), - stderr.decode('utf-8')) - - def _run_orc(self, *args): - cmd_env = { - 'OS_REFRESH_CONFIG_BASE_DIR': self.base_dir.path, - 'PATH': os.environ.get('PATH') - } - cmd_args = [ - script_path, - '--lockfile', self.lockfile - ] - if args: - cmd_args.extend(args) - return self._run_cmd(cmd_args, cmd_env) - - def _write_script(self, phase, name, returncode=0, sleep=0): - phase_dir_name = '%s.d' % phase - phase_dir = self.base_dir.join(phase_dir_name) - if not os.path.exists(phase_dir): - os.mkdir(phase_dir) - script_path = self.base_dir.join(phase_dir_name, name) - script_dict = { - 'name': name, - 'returncode': returncode, - 'sleep': sleep - } - with open(script_path, 'w') as f: - f.write('''#!/bin/sh -echo %(name)s starting -sleep %(sleep)s -echo %(name)s done -exit %(returncode)s -''' % script_dict) - os.chmod(script_path, 0o755) - - def test_cmd(self): - returncode, stdout, stderr = self._run_orc() - self.assertEqual(0, returncode) - self.assertEqual('', stdout) - self.assertEqual('', stderr) - - def test_cmd_with_scripts(self): - self._write_script('pre-configure', '10-pre-first', 0, 0) - self._write_script('pre-configure', '20-pre-second', 0, 1) - self._write_script('configure', '10-conf-first', 0, 0) - self._write_script('configure', '20-conf-second', 0, 1) - self._write_script('post-configure', '10-post-first', 0, 0) - self._write_script('post-configure', '20-post-second', 0, 1) - now = time.time() - returncode, stdout, stderr = self._run_orc() - - # check run time accounts for the 3 seconds of sleep - self.assertTrue(time.time() - now >= 3.0) - self.assertEqual('\n'.join([ - '10-pre-first starting', - '10-pre-first done', - '20-pre-second starting', - '20-pre-second done', - '10-conf-first starting', - '10-conf-first done', - '20-conf-second starting', - '20-conf-second done', - '10-post-first starting', - '10-post-first done', - '20-post-second starting', - '20-post-second done', - '', - ]), stdout) - self.assertEqual(0, returncode) - - def test_cmd_with_failure(self): - self._write_script('pre-configure', '10-pre-first', 0) - self._write_script('pre-configure', '20-pre-second', 99) - self._write_script('configure', '10-conf-first', 0) - returncode, stdout, stderr = self._run_orc() - self.assertEqual('\n'.join([ - '10-pre-first starting', - '10-pre-first done', - '20-pre-second starting', - '20-pre-second done', - '', - ]), stdout) - self.assertEqual(1, returncode) - - def test_cmd_with_timeout(self): - self._write_script('pre-configure', '10-pre-first', 0, 5) - self._write_script('pre-configure', '20-pre-second', 0, 5) - self._write_script('configure', '10-conf-first', 0, 5) - - now = time.time() - returncode, stdout, stderr = self._run_orc('--timeout', '2', - '--log-level', 'DEBUG') - # check run time accounts for the 2 seconds timeout - self.assertTrue(time.time() - now >= 2.0) - self.assertEqual('\n'.join([ - '10-pre-first starting', - '', - ]), stdout) - self.assertEqual(1, returncode) - - def test_debug(self): - returncode, stdout, stderr = self._run_orc('--log-level', 'DEBUG') - self.assertEqual('', stdout) - self.assertNotEqual('', stderr) - self.assertEqual(0, returncode) - - def test_print_phases(self): - returncode, stdout, stderr = self._run_orc('--print-phases') - self.assertEqual( - 'pre-configure\tconfigure\tpost-configure\tmigration\n', - stdout - ) - self.assertEqual('', stderr) - self.assertEqual(0, returncode) - - def test_print_base(self): - returncode, stdout, stderr = self._run_orc('--print-base') - self.assertEqual('%s\n' % self.base_dir.path, stdout) - self.assertEqual('', stderr) - self.assertEqual(0, returncode) diff --git a/os_refresh_config/tests/test_main.py b/os_refresh_config/tests/test_main.py deleted file mode 100644 index a4a4b09..0000000 --- a/os_refresh_config/tests/test_main.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2014 Hewlett-Packard Development Company, L.P. -# 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. -import os - -import fixtures -import testtools - -from os_refresh_config import os_refresh_config - - -class TestMain(testtools.TestCase): - def setUp(self): - super(TestMain, self).setUp() - self.useFixture(fixtures.NestedTempfile()) - td = self.useFixture(fixtures.TempDir()) - self.useFixture( - fixtures.EnvironmentVariable( - "OS_REFRESH_CONFIG_BASE_DIR", - td.path)) - - def _run_main(self, args=[]): - self.lockdir = self.useFixture(fixtures.TempDir()) - self.lockfile = os.path.join(self.lockdir.path, 'lock') - return os_refresh_config.main(argv=['os-refresh-config', - '--lockfile', self.lockfile]) - - def test_main(self): - self.assertEqual(0, self._run_main()) - self.assertTrue(os.path.exists(self.lockfile)) - self.assertEqual(0, len(open(self.lockfile).read())) diff --git a/os_refresh_config/tests/test_os_refresh_config.py b/os_refresh_config/tests/test_os_refresh_config.py deleted file mode 100644 index c8b05c9..0000000 --- a/os_refresh_config/tests/test_os_refresh_config.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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 mock -import testtools - -from os_refresh_config import os_refresh_config - - -class TestRefreshConfig(testtools.TestCase): - def test_default_base_dir(self): - default = '/usr/libexec/os-refresh-config' - with mock.patch('os.path.isdir', lambda x: x == default): - self.assertEqual(default, os_refresh_config.default_base_dir()) - - def test_default_base_dir_deprecated(self): - default = '/opt/stack/os-config-refresh' - with mock.patch('os.path.isdir', lambda x: x == default): - self.assertEqual(default, os_refresh_config.default_base_dir()) - - def test_default_base_dir_both(self): - default = '/usr/libexec/os-refresh-config' - deprecated = '/opt/stack/os-config-refresh' - with mock.patch('os.path.isdir', lambda x: (x == default or - x == deprecated)): - self.assertEqual(default, os_refresh_config.default_base_dir()) diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c44400e..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. -pbr>=1.6 # Apache-2.0 -dib-utils # Apache-2.0 -psutil>=1.1.1,<2.0.0 # BSD diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1592a9b..0000000 --- a/setup.cfg +++ /dev/null @@ -1,33 +0,0 @@ -[metadata] -name = os-refresh-config -author = OpenStack -author-email = openstack-dev@lists.openstack.org -summary = Refresh system configuration -description-file = - README.rst -home-page = http://github.com/openstack/os-refresh-config -classifier = - Development Status :: 4 - Beta - Environment :: Console - Environment :: OpenStack - Intended Audience :: Developers - Intended Audience :: Information Technology - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python - -[files] -packages = - os_refresh_config - -[entry_points] -console_scripts = - os-refresh-config = os_refresh_config.os_refresh_config:main - -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - -[wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index 782bb21..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# 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. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr>=1.8'], - pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 8ad6720..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. -hacking<0.10,>=0.9.2 - -Babel>=2.3.4 # BSD -coverage>=3.6 # Apache-2.0 -discover # BSD -fixtures>=3.0.0 # Apache-2.0/BSD -mock>=2.0 # BSD -python-subunit>=0.0.18 # Apache-2.0/BSD -sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD -testrepository>=0.0.18 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD -testtools>=1.4.0 # MIT diff --git a/tests/configure.d/40-error b/tests/configure.d/40-error deleted file mode 100755 index 65c720e..0000000 --- a/tests/configure.d/40-error +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -echo PASS -echo There will now be an error. -exit 1 diff --git a/tests/pre-configure.d/01-test b/tests/pre-configure.d/01-test deleted file mode 100755 index 8ed5c7b..0000000 --- a/tests/pre-configure.d/01-test +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -echo PASS -exit 0 diff --git a/tox.ini b/tox.ini deleted file mode 100644 index f74fc27..0000000 --- a/tox.ini +++ /dev/null @@ -1,32 +0,0 @@ -[tox] -minversion = 1.6 -skipsdist = True -envlist = py27,pep8 - -[testenv] -usedevelop = True -install_command = pip install -U {opts} {packages} -setenv = VIRTUAL_ENV={envdir} -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = - python setup.py testr --slowest --testr-args='{posargs}' - -[tox:jenkins] -sitepackages = True - -[testenv:pep8] -commands = flake8 - -[testenv:cover] -setenv = VIRTUAL_ENV={envdir} -commands = - python setup.py testr --coverage --coverage-package-name=os_refresh_config - -[testenv:venv] -commands = {posargs} - -[flake8] -ignore = E125,H803 -exclude = .venv,.tox,dist,doc,*.egg -show-source = true