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

« back to all changes in this revision

Viewing changes to hooks/common.py

  • Committer: Adam Gandelman
  • Date: 2013-11-25 23:14:11 UTC
  • Revision ID: adamg@canonical.com-20131125231411-uni0q7vv4ip9v2oi
Backout rev 68, re-add control.yml functionality.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# ends up.  This is either a bzr repo of the remote source
17
17
# or a copy of the repo shipped with charm, depending on config.
18
18
CI_CONFIG_DIR = os.path.join(CONFIG_DIR, 'ci-config')
 
19
CI_CONTROL_FILE = os.path.join(CI_CONFIG_DIR, 'control.yml')
19
20
 
20
21
 
21
22
def update_configs_from_charm(bundled_configs):
63
64
        [run_as_user(cmd=c, user=CI_USER, cwd=CI_CONFIG_DIR) for c in cmds]
64
65
 
65
66
 
 
67
def load_control():
 
68
    if not os.path.exists(CI_CONTROL_FILE):
 
69
        log('No control.yml found in repo at @ %s.' % CI_CONTROL_FILE)
 
70
        return None
 
71
 
 
72
    with open(CI_CONTROL_FILE) as control:
 
73
        return yaml.load(control)
 
74
 
 
75
 
66
76
def sync_dir(src, dst):
67
77
    """Copies all files and directories to a destination directory.  If
68
78
    copy destination already exists, it will be removed and re-copied.