[PATCH] rteval: Allow configuration from stdin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modules can currently be set only via configuration file, if rteval is
called from a script run on different systems, the only way to make sure
the loaded modules are known is to provide (or generate) a configuration
file and pass it via -f/--infile .

Add the possibility to use - as input file to read the configuration via
standard input.

This allows something like:

 # rteval -f - << EOF
[measurement]
timerlat: module

[loads]
stressng:  module
EOF

Signed-off-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>
---
 rteval/rtevalConfig.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py
index 0c2fc6b..4c41ed7 100644
--- a/rteval/rtevalConfig.py
+++ b/rteval/rtevalConfig.py
@@ -238,10 +238,14 @@ class rtevalConfig:
             # Don't try to reread this file if it's already been parsed
             return
 
-        self.__info(f"reading config file {cfgfile}")
         ini = configparser.ConfigParser()
         ini.optionxform = str
-        ini.read(cfgfile)
+        if cfgfile == "-":
+            self.__info("reading config file stdin")
+            ini.read_file(sys.stdin)
+        else:
+            self.__info(f"reading config file {cfgfile}")
+            ini.read(cfgfile)
 
         # wipe any previously read config info
         if not append:

base-commit: 5edb31a58bea3c2433e817439e053b79221a06df
-- 
2.47.1





[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux