[ovs-dev] [PATCH ovn] ovsdb2ddlog2c: Fix behavior for internal error.

Dumitru Ceara dceara at redhat.com
Wed Mar 31 07:35:36 UTC 2021


On 3/30/21 11:50 PM, Ben Pfaff wrote:
> Without this change, ovsdb2ddlog2c exited successfully if it ran into an
> option that it was supposed to understand but didn't implement (which
> is a bug).  This commit makes it raise an exception instead.
> 
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> Reported-by: Dumitru Ceara <dceara at redhat.com>
> ---
>  northd/ovsdb2ddlog2c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/northd/ovsdb2ddlog2c b/northd/ovsdb2ddlog2c
> index 19aeb265b633..6d5ee9b4b45d 100755
> --- a/northd/ovsdb2ddlog2c
> +++ b/northd/ovsdb2ddlog2c
> @@ -82,7 +82,7 @@ if __name__ == "__main__":
>              elif key == '--output-file':
>                  output_file = value
>              else:
> -                sys.exit(0)
> +                assert False

I agree with the assert here because it's a bug when valid arguments
cannot be handled.  However, I wonder if it's worth changing it to
something like:

assert False, "%s: Cannot handle argument: %s" % (argv0, key)

In any case, the fix works:

Acked-by: Dumitru Ceara <dceara at redhat.com>

>  
>          if schema_file is None:
>              sys.stderr.write("%s: missing -f or --schema-file option\n" % argv0)
> 



More information about the dev mailing list