Add option to just get bmc or host info in list option
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/openbmc-sfw b/openbmc-sfw
index 4d13271..ef07c2f 100755
--- a/openbmc-sfw
+++ b/openbmc-sfw
@@ -138,9 +138,15 @@
def do_list_sfw(args):
s = BMC(server=args.server)
for e in s.list_sfw():
+ if (e == '/xyz/openbmc_project/software/active'):
+ continue
info = s.get_image(e)
- print(e)
- print json.dumps(info, indent=4)
+ if (((info['Purpose'] == 'xyz.openbmc_project.Software.Version.VersionPurpose.BMC') and
+ (args.bmc or not args.host)) or \
+ ((info['Purpose'] == 'xyz.openbmc_project.Software.Version.VersionPurpose.Host') and
+ (args.host or not args.bmc))):
+ print(e)
+ print json.dumps(info, indent=4)
def do_view_image(args):
s = BMC(server=args.server)
@@ -165,6 +171,16 @@
subparsers = parser.add_subparsers()
list_events = subparsers.add_parser('list', help='List all software images on BMC')
list_events.set_defaults(func=do_list_sfw)
+list_events.add_argument(
+ '--bmc',
+ action='store_true',
+ default=False,
+ help='Set if you want to see BMC images')
+list_events.add_argument(
+ '--host',
+ action='store_true',
+ default=False,
+ help='Set if you want to see Host images')
image_view = subparsers.add_parser('view', help='View info of input image')
image_view.add_argument('image', help='The image to analyze')