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
=== modified file 'hooks/common_util.py'
--- hooks/common_util.py 2014-03-21 22:53:22 +0000
+++ hooks/common_util.py 2014-08-27 11:29:29 +0000
@@ -236,7 +236,7 @@
236 relid, relation_settings={"mountpoint": mountpoint})236 relid, relation_settings={"mountpoint": mountpoint})
237 return237 return
238238
239 options = "default"239 options = "defaults"
240 provider = get_provider()240 provider = get_provider()
241 if provider == "nfs":241 if provider == "nfs":
242 relids = hookenv.relation_ids("nfs")242 relids = hookenv.relation_ids("nfs")
@@ -247,7 +247,7 @@
247 nfs_server = relation.get("private-address", None)247 nfs_server = relation.get("private-address", None)
248 nfs_path = relation.get("mountpoint", None)248 nfs_path = relation.get("mountpoint", None)
249 fstype = relation.get("fstype", None)249 fstype = relation.get("fstype", None)
250 options = relation.get("options", "default")250 options = relation.get("options", "defaults")
251 break251 break
252252
253 if len(relids) == 0 or None in [nfs_server, nfs_path, fstype]:253 if len(relids) == 0 or None in [nfs_server, nfs_path, fstype]:
@@ -282,14 +282,14 @@
282 if not os.path.exists(mountpoint):282 if not os.path.exists(mountpoint):
283 os.makedirs(mountpoint)283 os.makedirs(mountpoint)
284284
285 options_string = "" if options == "default" else " -o %s" % options285 options_string = "" if options == "defaults" else " -o %s" % options
286 command = "mount -t %s%s %s %s" % (286 command = "mount -t %s%s %s %s" % (
287 fstype, options_string, device_path, mountpoint)287 fstype, options_string, device_path, mountpoint)
288 subprocess.check_call(command, shell=True)288 subprocess.check_call(command, shell=True)
289 log("Mount (%s) successful" % mountpoint)289 log("Mount (%s) successful" % mountpoint)
290 with open(FSTAB_FILE, "a") as output_file:290 with open(FSTAB_FILE, "a") as output_file:
291 output_file.write(291 output_file.write(
292 "%s %s %s %s 0 0" % (device_path, mountpoint, fstype, options))292 "%s %s %s %s 0 0\n" % (device_path, mountpoint, fstype, options))
293 # publish changes to data relation and exit293 # publish changes to data relation and exit
294 for relid in hookenv.relation_ids("data"):294 for relid in hookenv.relation_ids("data"):
295 hookenv.relation_set(295 hookenv.relation_set(

Subscribers

People subscribed via source and target branches

to all changes: