Skip to content

can't jail start and stop for libioc version 0.5.0 #626

Open
@himrock922

Description

@himrock922

Hi All/
After upgrade from 0.4.1 to 0.5.0, status of jails not changed with running or stopping that happened 500 error.

The below response is result for iocage.datasets via iocage and jail.running via libiocage.

from django.shortcuts import render
from django.http import Http404
from django.http import HttpResponse
from collections import OrderedDict
import json
import libioc

def create(request):
    try:
        response = json.loads(request.body)
        release = libioc.Release(response['release'])
        jail = libioc.Jail(data=dict(name=response['jail_name']), new=True)
        jail.create(release)
    except(libioc.errors.JailAlreadyExists):
        return HttpResponse('%s is already exists' % response['jail_name'], status=409)
    return HttpResponse('OK')

def start(request):
    try:
        response = json.loads(request.body)
        jail = libioc.Jail(response['jail_name'])
        jail.start()
    except (libioc.errors.JailAlreadyRunning):
        return HttpResponse('%s is already running' % response['jail_name'], status=409)
    except (libioc.errors.JailNotFound):
        raise Http404('%s does not found' % response['jail_name'])
    return HttpResponse('OK')

def stop(request):
    try:
        response = json.loads(request.body)
        jail = libioc.Jail(response['jail_name'])
        jail.stop()
    except (libioc.errors.JailNotRunning):
        return HttpResponse('%s is not running' % response['jail_name'], status=409)
    except (libioc.errors.JailNotFound):
        raise Http404('%s does not found' % response['jail_name'])
    return HttpResponse('OK')

result(pdb debug)

lib/python3.7/site-packages/libioc/Jail.py(1559)_destroy_jail()
-> env=self.env
(Pdb) self.env
The config property 'CONFIG_VERSION' is unknown
(Pdb) *** libioc.errors.UnknownConfigProperty

The config property 'CONFIG_VERSION' is unknown

HTTP response code is 500.

Config/Jail/BaseConfig.py", line 775, in _require_known_config_property
    logger=self.logger
libioc.errors.UnknownConfigProperty
[30/Jan/2019 00:38:25] "PUT /jails/stop HTTP/1.1" 500 97779

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions