From: Steve Dickson <SteveD@redhat.com>
To: Scott Mayhew <smayhew@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [nfs-utils PATCH] mountstats: Fix exit code handling
Date: Wed, 04 Mar 2015 08:12:45 -0500 [thread overview]
Message-ID: <54F704CD.8090808@RedHat.com> (raw)
In-Reply-To: <1425326415-60997-1-git-send-email-smayhew@redhat.com>
On 03/02/2015 03:00 PM, Scott Mayhew wrote:
> When I changed mountstats to use the argparse module, I neglected to
> make the subcommand functions return any values even though main() was
> looking for them. Also removed SystemExit from the except clause at
> the end of the program since it was causing the program to always exit
> with a status of 1.
>
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed...
steved.
> ---
> tools/mountstats/mountstats.py | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
> index fd73feb..7f5dee1 100644
> --- a/tools/mountstats/mountstats.py
> +++ b/tools/mountstats/mountstats.py
> @@ -708,7 +708,7 @@ def mountstats_command(args):
> mountpoints += [device]
> if len(mountpoints) == 0:
> print('No NFS mount points were found')
> - return
> + return 1
>
> if args.since:
> old_mountstats = parse_stats_file(args.since)
> @@ -729,6 +729,7 @@ def mountstats_command(args):
> args.infile.close()
> if args.since:
> args.since.close()
> + return 0
>
> def nfsstat_command(args):
> """nfsstat-like command for NFS mount points
> @@ -766,7 +767,7 @@ def nfsstat_command(args):
> mountpoints += [device]
> if len(mountpoints) == 0:
> print('No NFS mount points were found')
> - return
> + return 1
>
> if args.since:
> old_mountstats = parse_stats_file(args.since)
> @@ -803,6 +804,7 @@ def nfsstat_command(args):
> args.infile.close()
> if args.since:
> args.since.close()
> + return 0
>
> def print_iostat_summary(old, new, devices, time):
> for device in devices:
> @@ -847,7 +849,7 @@ def iostat_command(args):
> devices += [device]
> if len(devices) == 0:
> print('No NFS mount points were found')
> - return
> + return 1
>
> sample_time = 0
>
> @@ -875,6 +877,7 @@ def iostat_command(args):
> args.infile.close()
> if args.since:
> args.since.close()
> + return 0
>
> class ICMAction(argparse.Action):
> """Custom action to deal with interval, count, and mountpoints.
> @@ -986,7 +989,7 @@ try:
> sys.stdout.close()
> sys.stderr.close()
> sys.exit(res)
> -except (SystemExit, KeyboardInterrupt, RuntimeError):
> +except (KeyboardInterrupt, RuntimeError):
> sys.exit(1)
> except IOError:
> pass
> -- 1.9.3
>
prev parent reply other threads:[~2015-03-04 13:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 20:00 [nfs-utils PATCH] mountstats: Fix exit code handling Scott Mayhew
2015-03-04 13:12 ` Steve Dickson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F704CD.8090808@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=smayhew@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).