summaryrefslogtreecommitdiffstats
path: root/commands/storage
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-08-28 10:48:18 +0200
committerJan Safranek <jsafrane@redhat.com>2013-08-29 15:04:20 +0200
commitbf40eb624817e0bebf0e88025eb367338334469a (patch)
tree6792b833f4d14946d331bd44c8a1161e79db3da9 /commands/storage
parent93f45675e89a21b0112676ecd79c1e49cf7c4746 (diff)
downloadopenlmi-scripts-bf40eb624817e0bebf0e88025eb367338334469a.tar.gz
openlmi-scripts-bf40eb624817e0bebf0e88025eb367338334469a.tar.xz
openlmi-scripts-bf40eb624817e0bebf0e88025eb367338334469a.zip
storage: Adapt storage scripts to new formatters.
Diffstat (limited to 'commands/storage')
-rw-r--r--commands/storage/lmi/scripts/storage/device_cmd.py8
-rw-r--r--commands/storage/lmi/scripts/storage/partition_cmd.py7
2 files changed, 12 insertions, 3 deletions
diff --git a/commands/storage/lmi/scripts/storage/device_cmd.py b/commands/storage/lmi/scripts/storage/device_cmd.py
index b48b57a..a1103fd 100644
--- a/commands/storage/lmi/scripts/storage/device_cmd.py
+++ b/commands/storage/lmi/scripts/storage/device_cmd.py
@@ -79,6 +79,7 @@ from lmi.scripts.storage.common import (size2str, get_devices, get_children,
get_parents, str2device)
from lmi.scripts.storage.lvm import get_vgs
from lmi.shell.LMIUtil import lmi_isinstance
+from lmi.scripts.common import formatter
def get_device_info(ns, device):
"""
@@ -96,6 +97,7 @@ def get_pool_info(_ns, pool):
"""
return (pool.InstanceID,
pool.ElementName,
+ pool.ElementName,
size2str(pool.TotalManagedSpace),
"volume group (LVM)")
@@ -133,7 +135,6 @@ def cmd_show(ns, devices=None):
devices = get_devices(ns)
for dev in devices:
show.device_show(ns, dev)
- print ""
return 0
def prepare_tree_line(level, name, subsequent):
@@ -230,7 +231,8 @@ def cmd_depends(ns, devices=None, __deep=None):
"""
for device in devices:
# TODO: do a better output
- print "%s:" % (device,)
+ command = formatter.NewTableCommand(title=device)
+ yield command
for parent in get_parents(ns, device, __deep):
yield get_obj_info(ns, parent)
@@ -290,7 +292,7 @@ class Provides(command.LmiLister):
class Tree(command.LmiLister):
CALLABLE = 'lmi.scripts.storage.device_cmd:cmd_tree'
- COLUMNS = ('Level', "Name", "ElementName", "Size", "Format")
+ COLUMNS = ('DeviceID', "Name", "ElementName", "Size", "Format")
Device = command.register_subcommands(
'device', __doc__,
diff --git a/commands/storage/lmi/scripts/storage/partition_cmd.py b/commands/storage/lmi/scripts/storage/partition_cmd.py
index eebb3e4..8dab3be 100644
--- a/commands/storage/lmi/scripts/storage/partition_cmd.py
+++ b/commands/storage/lmi/scripts/storage/partition_cmd.py
@@ -147,6 +147,13 @@ class Lister(command.LmiLister):
class Create(command.LmiCheckResult):
CALLABLE = 'lmi.scripts.storage.partition_cmd:cmd_create'
EXPECT = 0
+ def transform_options(self, options):
+ """
+ There is only one <device> option, but docopt passes it as array
+ (because in other commands it is used with '...'). So let's
+ transform it to scalar.
+ """
+ options['<device>'] = options.pop('<device>')[0]
class Delete(command.LmiCheckResult):
CALLABLE = 'lmi.scripts.storage.partition_cmd:cmd_delete'