Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Use the first item for dicts sent to get recursive
Browse files Browse the repository at this point in the history
FreeNAS Ticket: #59823
  • Loading branch information
Brandon Schneider committed Nov 26, 2018
1 parent 93ed523 commit 42400ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iocage_lib/ioc_common.py
Expand Up @@ -334,7 +334,7 @@ def sort_name(name):
def sort_key(item):
"""Sort list by the first key."""

return (list(item.keys())[0],)
return (list(item[0].keys())[0],)


def sort_template(template):
Expand Down

1 comment on commit 42400ac

@jsegaert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing a regression error when running e.g. iocage get -r release

➜  iocage git:(master) iocage get -r release
Traceback (most recent call last):
  File "/usr/local/bin/iocage", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/iocage_cli/get.py", line 122, in cli
    jails = ioc.IOCage().get(prop, recursive=True)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/iocage.py", line 1222, in get
    jail_list.sort(key=sort)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_common.py", line 337, in sort_key
    return (list(item[0].keys())[0],)
KeyError: 0

Please sign in to comment.