mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 09:32:21 +00:00
Adjust sys.path logic in macmap and osimage
Ensure the sys.path logic is before attempting the relevant imports.
This commit is contained in:
parent
809099c8f8
commit
03fce4f762
@ -31,7 +31,14 @@
|
||||
# this module will provide mac to switch and full 'ifName' label
|
||||
# This functionality is restricted to the null tenant
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
path = os.path.realpath(os.path.join(path, '..', '..'))
|
||||
if path.startswith('/opt'):
|
||||
sys.path.append(path)
|
||||
import confluent.config.configmanager as cfm
|
||||
import confluent.snmputil as snmp
|
||||
|
||||
@ -43,8 +50,6 @@ import eventlet.green.select as select
|
||||
import eventlet.green.socket as socket
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import confluent.exceptions as exc
|
||||
import confluent.log as log
|
||||
import confluent.messages as msg
|
||||
@ -690,10 +695,6 @@ def rescan(cfg):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
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)
|
||||
if len(sys.argv) > 1 and sys.argv[1] == '-o':
|
||||
try:
|
||||
upacker = msgpack.Unpacker(encoding='utf8')
|
||||
|
@ -1,6 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
import confluent.exceptions as exc
|
||||
import confluent.messages as msg
|
||||
import eventlet
|
||||
import eventlet.green.select as select
|
||||
import eventlet.green.subprocess as subprocess
|
||||
@ -14,6 +12,14 @@ import shutil
|
||||
import sys
|
||||
import time
|
||||
import yaml
|
||||
if __name__ == '__main__':
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
path = os.path.realpath(os.path.join(path, '..'))
|
||||
if path.startswith('/opt'):
|
||||
sys.path.append(path)
|
||||
|
||||
import confluent.exceptions as exc
|
||||
import confluent.messages as msg
|
||||
|
||||
COPY = 1
|
||||
EXTRACT = 2
|
||||
@ -930,10 +936,6 @@ def get_importing_status(importkey):
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.umask(0o022)
|
||||
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)
|
||||
if len(sys.argv) > 2:
|
||||
mfd = os.environ.get('CONFLUENT_MEDIAFD', None)
|
||||
sys.exit(import_image(sys.argv[1], callback=printit, backend=True, mfd=mfd))
|
||||
|
Loading…
Reference in New Issue
Block a user