Skip to content

extend list to retrieve be able to return all information #414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
igalic opened this issue Jun 11, 2018 · 1 comment
Closed

extend list to retrieve be able to return all information #414

igalic opened this issue Jun 11, 2018 · 1 comment

Comments

@igalic
Copy link
Collaborator

igalic commented Jun 11, 2018

currently, ioc list is our most powerful tool to extract information from all jails, templates and releases. Best of all it comes with an output format that everyone can deal with: JSON.

however, it requires one thing: prior knowledge. Unlike get, which can return all properties, in list we need to know exactly what we're asking for, which in turn means duplicating knowledge in multiple tools

get like many others (#233) lacks an JSON output format option (#232, #231)
but our problems are a bit deeper than that: the global namespace of properties is polluted (#413).


So here's some improvements we can make to libiocage, to make it easier to use from third-party tools — especially those written in not-Python:

@gronke
Copy link
Member

gronke commented Jul 17, 2018

I suggest to write a tiny helper using the library to achieve output for scripting usage:

import iocage
import json

jail = iocage.Jail("myjail")

data = {}
for key in jail.host.defaults.config.keys():
  data[key] = jail.config[key]

print(json.dumps(data))

@gronke gronke closed this as completed Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants