Revert "Add snap package paths to default config dirs"
This reverts commit 982cf476d0
.
This commit likes a feature backport and get against from release team.
we must revert this, otherwise we can't release for stable/ocata. For
more details, please refer to comments in I3087bc28d4f30a3073e312f78fe50b8feba489c0
Change-Id: Idaba6ce45124a9c6b514cf91675bec505f802a1a
This commit is contained in:
parent
982cf476d0
commit
fe08d77191
|
@ -614,27 +614,16 @@ def _get_config_dirs(project=None):
|
|||
/etc/${project}/
|
||||
/etc/
|
||||
|
||||
If a project is specified and installed from a snap package, following
|
||||
directories are also returned:
|
||||
|
||||
${SNAP}/etc/${project}
|
||||
${SNAP_COMMON}/etc/${project}
|
||||
|
||||
Otherwise, if project is not specified, these directories are returned:
|
||||
Otherwise, these directories::
|
||||
|
||||
~/
|
||||
/etc/
|
||||
"""
|
||||
snap = os.environ.get('SNAP')
|
||||
snap_c = os.environ.get('SNAP_COMMON')
|
||||
|
||||
cfg_dirs = [
|
||||
_fixpath(os.path.join('~', '.' + project)) if project else None,
|
||||
_fixpath('~'),
|
||||
os.path.join('/etc', project) if project else None,
|
||||
'/etc',
|
||||
os.path.join(snap, "etc", project) if snap and project else None,
|
||||
os.path.join(snap_c, "etc", project) if snap_c and project else None,
|
||||
'/etc'
|
||||
]
|
||||
return [x for x in cfg_dirs if x]
|
||||
|
||||
|
@ -685,8 +674,6 @@ def find_config_files(project=None, prog=None, extension='.conf'):
|
|||
~/
|
||||
/etc/${project}/
|
||||
/etc/
|
||||
${SNAP}/etc/${project}
|
||||
${SNAP_COMMON}/etc/${project}
|
||||
|
||||
We return an absolute path for (at most) one of each the default config
|
||||
files, for the topmost directory it exists in.
|
||||
|
@ -717,8 +704,6 @@ def find_config_dirs(project=None, prog=None, extension='.conf.d'):
|
|||
~/
|
||||
/etc/${project}/
|
||||
/etc/
|
||||
${SNAP}/etc/${project}
|
||||
${SNAP_COMMON}/etc/${project}
|
||||
|
||||
We return an absolute path for each of the two config dirs,
|
||||
in the first place we find it (iff we find it).
|
||||
|
|
|
@ -208,18 +208,6 @@ class FindConfigFilesTestCase(BaseTestCase):
|
|||
|
||||
self.assertEqual(cfg.find_config_files(project='blaa'), config_files)
|
||||
|
||||
def test_find_config_files_snap(self):
|
||||
config_files = ['/snap/nova/current/etc/blaa/blaa.conf']
|
||||
fake_env = {'SNAP': '/snap/nova/current/',
|
||||
'SNAP_COMMON': '/var/snap/nova/common/'}
|
||||
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.argv', ['foo']))
|
||||
self.useFixture(fixtures.MonkeyPatch('os.path.exists',
|
||||
lambda p: p in config_files))
|
||||
self.useFixture(fixtures.MonkeyPatch('os.environ', fake_env))
|
||||
|
||||
self.assertEqual(cfg.find_config_files(project='blaa'), config_files)
|
||||
|
||||
def test_find_config_files_with_extension(self):
|
||||
config_files = ['/etc/foo.json']
|
||||
|
||||
|
@ -245,18 +233,6 @@ class FindConfigDirsTestCase(BaseTestCase):
|
|||
|
||||
self.assertEqual(cfg.find_config_dirs(project='blaa'), config_dirs)
|
||||
|
||||
def test_find_config_dirs_snap(self):
|
||||
config_dirs = ['/var/snap/nova/common/etc/blaa/blaa.conf.d']
|
||||
fake_env = {'SNAP': '/snap/nova/current/',
|
||||
'SNAP_COMMON': '/var/snap/nova/common/'}
|
||||
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.argv', ['foo']))
|
||||
self.useFixture(fixtures.MonkeyPatch('os.path.exists',
|
||||
lambda p: p in config_dirs))
|
||||
self.useFixture(fixtures.MonkeyPatch('os.environ', fake_env))
|
||||
|
||||
self.assertEqual(cfg.find_config_dirs(project='blaa'), config_dirs)
|
||||
|
||||
def test_find_config_dirs_non_exists(self):
|
||||
self.useFixture(fixtures.MonkeyPatch('sys.argv', ['foo']))
|
||||
self.assertEqual(cfg.find_config_dirs(project='blaa'), [])
|
||||
|
|
Loading…
Reference in New Issue