From 2edd7a881d7d6b94c13d18c28ce6a6a15966ed31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 3 Dec 2013 16:39:46 -0500 Subject: [PATCH] python3: Fix PEP8 and avoid crash when listing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- src/python-lxc/examples/api_test.py | 3 ++- src/python-lxc/examples/pyconsole-vte.py | 3 ++- src/python-lxc/examples/pyconsole.py | 3 ++- src/python-lxc/lxc/__init__.py | 8 ++++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/python-lxc/examples/api_test.py b/src/python-lxc/examples/api_test.py index 47543321d..a88fb13df 100755 --- a/src/python-lxc/examples/api_test.py +++ b/src/python-lxc/examples/api_test.py @@ -19,7 +19,8 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 +# USA # import warnings diff --git a/src/python-lxc/examples/pyconsole-vte.py b/src/python-lxc/examples/pyconsole-vte.py index 53867b751..2d989e0f6 100755 --- a/src/python-lxc/examples/pyconsole-vte.py +++ b/src/python-lxc/examples/pyconsole-vte.py @@ -20,7 +20,8 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 +# USA # import warnings diff --git a/src/python-lxc/examples/pyconsole.py b/src/python-lxc/examples/pyconsole.py index 49437139c..cd17afedd 100755 --- a/src/python-lxc/examples/pyconsole.py +++ b/src/python-lxc/examples/pyconsole.py @@ -20,7 +20,8 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 +# USA # import warnings diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py index eddd19838..ed1983d06 100644 --- a/src/python-lxc/lxc/__init__.py +++ b/src/python-lxc/lxc/__init__.py @@ -18,7 +18,8 @@ # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 +# USA # import _lxc @@ -346,7 +347,6 @@ class Container(_lxc.Container): return _lxc.Container.get_interfaces(self) - def get_ips(self, interface=None, family=None, scope=None, timeout=0): """ Get a tuple of IPs for the container. @@ -430,6 +430,8 @@ def list_containers(active=True, defined=True, """ if config_path: + if not os.path.exists(config_path): + return tuple() entries = _lxc.list_containers(active=active, defined=defined, config_path=config_path) else: @@ -456,6 +458,7 @@ def attach_run_command(cmd): else: return _lxc.attach_run_command((cmd, [cmd])) + def attach_run_shell(): """ Run a shell when attaching @@ -466,6 +469,7 @@ def attach_run_shell(): """ return _lxc.attach_run_shell(None) + def arch_to_personality(arch): """ Determine the process personality corresponding to the architecture