allow for NON_STANDARD_REQS override
there are non integrated projects in openstack that use devstack framework for running jobs. They need a lever in their jobs to tell the infrastructure that we won't enforce global-requirements strict compliance on them. We'll still generate a warning so that they know they are using requirements outside of OpenStack's accepted list, but it will be non fatal. Change-Id: Id90547e2fb0a5736385c9f31ba386e7c2e0616df
This commit is contained in:
parent
5a2ce5357d
commit
7e221a2ec0
|
@ -123,3 +123,11 @@ class UpdateTest(testtools.TestCase):
|
|||
returncode = subprocess.call([sys.executable, "update.py",
|
||||
"bad_project"])
|
||||
self.assertEqual(returncode, 1)
|
||||
|
||||
def test_requirment_not_in_global_non_fatal(self):
|
||||
env = os.environ.copy()
|
||||
env['NON_STANDARD_REQS'] = '1'
|
||||
returncode = subprocess.call(
|
||||
[sys.executable, "update.py", "bad_project"],
|
||||
env=env)
|
||||
self.assertEqual(returncode, 0)
|
||||
|
|
19
update.py
19
update.py
|
@ -135,12 +135,19 @@ def _sync_requirements_file(source_reqs, dev_reqs, dest_path, suffix):
|
|||
else:
|
||||
new_reqs.write("%s\n" % source_reqs[old_pip])
|
||||
else:
|
||||
# Found a requirement that isn't in the global requirement file
|
||||
# This is not supposed to happen, so exit with a failure.
|
||||
print("'%s' is not a global requirement but it should be,"
|
||||
"something went wrong" %
|
||||
old_pip)
|
||||
sys.exit(1)
|
||||
# What do we do if we find something unexpected?
|
||||
#
|
||||
# In the default cause we should die horribly, because
|
||||
# the point of global requirements was a single lever
|
||||
# to control all the pip installs in the gate.
|
||||
#
|
||||
# However, we do have other projects using
|
||||
# devstack jobs that might have legitimate reasons to
|
||||
# override. For those we support NON_STANDARD_REQS=1
|
||||
# environment variable to turn this into a warning only.
|
||||
print("'%s' is not in global-requirements.txt" % old_pip)
|
||||
if os.getenv('NON_STANDARD_REQS', '0') != '1':
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def _copy_requires(suffix, dest_dir):
|
||||
|
|
Loading…
Reference in New Issue