~lutostag/charms/trusty/ci-configurator/trunk

« back to all changes in this revision

Viewing changes to hooks/hooks.py

[hopem,r=wolsen]

Configure jenkins from jjb iff jjb is installed.

Closes-Bug: 1347060

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    relation_set,
20
20
    Hooks,
21
21
    UnregisteredHookError,
 
22
    INFO
22
23
)
23
24
 
24
25
hooks = Hooks()
61
62
            schedule, common.CI_USER, common.CI_CONFIG_DIR,
62
63
            jjb.JOBS_CONFIG_DIR)
63
64
 
 
65
    # NOTE: this needs to run before jjb update
 
66
    for rid in relation_ids('jenkins-configurator'):
 
67
        jenkins_configurator_relation_joined(rid)
 
68
 
64
69
    if have_repo:
65
70
        gerrit.update_gerrit()
66
 
        jjb.update_jenkins()
 
71
        if os.path.isdir(jjb.CONFIG_DIR):
 
72
            jjb.update_jenkins()
 
73
        else:
 
74
            log("jjb not installed so not updating",
 
75
                level=INFO)
67
76
        zuul.update_zuul()
68
77
    else:
69
78
        log('Not updating resources until we have a config-repo configured.')
70
79
 
71
 
    for rid in relation_ids('jenkins-configurator'):
72
 
        jenkins_configurator_relation_joined(rid)
73
 
 
74
80
 
75
81
@hooks.hook()
76
82
def upgrade_charm():