[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qubes-devel
Subject:    Re: [qubes-devel] Need admin api advice
From:       Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= <marmarek () invisiblethingslab ! com>
Date:       2017-11-26 22:56:38
Message-ID: 20171126225638.GO1062 () mail-itl
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Sun, Nov 26, 2017 at 05:17:26PM -0500, Chris Laprise wrote:
> I'm trying to fix issue #3303 (inability to use --verify-only with
> qvm-backup-restore) but to do that I need to supply vm objects that are not
> actual vms. Otherwise, the tool can't cope with archives containing vm names
> not present in the live system.
> 
> I'm not sure what is the right approach for instantiating 'dummy' vm classes
> (or at least ones that will be useful to the restore tool).
> 
> Quick-fix me wants to do: dummyvm = qubesadmin.vm.QubesVM(None, "dummy1")
> 
> ...but I want it to be correct.

This will raise NotImplementedError on the first try to call any
AdminAPI method - like getting property. Better create DummyQubes class,
being subclass of QubesBase (see qubesadmin/app.py), and put empty
qubesd_call method there. Then use that instead of None for QubesVM
constructor. Something like this:

    class DummyQubes(qubesadmin.app.QubesBase):
        def qubesd_call(self, *args, **kwargs):
            pass

    dummy_app = DummyQubes()

    dummyvm = qubesadmin.vm.QubesVM(dummy_app, "dummy1")

- -- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJaFtXwAAoJENuP0xzK19cs8toH/j4uNMpUD1WppF4H87ICvc4c
w7GEhw/7IdsV4sqxsq442LuaXOFnusVfopFAfAL5YRT/nYRiGHuewmiy0eLD7M2t
AwVbIsDHDgroMjFpK5+qCc6EzRndzjdfi/z1nGK8hbMqlUc5SNLiG/V7Sj24FA52
vJKhFapv8q1aWbn0q1EU2FM0DxVbSNd8q8OZCbqfc/13g65j0nRkGh9gbJQrsOz9
qZx/inNsTm+vUKJ/Bfqhk66v5iEZv8v7jCvNUpRHSd2ZeuiA6NkxQehbSojplf8j
xJeO9WXp0FY6PGLY6wn4k+kJspuyqr3iGxM672RMgqvGqGAxImkQ2UWNLHGQLHg=
=dJ/I
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups \
"qubes-devel" group. To unsubscribe from this group and stop receiving emails from \
it, send an email to qubes-devel+unsubscribe@googlegroups.com. To post to this group, \
send email to qubes-devel@googlegroups.com. To view this discussion on the web visit \
https://groups.google.com/d/msgid/qubes-devel/20171126225638.GO1062%40mail-itl. For \
more options, visit https://groups.google.com/d/optout.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic