From: Stéphane Graber Date: Tue, 3 Dec 2013 21:39:46 +0000 (-0500) Subject: python3: Fix PEP8 and avoid crash when listing X-Git-Tag: lxc-1.0.0.beta1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2edd7a881d7d6b94c13d18c28ce6a6a15966ed31;p=thirdparty%2Flxc.git python3: Fix PEP8 and avoid crash when listing Signed-off-by: Stéphane Graber --- 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