Closed himrock922 closed 5 years ago
Jail State lookup is an expensive operation (using subprocess.Popen
to call jls
). When you suspect not to be the sole jail manager, consider updating the global jails state or an individual jails state as such:
import ioc
jail = ioc.Jail("myjail")
print(jail.running)
# .. something happened in between
jail.state.query()
print(jail.running)
import ioc
jails = ioc.Jails()
print(jails[0].running)
# .. something happened in between
jails.states.query()
print(jails[0].running)
Please note that during your Issue the package module namespace changed from iocage
to ioc
.
Hi All, I developing of jail hosting system via Django. if stop and start method execute via libiocage, a jail status not changed of running or stopping.
The below response is result for iocage.datasets via iocage and jail.running via libiocage.
+-----+--------+-------+--------------+--------------+ | JID | NAME | STATE | RELEASE | IP4 | +=====+========+=======+==============+==============+ | 12 | myjail | up | 11.2-RELEASE | 192.168.1.10 |
↑ iocage response
System check identified no issues (0 silenced). December 31, 2018 - 00:17:54 Django version 2.1.4, using settings 'jail_hosting_system.settings' Starting development server at http://****:8080/ Quit the server with CONTROL-C.
True <- libiocage response +-----+--------+-------+--------------+--------------+ | JID | NAME | STATE | RELEASE | IP4 | +=====+========+=======+==============+==============+ | 12 | myjail | up | 11.2-RELEASE | 192.168.1.10 | +-----+--------+-------+--------------+--------------+ [31/Dec/2018 00:18:20] "GET /jails/ HTTP/1.1" 200 1742
↑ iocage response
[31/Dec/2018 00:18:58] "PUT /jails/stop HTTP/1.1" 200 2 True <- libiocage response
+-----+--------+-------+--------------+--------------+ | JID | NAME | STATE | RELEASE | IP4 | +=====+========+=======+==============+==============+ | - | myjail | down | 11.2-RELEASE | 192.168.1.10 | +-----+--------+-------+--------------+--------------+
↑ iocage response [31/Dec/2018 00:19:04] "GET /jails/ HTTP/1.1" 200 1742
less requirements.txt ioc==0.3.2 iocage==0.3.2 iocage-cli==1.0a1 iocage-lib==1.0a1