25 lines
644 B
Python
25 lines
644 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
from .lxcbuilder import LXCBuilder
|
|
from .lxcpacker import LXCPacker
|
|
|
|
class LXCImage:
|
|
def __init__(self, build_path):
|
|
self.name = None
|
|
self.conf = {}
|
|
|
|
if os.path.isfile(build_path):
|
|
self.lxcfile = os.path.realpath(build_path)
|
|
self.build_dir = os.path.dirname(self.lxcfile)
|
|
else:
|
|
self.build_dir = os.path.realpath(build_path)
|
|
self.lxcfile = os.path.join(self.build_dir, 'lxcfile')
|
|
|
|
def build_and_pack(self):
|
|
builder = LXCBuilder(self)
|
|
builder.build()
|
|
packer = LXCPacker(self)
|
|
packer.pack()
|