]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
python3: Fix PEP8 and avoid crash when listing
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 3 Dec 2013 21:39:46 +0000 (16:39 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 3 Dec 2013 21:47:52 +0000 (16:47 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
src/python-lxc/examples/api_test.py
src/python-lxc/examples/pyconsole-vte.py
src/python-lxc/examples/pyconsole.py
src/python-lxc/lxc/__init__.py

index 47543321d46389002b17c53529ee78bad581820f..a88fb13dfcced2feb4eb9d175f39941c2cd944a7 100755 (executable)
@@ -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
index 53867b751db8308476ba3866e467a6473a2edfdc..2d989e0f61ecd06f98a7413f6d2f9fb27530e9e0 100755 (executable)
@@ -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
index 49437139c4e0d4b352ad325b05d4e66ffeb070af..cd17afedd30620464b51758acd77af1b0c1408e6 100755 (executable)
@@ -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
index eddd198387cdd02652781238349bdc9f5b0f4ed3..ed1983d06f68e6a584cbcf99e5c4dc32b5eeec93 100644 (file)
@@ -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