~doanac/ubuntu-ci-services-itself/publisher-ppa-sync

« back to all changes in this revision

Viewing changes to ci-utils/ci_utils/unit_config.py

  • Committer: Chris Johnston
  • Author(s): Andy Doan
  • Date: 2014-03-15 03:22:48 UTC
  • mfrom: (385.1.3 img-keys)
  • Revision ID: chris_johnston-20140315032248-0rs9ncr7c0lykgxc
[r=Francis Ginther, PS Jenkins bot] image-builder: support private ppas

This fixes the hack for getting signing keys that only worked on
public ppas. It also allows us to add the proper line in our
apt-config for a private ppa  from Andy Doan

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Ubuntu CI Engine
 
2
# Copyright 2014 Canonical Ltd.
 
3
 
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU Affero General Public License version 3, as
 
6
# published by the Free Software Foundation.
 
7
 
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
# PURPOSE.  See the GNU Affero General Public License for more details.
 
12
 
 
13
# You should have received a copy of the GNU Affero General Public License
 
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 
 
16
import os
 
17
 
 
18
import yaml
 
19
 
 
20
 
 
21
_unit_config = None
 
22
 
 
23
 
 
24
def _load():
 
25
    path = os.path.join(os.path.dirname(__file__), '../../unit_config')
 
26
    with open(path) as f:
 
27
        global _unit_config
 
28
        _unit_config = yaml.safe_load(f)
 
29
 
 
30
 
 
31
def get(key):
 
32
    if not _unit_config:
 
33
        _load()
 
34
    return _unit_config[key]
 
35
 
 
36
 
 
37
def get_auth_config():
 
38
    if not _unit_config:
 
39
        _load()
 
40
    return _unit_config