From b73c561ca958b22ba0541855fd3b73100e9d1108 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 12 May 2020 15:02:18 -0400 Subject: [PATCH] Support relative path import Have osimage import correct to absolute path for import. --- confluent_server/bin/osimage | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/confluent_server/bin/osimage b/confluent_server/bin/osimage index 76dd425c..05c95f69 100644 --- a/confluent_server/bin/osimage +++ b/confluent_server/bin/osimage @@ -1,10 +1,17 @@ #!/usr/bin/python2 import argparse -import confluent.client as client +import os.path import sys import time +path = os.path.dirname(os.path.realpath(__file__)) +path = os.path.realpath(os.path.join(path, '..', 'lib', 'python')) +if path.startswith('/opt'): + sys.path.append(path) + +import confluent.client as client + def main(args): ap = argparse.ArgumentParser(description='Manage OS deployment resources') sp = ap.add_subparsers(dest='command') @@ -16,6 +23,7 @@ def main(args): def osimport(imagefile): c = client.Command() + imagefile = os.path.abspath(imagefile) importing = False shortname = None for rsp in c.create('/deployment/importing/', {'filename': imagefile}):