~ps-jenkins/ubuntu-system-image/ubuntu-utopic-proposed

« back to all changes in this revision

Viewing changes to systemimage/service.py

  • Committer: Barry Warsaw
  • Date: 2013-08-26 19:45:31 UTC
  • mto: This revision was merged to the branch mainline in revision 142.
  • Revision ID: barry@python.org-20130826194531-qgqnzlq48jsmsxbf
 * Add support for an optional /etc/system-image/channel.ini file, and shuffle
   some of the other /etc/system-image/client.ini file options.  (LP: #1214009)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    ]
21
21
 
22
22
 
 
23
import os
23
24
import sys
24
25
import dbus
25
26
import logging
78
79
    except FileNotFoundError as error:
79
80
        parser.error('\nConfiguration file not found: {}'.format(error))
80
81
        assert 'parser.error() does not return'
 
82
    # Load the optional channel.ini file, which must live next to the
 
83
    # configuration file.  It's okay if this file does not exist.
 
84
    channel_ini = os.path.join(os.path.dirname(args.config), 'channel.ini')
 
85
    try:
 
86
        config.load(channel_ini, override=True)
 
87
    except FileNotFoundError:
 
88
        pass
81
89
 
82
90
    # Create the temporary directory if it doesn't exist.
83
91
    makedirs(config.system.tempdir)
86
94
    log = logging.getLogger('systemimage')
87
95
 
88
96
    log.info('SystemImage dbus main loop started [{}/{}]',
89
 
             config.system.channel, config.device)
 
97
             config.service.channel, config.device)
90
98
    DBusGMainLoop(set_as_default=True)
91
99
 
92
100
    system_bus = dbus.SystemBus()