Re: [PATCH v3 5/7] networkxml2conftest: Use dnsmasqCapsNewFromBinary() to construct caps

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

 



On Mon, Jan 17, 2022 at 01:11:29PM +0100, Michal Prívozník wrote:
> On 1/14/22 17:49, Andrea Bolognani wrote:
> > This all works, but I wonder if we couldn't just create a trivial
> > shell script that behaves minimally the way we expect dnsmasq to, and
> > change our virFindFileInPath() mock so that it returns the absolute
> > path to it? That way we wouldn't need to implement any additional
> > mocking and the code would end up being much simpler. Diff below.
>
> I thought that we should avoid shell for new contributions:
>
> https://libvirt.org/programming-languages.html

Fair enough. Python version below.


#!/usr/bin/env python3

import sys

output = {
    "--version": "Dnsmasq version 2.67",
    "--help": "--bind-dynamic\n--ra-param",
}

if len(sys.argv) != 2 or sys.argv[1] not in output:
    print("invalid usage")
    sys.exit(1)

print(output[sys.argv[1]])

-- 
Andrea Bolognani / Red Hat / Virtualization





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux