Merge lp:~psivaa/uci-engine/lander-jenkins-gpg-key-import into lp:uci-engine/mthood

Proposed by Para Siva
Status: Merged
Merged at revision: 415
Proposed branch: lp:~psivaa/uci-engine/lander-jenkins-gpg-key-import
Merge into: lp:uci-engine/mthood
Diff against target: 92 lines (+28/-11)
3 files modified
charms/precise/lander-jenkins/config.yaml (+5/-1)
charms/precise/lander-jenkins/hooks/hooks.py (+21/-9)
juju-deployer/lander.yaml.tmpl (+2/-1)
To merge this branch: bzr merge lp:~psivaa/uci-engine/lander-jenkins-gpg-key-import
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Review via email: mp+220247@code.launchpad.net

Commit message

GPG import into lander jenkins installation. This also includes 'proper' fixes of parameterized plugin installation. (The plugin is confirmed to be installed now )

Description of the change

GPG import into lander jenkins installation. This also includes 'proper' fixes of parameterized plugin installation. (The plugin is confirmed to be installed now ) Apologies for missing it earlier.

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

looks awfully familiar :)

review: Approve
Revision history for this message
Para Siva (psivaa) wrote :

Thanks. yes. still i missed it in the first MP :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charms/precise/lander-jenkins/config.yaml'
2--- charms/precise/lander-jenkins/config.yaml 2014-05-16 18:32:52 +0000
3+++ charms/precise/lander-jenkins/config.yaml 2014-05-20 12:42:25 +0000
4@@ -64,10 +64,14 @@
5 type: string
6 default: "https://updates.jenkins-ci.org/"
7 description: Site to download plugin .hpi files from.
8- proxy_url:
9+ proxy-url:
10 type: string
11 default: ""
12 description: The http proxy url for private clouds.
13+ ppa-gpg-key:
14+ type: string
15+ default: ""
16+ description: GPG key fingerprint for the PPA
17 main:
18 type: string
19 default: ""
20
21=== modified file 'charms/precise/lander-jenkins/hooks/hooks.py'
22--- charms/precise/lander-jenkins/hooks/hooks.py 2014-05-16 19:14:04 +0000
23+++ charms/precise/lander-jenkins/hooks/hooks.py 2014-05-20 12:42:25 +0000
24@@ -161,13 +161,13 @@
25 juju_info('Installing {} from {}'.format(plugin_file, url))
26 plugin_file = os.path.join(JENKINS_HOME, 'plugins', plugin_file)
27
28- if config['proxy_url']:
29- cmd = ['https_proxy=%s' % config['proxy_url'], 'wget',
30- '-O', plugin_file, url]
31- juju_info('Proxy {} is used'.format(config['proxy_url']))
32+ if config['proxy-url']:
33+ juju_info('Proxy {} is used'.format(config['proxy-url']))
34+ cmd = ('https_proxy=%s http_proxy=%s wget -O %s %s' %
35+ (config['proxy-url'], config['proxy-url'], plugin_file, url))
36 else:
37- cmd = ['wget', '-O', plugin_file, url]
38-
39+ cmd = ('wget -O %s %s' % (plugin_file, url))
40+ juju_info('Command {} is used'.format(cmd))
41 subprocess.check_call(cmd, shell=True)
42 cmd = ['chown', '-R', '{}.{}'.format(JENKINS_USER, JENKINS_GROUP),
43 plugin_file]
44@@ -269,11 +269,23 @@
45 subprocess.check_call(['/sbin/start', _service_name(config)])
46
47
48+def import_ppa_keys(config):
49+ cmd = ['apt-key', 'adv', '--keyserver', 'keyserver.ubuntu.com',
50+ '--recv-keys', config['ppa-gpg-key']]
51+ try:
52+ subprocess.check_call(cmd)
53+ except:
54+ juju_log(MSG_ERROR, "Error importing repo key")
55+
56+
57 def config_changed(config):
58 juju_info("Config: %s" % config)
59- if config['proxy_url']:
60- juju_info('Setting up apt with {}'.format(config['proxy_url']))
61+ if config['proxy-url']:
62+ juju_info('Setting up apt with {}'.format(config['proxy-url']))
63 setup_apt_proxy(config)
64+ if config['ppa-gpg-key']:
65+ juju_info('Importing key for {}'.format(config['ppa-gpg-key']))
66+ import_ppa_keys(config)
67 add_dependencies(config)
68 create_jobs(config)
69 create_user(config)
70@@ -352,7 +364,7 @@
71
72
73 def setup_apt_proxy(config):
74- proxy_url = config['proxy_url']
75+ proxy_url = config['proxy-url']
76 apt_conf = textwrap.dedent("""\
77 Acquire::http::proxy "%s";
78 Acquire::https::proxy "%s";
79
80=== modified file 'juju-deployer/lander.yaml.tmpl'
81--- juju-deployer/lander.yaml.tmpl 2014-05-16 18:32:52 +0000
82+++ juju-deployer/lander.yaml.tmpl 2014-05-20 12:42:25 +0000
83@@ -35,7 +35,8 @@
84 vcs: ${CI_CODE_SOURCE}
85 branch: ${CI_BRANCH}
86 tarball: ${CI_PAYLOAD_URL}
87- proxy_url: ${CI_PRIVATE_HTTP_PROXY}
88+ proxy-url: ${CI_PRIVATE_HTTP_PROXY}
89+ ppa-gpg-key: ${CI_PPA_GPG_KEY}
90 bot_username: lander-bot
91 bot_password: lander-bot
92 sources: ${CI_PPA}

Subscribers

People subscribed via source and target branches