~bac/charms/oneiric/buildbot-master/bbm

« back to all changes in this revision

Viewing changes to hooks/config-changed

  • Committer: Brad Crittenden
  • Date: 2012-02-08 21:02:32 UTC
  • mfrom: (15.3.6 bbm)
  • Revision ID: bac@canonical.com-20120208210232-2oxg27typ67sob7h
[r=gary] Standardized main and entry/exit logging.  Fixed relation-changed bug.  Use JUJU_REMOTE_UNIT for the slave name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    get_config,
19
19
    install_extra_repository,
20
20
    log,
 
21
    log_entry,
 
22
    log_exit,
21
23
    run,
22
24
    )
23
25
from local import (
65
67
 
66
68
    # Add a new repository if it was just added.
67
69
    added_or_changed = diff.added_or_changed
 
70
 
68
71
    if extra_repo and 'extra-repository' in added_or_changed:
69
72
        install_extra_repository(extra_repo)
70
73
        restart_required = True
124
127
 
125
128
def initialize_buildbot(config):
126
129
    # Initialize the buildbot directory and (re)start buildbot.
 
130
    log("Initializing buildbot")
127
131
    buildbot_dir =  config.get('installdir')
128
132
    master_cfg_path = os.path.join(buildbot_dir, 'master.cfg')
129
133
    shutil.move(master_cfg_path, master_cfg_path + '.original')
158
162
    if not os.path.exists(buildbot_dir):
159
163
        os.makedirs(buildbot_dir)
160
164
 
161
 
    restart_required = (
162
 
        handle_config_changes(config, diff) or
163
 
        configure_buildbot(config, diff))
 
165
    restart_required = handle_config_changes(config, diff)
 
166
    restart_required |= configure_buildbot(config, diff)
164
167
 
165
168
    master_cfg_path = os.path.join(buildbot_dir, 'master.cfg')
166
169
    if restart_required and os.path.exists(master_cfg_path):
172
175
 
173
176
 
174
177
if __name__ == '__main__':
175
 
    log('CONFIG-CHANGED HOOK:')
176
 
    main()
 
178
    log_entry()
 
179
    try:
 
180
        main()
 
181
    finally:
 
182
        log_exit()