vnf_gateway1_cidr = g1cidr
vnf_gateway2_cidr = g2cidr
- with open(BOOT_SCRIPT_PATHNAME, 'r') as boot_script:
+ with open(BOOT_SCRIPT_PATHNAME, 'r', encoding="utf-8") as boot_script:
content = boot_script.read()
vm_config = {
'forwarder': config.vm_forwarder,
The config file content taking precedence in case of duplicate
"""
try:
- with open(file_name) as fileobj:
+ with open(file_name, encoding="utf-8") as fileobj:
cfg = AttrDict(yaml.safe_load(fileobj))
except IOError:
raise Exception("Configuration file at '{}' was not found. Please use correct path "
if openrc_file:
if isinstance(openrc_file, str):
if os.path.exists(openrc_file):
- with open(openrc_file) as rc_file:
+ with open(openrc_file, encoding="utf-8") as rc_file:
self.__parse_openrc(rc_file)
else:
LOG.error('Error: rc file does not exist %s', openrc_file)
sys.exit(0)
if opts.summary:
- with open(opts.summary) as json_data:
+ with open(opts.summary, encoding="utf-8") as json_data:
result = json.load(json_data)
if opts.user_label:
result['config']['user_label'] = opts.user_label
# dump the contents of the trex log file
if opts.show_trex_log:
try:
- with open('/tmp/trex.log') as trex_log_file:
+ with open('/tmp/trex.log', encoding="utf-8") as trex_log_file:
print(trex_log_file.read(), end="")
except FileNotFoundError:
print("No TRex log file found!")
after = None
last = None
try:
- with open('/tmp/trex.log', 'r') as trex_log:
+ with open('/tmp/trex.log', 'r', encoding="utf-8") as trex_log:
for _line in trex_log:
line = _line.strip()
if line.startswith('Usage:'):
break
last_size = size
time.sleep(1)
- with open(logpath, 'r') as f:
+ with open(logpath, 'r', encoding="utf-8") as f:
message = f.read()
else:
message = e.message
def __load_config(self, filename):
result = {}
if os.path.exists(filename):
- with open(filename, 'r') as stream:
+ with open(filename, 'r', encoding="utf-8") as stream:
try:
result = yaml.safe_load(stream)
except yaml.YAMLError as exc:
yaml.safe_load(result)
if os.path.exists(filename):
os.remove(filename)
- with open(filename, 'w') as f:
+ with open(filename, 'w', encoding="utf-8") as f:
f.write(result)
return filename
if filepaths:
for file_path in filepaths:
LOG.info('Saving results in json file: %s...', file_path)
- with open(file_path, 'w') as jfp:
+ with open(file_path, 'w', encoding="utf-8") as jfp:
json.dump(result,
jfp,
indent=4,