2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-29 04:50:21 +00:00

Support relative path import

Have osimage import correct to absolute
path for import.
This commit is contained in:
Jarrod Johnson 2020-05-12 15:02:18 -04:00
parent 1ba2386b82
commit b73c561ca9

View File

@ -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}):