[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Logging multiple builds



On 8 July 2014 21:52, Tomasz Rybak <tomasz.rybak@post.pl> wrote:
Hello.
Trying to test my packages on different machines, I wrote
script to create and run AMIs for amd64 and i386.
It works, but I have problem with logging - i.e. the second
run of the loop logs everything twice:

== code ==

from bootstrapvz.base.main import run
import bootstrapvz.base.log

options = {'MANIFEST': None,
'--debug': False,
'--dry-run': False,
'--help': False,
'--pause-on-error': False,
'--log': '/var/log/bootstrap-vz'}

if not os.path.exists(options['--log']):
        os.makedirs(options['--log'])

amis = {}

manifest = "unstable.{architecture}.json"

for architecture in ('amd64', 'i386'):
        manifest_filename = manifest.format(architecture=architecture)
        options['MANIFEST'] = manifest_filename
        log_filename =
bootstrapvz.base.log.get_log_filename(options['MANIFEST'])
        logfile = os.path.join(options['--log'], log_filename)
        bootstrapvz.base.log.setup_logger(logfile=logfile,
debug=options['--debug'])
        info = run(options)

== code ==

I analysed the bootstrap-vz code and it seems that there
is no ability to remove logger - only to add one.
Did I miss something?
If there is no possibility to remove logger, I can just
create one log file. This is not big problem - I do not intend
to store logs from building AMIs, only to have them in case
something goes wrong.
Changing bootstrap-vz to allow for removing logger is not very
high on my list of things to do - HVM is much more urgent.

Best regards.

--
Tomasz Rybak  GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A  488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak


Rewriting the main module to be more composable has been on my todo list for a while.
Especially because I would like to start writing some integration tests that test the entire bootstrapping process.
I'll take a look at it in the coming days.

Reply to: