<div dir="ltr"><div>Hey Alexandr,</div><div><br></div>If you wanted to do it using python, and you didn't have swift installed you can use pickle and unpickle the builder. something like:<div><br></div><div>  import pickle</div><div>  builder = pickle.load(open('<path to builder>')</div><div><br></div><div>Then you'd have a python dict structure, where I think you can 'builder['devs']'</div><div><br></div><div>or with swift installed you can use the RingBuilder class:</div><div><br></div><div>  from swift.common.ring.builder import RingBuilder</div><div>  builder = RingBuilder.load('<path to object.builder>')</div><div>  builder.devs</div><div><br></div><div>Where builder.devs will be a list of dictionary objects. You could then json-ify and output for java to read or put it into an easier to pass list.</div><div><br></div><div>There could be a much simpler way, but I'm a Python dev, so this is what I'd do ;)</div><div><br></div><div>Regards,</div><div>Matt</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 28, 2017 at 6:21 AM, Alexandr Porunov <span dir="ltr"><<a href="mailto:alexandr.porunov@gmail.com" target="_blank">alexandr.porunov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello,<br></div><div><br></div><div>I need to get a list / array of devices in Java or Bash. Is it possible to get? Are there any API or something like that? </div><div><br></div><div>I know we can obtain a list with the next command:</div><div>swift-ring-builder object.builder</div><div><br></div><div>But it return a string with the list of devices which are quite hard to parse. In the documentation there is an example how to get a list of devices with python:</div><div>devices = list(self._iter_devs())</div><div><br></div><div>But it doesn't show which library to use to get a list of devices and how to use that library.</div><div><br></div><div>Sincerely,</div><div>Alexandr</div></div>
<br>______________________________<wbr>_________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a><br>
Post to     : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a><br>
<br></blockquote></div><br></div>