Merge lp:~gnuoy/charms/trusty/mysql/1567778 into lp:charms/trusty/mysql

Proposed by Liam Young on 2016-04-08
Status: Merged
Merged at revision: 157
Proposed branch: lp:~gnuoy/charms/trusty/mysql/1567778
Merge into: lp:charms/trusty/mysql
Diff against target: 65 lines (+19/-7)
2 files modified
hooks/config-changed (+13/-1)
hooks/install.real (+6/-6)
To merge this branch: bzr merge lp:~gnuoy/charms/trusty/mysql/1567778
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing on 2016-04-29
James Page 2016-04-08 Approve on 2016-04-08
Review via email: mp+291339@code.launchpad.net
To post a comment you must log in.

charm_lint_check #2198 mysql for gnuoy mp291339
    LINT OK: passed

Build: http://10.245.162.36:8080/job/charm_lint_check/2198/

charm_unit_test #1772 mysql for gnuoy mp291339
    UNIT OK: passed

Build: http://10.245.162.36:8080/job/charm_unit_test/1772/

charm_amulet_test #687 mysql for gnuoy mp291339
    AMULET OK: passed

Build: http://10.245.162.36:8080/job/charm_amulet_test/687/

James Page (james-page) :
review: Approve
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/3586/

review: Needs Fixing (automated testing)
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-lxc/3534/

review: Needs Fixing (automated testing)
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-lxc/3569/

review: Needs Fixing (automated testing)
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/3621/

review: Needs Fixing (automated testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/config-changed'
2--- hooks/config-changed 2015-12-30 02:25:24 +0000
3+++ hooks/config-changed 2016-04-08 08:08:11 +0000
4@@ -6,6 +6,7 @@
5 import re
6 import hashlib
7 import os
8+import shutil
9 import sys
10 import platform
11 import lib.utils as utils
12@@ -111,7 +112,14 @@
13 check_call(['add-apt-repository','-y','deb http://%s %s main' % (source, series)])
14 check_call(['apt-get','update'])
15
16-with open('/var/lib/mysql/mysql.passwd','r') as rpw:
17+ROOT_PASSFILE = os.path.join('/root', 'mysql.passwd')
18+VAR_PASSFILE = os.path.join('/var', 'lib', 'mysql', 'mysql.passwd')
19+if os.path.isfile(ROOT_PASSFILE):
20+ PASSFILE = ROOT_PASSFILE
21+else:
22+ PASSFILE = VAR_PASSFILE
23+
24+with open(PASSFILE,'r') as rpw:
25 root_pass = rpw.read()
26
27 dconf = Popen(['debconf-set-selections'], stdin=PIPE)
28@@ -124,6 +132,10 @@
29 check_call(['apt-get','-y','remove'] + remove_pkgs)
30 apt_install(package)
31
32+# mysql.passwd was stored in /root till after pkg install due to Bug #1567778
33+if os.path.isfile(ROOT_PASSFILE):
34+ shutil.move(ROOT_PASSFILE, VAR_PASSFILE)
35+
36 # smart-calc stuff in the configs
37 dataset_bytes = human_to_bytes(configs['dataset-size'])
38
39
40=== modified file 'hooks/install.real'
41--- hooks/install.real 2016-02-26 13:50:59 +0000
42+++ hooks/install.real 2016-04-08 08:08:11 +0000
43@@ -33,16 +33,16 @@
44
45 apt_install(['debconf-utils', 'python-mysqldb', 'uuid', 'pwgen', 'dnsutils'])
46
47-PASSFILE = os.path.join('/var', 'lib', 'mysql', 'mysql.passwd')
48-if not os.path.isfile(PASSFILE):
49- dirname = os.path.dirname(PASSFILE)
50+ROOT_PASSFILE = os.path.join('/root', 'mysql.passwd')
51+if not os.path.isfile(ROOT_PASSFILE):
52+ dirname = os.path.dirname(ROOT_PASSFILE)
53 if not os.path.isdir(dirname):
54 os.mkdir(dirname)
55- with open(PASSFILE, 'w'):
56+ with open(ROOT_PASSFILE, 'w'):
57 pass
58
59-os.chmod(PASSFILE, 0600)
60-with open(PASSFILE, 'a') as fd:
61+os.chmod(ROOT_PASSFILE, 0600)
62+with open(ROOT_PASSFILE, 'a') as fd:
63 fd.seek(0, os.SEEK_END)
64 if fd.tell() == 0:
65 fd.seek(0)

Subscribers

People subscribed via source and target branches

to all changes: