Fix paths to cdist executable

This commit is contained in:
Dennis Camera 2020-11-11 15:04:51 +01:00
parent f82e0167aa
commit 0ee3fda94d
3 changed files with 5 additions and 6 deletions

View file

@ -54,13 +54,12 @@ _mydir = os.path.dirname(__file__)
def find_cdist_exec(): def find_cdist_exec():
"""Search cdist executable starting from local lib directory. """Search cdist executable starting from local lib directory.
Detect if ../scripts/cdist (from local lib direcotry) exists and Detect if ../bin/cdist (from local lib directory) exists and
if it is executable. If not then try to find cdist exec path in if it is executable. If not then try to find cdist exec path in
os.get_exec_path() entries. If no cdist path is found rasie os.get_exec_path() entries. If no cdist path is found rasie
cdist.Error. cdist.Error.
""" """
cdist_path = os.path.abspath(os.path.join(_mydir, '..', 'scripts', cdist_path = os.path.abspath(os.path.join(_mydir, '..', 'bin', 'cdist'))
'cdist'))
if os.access(cdist_path, os.X_OK): if os.access(cdist_path, os.X_OK):
return cdist_path return cdist_path
cdist_path = find_cdist_exec_in_path() cdist_path = find_cdist_exec_in_path()

View file

@ -26,7 +26,7 @@ import tempfile
cdist_base_path = os.path.abspath( cdist_base_path = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../")) os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../"))
cdist_exec_path = os.path.join(cdist_base_path, "scripts/cdist") cdist_exec_path = os.path.join(cdist_base_path, "bin/cdist")
global_fixtures_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), global_fixtures_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
"fixtures")) "fixtures"))

View file

@ -202,7 +202,7 @@ class ConfigRunTestCase(test.CdistTestCase):
host_dir_name=self.hostdir, host_dir_name=self.hostdir,
# exec_path can not derivated from sys.argv in case of unittest # exec_path can not derivated from sys.argv in case of unittest
exec_path=os.path.abspath(os.path.join( exec_path=os.path.abspath(os.path.join(
my_dir, '../../../scripts/cdist')), my_dir, '../../../bin/cdist')),
initial_manifest=os.path.join(fixtures, initial_manifest=os.path.join(fixtures,
'manifest/dryrun_manifest'), 'manifest/dryrun_manifest'),
add_conf_dirs=[fixtures]) add_conf_dirs=[fixtures])
@ -219,7 +219,7 @@ class ConfigRunTestCase(test.CdistTestCase):
base_root_path=self.host_base_path, base_root_path=self.host_base_path,
host_dir_name=self.hostdir, host_dir_name=self.hostdir,
exec_path=os.path.abspath(os.path.join( exec_path=os.path.abspath(os.path.join(
my_dir, '../../../scripts/cdist')), my_dir, '../../../bin/cdist')),
initial_manifest=os.path.join( initial_manifest=os.path.join(
fixtures, 'manifest/init-deps-resolver'), fixtures, 'manifest/init-deps-resolver'),
add_conf_dirs=[fixtures]) add_conf_dirs=[fixtures])