Ejemplo n.º 1
0
    def build(self):

        util = Utilities()

        buildconfig = util.get_dict(self.buildconfig)
        isotype = buildconfig['default']['type']

        if isotype != 'boot':
            ksstr = util.get_kickstart(buildconfig)
            #copy all KS files in the specified directory 
            #of the KS file to /tmp
            dirname, fname = os.path.split(os.path.abspath(buildconfig[isotype]['config']))
            for ksfile in glob.glob('{0:s}/*.ks'.format(os.path.abspath(dirname))):
                shutil.copyfile(ksfile,'/tmp/{0:s}'.format(os.path.split(ksfile)[1]))
        else:
            ksstr = None

        build = ImageBuilder(buildconfig, ksstr)
        logfile = build.getlogfile()

        print 'Initiating Build Process. See {0:s} for progress'.format(logfile)

        status = build.build()

        return status
Ejemplo n.º 2
0
def build(buildconfig, kickstart):

    logger = logging.getLogger('imagebuilder')
    logfile = getfilename()
    handler = myFileHandler(logfile,'w')
    formatter = logging.Formatter('%(asctime)s - %(message)s')
    handler.setFormatter(formatter)    

    # replace the handler
    logger.handlers[0] = handler

    builder = ImageBuilder(json.loads(buildconfig), kickstart)

    # build task
    status = builder.build()

    # JSON dump of the log file
    logfile = builder.getlogfile()
    with open(logfile,'r') as f:
        logfile_str = json.dumps(f.read())

    return [status, logfile_str]