diff options
author | Pierrick Louin <pierrick.louin@orange.com> | 2020-10-13 19:02:16 +0200 |
---|---|---|
committer | fmenguy <francoisregis.menguy@orange.com> | 2020-10-19 17:16:41 +0200 |
commit | 3ff4a4a2f24d2bc6c45379c0cc326d5db1ad7beb (patch) | |
tree | 8957c11af523859a06411f747c5908bdadb1e7bb /nfvbench/utils.py | |
parent | d755fd9c882b0864e5d3531d9e53c13d0b703d80 (diff) |
NFVBENCH-184: Add a feature (+ options) allowing to change ownership of shared log & result files
Change-Id: Id77426dade28aed48986ce6c18db6a193da5b6ed
Signed-off-by: Pierrick Louin <pierrick.louin@orange.com>
Diffstat (limited to 'nfvbench/utils.py')
-rw-r--r-- | nfvbench/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nfvbench/utils.py b/nfvbench/utils.py index 2ce735b..6da14ed 100644 --- a/nfvbench/utils.py +++ b/nfvbench/utils.py @@ -51,7 +51,7 @@ def timeout(seconds=10, error_message=os.strerror(errno.ETIME)): def save_json_result(result, json_file, std_json_path, service_chain, service_chain_count, - flow_count, frame_sizes): + flow_count, frame_sizes, user_id=None, group_id=None): """Save results in json format file.""" filepaths = [] if json_file: @@ -71,6 +71,11 @@ def save_json_result(result, json_file, std_json_path, service_chain, service_ch sort_keys=True, separators=(',', ': '), default=lambda obj: obj.to_json()) + # possibly change file ownership + if group_id is None: + group_id = user_id + if user_id is not None: + os.chown(file_path, user_id, group_id) def dict_to_json_dict(record): @@ -155,7 +160,6 @@ def get_intel_pci(nic_slot=None, nic_ports=None): return pcis - def parse_flow_count(flow_count): flow_count = str(flow_count) input_fc = flow_count |