From nobody Thu Apr 25 18:03:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617286437; cv=none; d=zohomail.com; s=zohoarc; b=ahGGsye4VqRPwQieLZUP2xajyc6rN68Vecetyw+EG20nnnudjWWK2oF6UTcf9tvqU6l68AyPPYteHSDqr3xQMK0xxy3vmjXuYVfgkJph/MYLYODyEKUIjn/zX5g5WifUP/jwgT5nHt7Zyzi+N0txqDQ1UfufGqDYK4qvz2QOBNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617286437; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=LLNOW9KsytvfdSrm/lAYB2aytVul3QEXTFAhtNkLbVI=; b=hWqnn4P3LYn26Rb6p1XnvtyOpmbakksO8WHHIy9SqqfAbuzBEYmMJC7rJw+WmP2blZG9GN99ZK9DhNNWRoc3mmrjEK3pOjGXz8q5pvVXXCe5zjktXpu7DHEFbB9OmtdowFQyTC+bQ+JVHC6rxTqJnIEHR89pNa5qJXIhsD8Gphg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1617286437401297.69470276164736; Thu, 1 Apr 2021 07:13:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-96ZspvlhM42k91EY8idPVA-1; Thu, 01 Apr 2021 10:13:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CAF318566A5; Thu, 1 Apr 2021 14:13:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71B4859454; Thu, 1 Apr 2021 14:13:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2B8261809C83; Thu, 1 Apr 2021 14:13:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 131ED3Hq026415 for ; Thu, 1 Apr 2021 10:13:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 91BA559454; Thu, 1 Apr 2021 14:13:03 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-106.ams2.redhat.com [10.36.114.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA5F05945C; Thu, 1 Apr 2021 14:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617286434; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LLNOW9KsytvfdSrm/lAYB2aytVul3QEXTFAhtNkLbVI=; b=amHwP7KzAXK9lpuiHvUcRKOfXZTgAThySlwFowuMZIGaSNtd89gm9wKcXKCKvjDOMRTXA0 OoPPao7r4bRYsF4u3wQ2j6KuxrqzOgWwy7hZ4DAt38A47/XB6R0lms9deCcqkLJvHSL/e3 ttEqwAVm/eB1oa0neyZarCPkj/aLqB4= X-MC-Unique: 96ZspvlhM42k91EY8idPVA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvir PATCH] run: fix flake8 violations Date: Thu, 1 Apr 2021 15:12:58 +0100 Message-Id: <20210401141258.74075-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Two blank lines are needed either side of functions. Comments must have a single space character immediately after the "#". The unused exception variable can be removed. Signed-off-by: Daniel P. Berrang=C3=A9 --- I dropped the ball by not running syntax check on the 'run' script changes. Pushed this fixup for the style problems. run.in | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/run.in b/run.in index b710ba87fb..b778505a33 100644 --- a/run.in +++ b/run.in @@ -16,7 +16,7 @@ # License along with this library; If not, see # . =20 -#---------------------------------------------------------------------- +# ---------------------------------------------------------------------- # # With this script you can run libvirt programs without needing to # install them first. You just have to do for example: @@ -38,7 +38,7 @@ # # sudo ./run virsh list --all # -#---------------------------------------------------------------------- +# ---------------------------------------------------------------------- =20 import os import os.path @@ -46,6 +46,7 @@ import random import sys import subprocess =20 + # Function to intelligently prepend a path to an environment variable. # See https://stackoverflow.com/a/9631350 def prepend(env, varname, extradir): @@ -54,6 +55,7 @@ def prepend(env, varname, extradir): else: env[varname] =3D extradir =20 + here =3D "@abs_builddir@" =20 if len(sys.argv) < 2: @@ -93,29 +95,36 @@ modular_daemons =3D [ "virtxend", ] =20 + def is_modular_daemon(name): return name in modular_daemons =20 + def is_monolithic_daemon(name): return name =3D=3D "libvirtd" =20 + def is_systemd_host(): if os.getuid() !=3D 0: return False return os.path.exists("/run/systemd/system") =20 + def daemon_units(name): return [name + suffix for suffix in [ ".service", ".socket", "-ro.socket", "-admin.socket"]] =20 + def is_unit_active(name): ret =3D subprocess.call(["systemctl", "is-active", "-q", name]) return ret =3D=3D 0 =20 + def change_unit(name, action): ret =3D subprocess.call(["systemctl", action, "-q", name]) return ret =3D=3D 0 =20 + try_stop_units =3D [] if is_systemd_host(): name =3D os.path.basename(prog) @@ -152,7 +161,7 @@ else: =20 print("Running %s..." % prog) ret =3D subprocess.call([prog] + args, env=3Denv) - except KeyboardInterrupt as ex: + except KeyboardInterrupt: pass finally: print("Re-starting original systemd units...") --=20 2.30.2