Merge lp:~moon127/charms/precise/storage/fstab-fix into lp:charms/storage

Proposed by Gareth Woolridge
Status: Merged
Merged at revision: 38
Proposed branch: lp:~moon127/charms/precise/storage/fstab-fix
Merge into: lp:charms/storage
Diff against target: 38 lines (+4/-4)
1 file modified
hooks/common_util.py (+4/-4)
To merge this branch: bzr merge lp:~moon127/charms/precise/storage/fstab-fix
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Adam Israel (community) Approve
Review via email: mp+232382@code.launchpad.net

Description of the change

Fix fstab when using default options, "default" is not valid option in fstab and causes the instance to fail to reboot successfully. Updated this to "defaults" which is valid.

Also add newline to fstab entry, fixes warning from mount -a.

To post a comment you must log in.
Revision history for this message
Adam Israel (aisrael) wrote :

Hi Gareth, thanks for submitting this charm for review! I've stepped through the initial review process and the charm looks good. +1 from me.

review: Approve
Revision history for this message
Charles Butler (lazypower) wrote :

+1 LGTM

Thank you for the submission Gareth!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/common_util.py'
2--- hooks/common_util.py 2014-03-21 22:53:22 +0000
3+++ hooks/common_util.py 2014-08-27 11:29:29 +0000
4@@ -236,7 +236,7 @@
5 relid, relation_settings={"mountpoint": mountpoint})
6 return
7
8- options = "default"
9+ options = "defaults"
10 provider = get_provider()
11 if provider == "nfs":
12 relids = hookenv.relation_ids("nfs")
13@@ -247,7 +247,7 @@
14 nfs_server = relation.get("private-address", None)
15 nfs_path = relation.get("mountpoint", None)
16 fstype = relation.get("fstype", None)
17- options = relation.get("options", "default")
18+ options = relation.get("options", "defaults")
19 break
20
21 if len(relids) == 0 or None in [nfs_server, nfs_path, fstype]:
22@@ -282,14 +282,14 @@
23 if not os.path.exists(mountpoint):
24 os.makedirs(mountpoint)
25
26- options_string = "" if options == "default" else " -o %s" % options
27+ options_string = "" if options == "defaults" else " -o %s" % options
28 command = "mount -t %s%s %s %s" % (
29 fstype, options_string, device_path, mountpoint)
30 subprocess.check_call(command, shell=True)
31 log("Mount (%s) successful" % mountpoint)
32 with open(FSTAB_FILE, "a") as output_file:
33 output_file.write(
34- "%s %s %s %s 0 0" % (device_path, mountpoint, fstype, options))
35+ "%s %s %s %s 0 0\n" % (device_path, mountpoint, fstype, options))
36 # publish changes to data relation and exit
37 for relid in hookenv.relation_ids("data"):
38 hookenv.relation_set(

Subscribers

People subscribed via source and target branches

to all changes: