Commit 2edd7a88 by Stéphane Graber

python3: Fix PEP8 and avoid crash when listing

parent c5d32181
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # 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 import warnings
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # 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 import warnings
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # 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 import warnings
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
# #
# You should have received a copy of the GNU Lesser General Public # You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software # 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 import _lxc
...@@ -346,7 +347,6 @@ class Container(_lxc.Container): ...@@ -346,7 +347,6 @@ class Container(_lxc.Container):
return _lxc.Container.get_interfaces(self) return _lxc.Container.get_interfaces(self)
def get_ips(self, interface=None, family=None, scope=None, timeout=0): def get_ips(self, interface=None, family=None, scope=None, timeout=0):
""" """
Get a tuple of IPs for the container. Get a tuple of IPs for the container.
...@@ -430,6 +430,8 @@ def list_containers(active=True, defined=True, ...@@ -430,6 +430,8 @@ def list_containers(active=True, defined=True,
""" """
if config_path: if config_path:
if not os.path.exists(config_path):
return tuple()
entries = _lxc.list_containers(active=active, defined=defined, entries = _lxc.list_containers(active=active, defined=defined,
config_path=config_path) config_path=config_path)
else: else:
...@@ -456,6 +458,7 @@ def attach_run_command(cmd): ...@@ -456,6 +458,7 @@ def attach_run_command(cmd):
else: else:
return _lxc.attach_run_command((cmd, [cmd])) return _lxc.attach_run_command((cmd, [cmd]))
def attach_run_shell(): def attach_run_shell():
""" """
Run a shell when attaching Run a shell when attaching
...@@ -466,6 +469,7 @@ def attach_run_shell(): ...@@ -466,6 +469,7 @@ def attach_run_shell():
""" """
return _lxc.attach_run_shell(None) return _lxc.attach_run_shell(None)
def arch_to_personality(arch): def arch_to_personality(arch):
""" """
Determine the process personality corresponding to the architecture Determine the process personality corresponding to the architecture
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment