@@ -52,7 +52,8 @@ Yaml syntax for partitions:
5252Mandatory properties:
5353
5454- name -- is used for referencing named partition for mount points
55- configuration (below) and label the filesystem located on this partition.
55+ configuration (below) and label the filesystem located on this partition. Must be
56+ unique.
5657
5758- fs -- filesystem type used for formatting.
5859
@@ -86,17 +87,18 @@ Yaml syntax for mount points:
8687
8788Mandatory properties:
8889
89- - partition -- partition name for mounting.
90+ - partition -- partition name for mounting. The partion must exist under `partitions`.
9091
9192- mountpoint -- path in the target root filesystem where the named partition
92- should be mounted.
93+ should be mounted. Must be unique, only one partition can be mounted per
94+ mountpoint.
9395
9496Optional properties:
9597
9698- options -- list of options to be added to appropriate entry in fstab file.
9799
98100- buildtime -- if set to true then the mountpoint only used during the debos run.
99- No entry in `/etc/fstab' will be created.
101+ No entry in `/etc/fstab` will be created.
100102The mountpoints directory will be removed from the image, so it is recommended
101103to define a `mountpoint` path which is temporary and unique for the image,
102104for example: `/mnt/temporary_mount`.
@@ -552,6 +554,14 @@ func (i *ImagePartitionAction) Verify(context *debos.DebosContext) error {
552554 if p .Name == "" {
553555 return fmt .Errorf ("Partition without a name" )
554556 }
557+
558+ // check for duplicate partition names
559+ for j := idx + 1 ; j < len (i .Partitions ); j ++ {
560+ if i .Partitions [j ].Name == p .Name {
561+ return fmt .Errorf ("Partition %s already exists" , p .Name )
562+ }
563+ }
564+
555565 if p .Start == "" {
556566 return fmt .Errorf ("Partition %s missing start" , p .Name )
557567 }
@@ -569,6 +579,14 @@ func (i *ImagePartitionAction) Verify(context *debos.DebosContext) error {
569579
570580 for idx , _ := range i .Mountpoints {
571581 m := & i .Mountpoints [idx ]
582+
583+ // check for duplicate mountpoints
584+ for j := idx + 1 ; j < len (i .Mountpoints ); j ++ {
585+ if i .Mountpoints [j ].Mountpoint == m .Mountpoint {
586+ return fmt .Errorf ("Mountpoint %s already exists" , m .Mountpoint )
587+ }
588+ }
589+
572590 for pidx , _ := range i .Partitions {
573591 p := & i .Partitions [pidx ]
574592 if m .Partition == p .Name {
@@ -577,7 +595,7 @@ func (i *ImagePartitionAction) Verify(context *debos.DebosContext) error {
577595 }
578596 }
579597 if m .part == nil {
580- return fmt .Errorf ("Couldn't fount partition for %s" , m .Mountpoint )
598+ return fmt .Errorf ("Couldn't find partition for %s" , m .Mountpoint )
581599 }
582600 }
583601
0 commit comments