pcp
[Top] [All Lists]

Re: pmrep: improve command line parsing

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: Re: pmrep: improve command line parsing
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 29 Jun 2016 20:32:12 +0300
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <5767D307.9000002@xxxxxxxxxx>
Organization: Red Hat
References: <5767D307.9000002@xxxxxxxxxx>
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
Hi,

On 2016-06-20 14:27, Marko Myllynen wrote:
> 
> This addresses command line parsing issue where options had to be
> separated from switches with a space unlike with other tools.
> 
> Creates context more "manually" to allow controlling the time of
> the command parsing and allows to get rid of some wordarounds.
> Passes QA.

And once again, when changing something with Python PMAPI options
handling, there were side effects. Below is QA extension which should
work but I've not been able to fix the regression, even with the
__pmEndOptions / PM_OPTFLAG_DONE tricks employed by some other clients.

In general, of course, something so common that an application reads
its configuration from a file and then possibly overrides those values
with the ones the user provides on the command line shouldn't be this
hard. But I'm out of ideas so if noone can come up with a better
solution, I'm afraid we need to revert the previous patch.

---
 qa/1069     | 10 ++++++++++
 qa/1069.out | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/qa/1069 b/qa/1069
index 20b849f..ddbc1be 100755
--- a/qa/1069
+++ b/qa/1069
@@ -158,6 +158,16 @@ echo "---"
 pmrep -s 5 $log2 -p -c $tmp.pconfig mem.util.free
 echo "---"
 pmrep -s 5 $log2 -t 3s -p -H -c $tmp.pconfig mem.util.free
+echo "---"
+echo '[source]' > $tmp.pconfig
+echo "source = $here/archives/rep" >> $tmp.pconfig
+echo 'kernel.all.uptime = uptime,,,,8' >> $tmp.pconfig
+pmrep -s 5 -c $tmp.pconfig -z -p -u :source
+echo "---"
+echo '[source]' > $tmp.pconfig
+echo 'source = wrong.example.com' >> $tmp.pconfig
+echo 'kernel.all.uptime = uptime,,,,8' >> $tmp.pconfig
+pmrep -s 5 $log2 -c $tmp.pconfig -p -u :source
 
 # success, all done
 echo "== done"
diff --git a/qa/1069.out b/qa/1069.out
index 9573b50..31cb62d 100644
--- a/qa/1069.out
+++ b/qa/1069.out
@@ -198,4 +198,20 @@ Incompatible configuration file version (read v99, need 
v1).
 00:47:07     38220
 00:47:10     38220
 00:47:13     38220
+---
+            uptime
+               sec
+14:39:13    507689
+14:39:14    507690
+14:39:15    507691
+14:39:16    507692
+14:39:17    507693
+---
+              uptime
+                 sec
+00:48:01    24924286
+00:49:01    24924346
+00:50:01    24924406
+00:51:01    24924466
+00:52:01    24924526
 == done

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>