[libvirt PATCH] tools: Fix style issues in virt-qemu-sev-validate

Andrea Bolognani posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20221208170623.283007-1-abologna@redhat.com
tools/virt-qemu-sev-validate | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[libvirt PATCH] tools: Fix style issues in virt-qemu-sev-validate
Posted by Andrea Bolognani 1 year, 4 months ago
The script had an incorrect interpreter line until commit
f6a19d7264bb, so the flake8 check would not realize it needed
to pick it up and these issues, some of which were present it
the very first version that was committed, were not being
reported.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 tools/virt-qemu-sev-validate | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/virt-qemu-sev-validate b/tools/virt-qemu-sev-validate
index 46a92aa7a0..3d8b292fef 100755
--- a/tools/virt-qemu-sev-validate
+++ b/tools/virt-qemu-sev-validate
@@ -849,7 +849,7 @@ class ConfidentialVM(abc.ABC):
         secret64 = b64encode(secret_table_ciphertext).decode('utf8')
         log.debug("Header: %s (%d bytes)", header64, len(header))
         log.debug("Secret: %s (%d bytes)",
-            secret64, len(secret_table_ciphertext))
+                  secret64, len(secret_table_ciphertext))
 
         return header64, secret64
 
@@ -955,7 +955,7 @@ class LibvirtConfidentialVM(ConfidentialVM):
             self.dom = self.conn.lookupByName(id_name_uuid)
 
         log.debug("VM: id=%d name=%s uuid=%s",
-            self.dom.ID(), self.dom.name(), self.dom.UUIDString())
+                  self.dom.ID(), self.dom.name(), self.dom.UUIDString())
 
         if not self.dom.isActive():
             raise InvalidStateException(
@@ -1331,5 +1331,6 @@ def main():
             print("ERROR: %s" % e, file=sys.stderr)
         sys.exit(6)
 
+
 if __name__ == "__main__":
     main()
-- 
2.38.1
Re: [libvirt PATCH] tools: Fix style issues in virt-qemu-sev-validate
Posted by Daniel P. Berrangé 1 year, 4 months ago
On Thu, Dec 08, 2022 at 06:06:23PM +0100, Andrea Bolognani wrote:
> The script had an incorrect interpreter line until commit
> f6a19d7264bb, so the flake8 check would not realize it needed
> to pick it up and these issues, some of which were present it
> the very first version that was committed, were not being
> reported.

Hmm, if flake8 is going to be restricted to /usr/bin/env python,
then we ought to have a syntax check to forbid /usr/bin/python*,
to prevent missing the flake8 check.

> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  tools/virt-qemu-sev-validate | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [libvirt PATCH] tools: Fix style issues in virt-qemu-sev-validate
Posted by Andrea Bolognani 1 year, 4 months ago
On Thu, Dec 08, 2022 at 05:09:39PM +0000, Daniel P. Berrangé wrote:
> On Thu, Dec 08, 2022 at 06:06:23PM +0100, Andrea Bolognani wrote:
> > The script had an incorrect interpreter line until commit
> > f6a19d7264bb, so the flake8 check would not realize it needed
> > to pick it up and these issues, some of which were present it
> > the very first version that was committed, were not being
> > reported.
>
> Hmm, if flake8 is going to be restricted to /usr/bin/env python,
> then we ought to have a syntax check to forbid /usr/bin/python*,
> to prevent missing the flake8 check.

That would certainly be good to have.

Regardless of the flake8 check, you simply don't want to hardcode a
path to the Python interpreter there, as it will prevent the script
from working on FreeBSD and macOS at the very least.

-- 
Andrea Bolognani / Red Hat / Virtualization
Re: [libvirt PATCH] tools: Fix style issues in virt-qemu-sev-validate
Posted by Ján Tomko 1 year, 4 months ago
On a Thursday in 2022, Andrea Bolognani wrote:
>The script had an incorrect interpreter line until commit
>f6a19d7264bb, so the flake8 check would not realize it needed
>to pick it up and these issues, some of which were present it
>the very first version that was committed, were not being
>reported.
>
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> tools/virt-qemu-sev-validate | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/tools/virt-qemu-sev-validate b/tools/virt-qemu-sev-validate

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano