From 8747474fd577eaa6d3ebdb117da02a21915ecf7b Mon Sep 17 00:00:00 2001 From: Daniel Heule Date: Tue, 2 Aug 2016 11:06:17 +0200 Subject: [PATCH] device now defaults to object_id --- cdist/conf/type/__filesystem/explorer/lsblk | 6 +++++- cdist/conf/type/__filesystem/gencode-remote | 7 ++++++- cdist/conf/type/__filesystem/man.rst | 11 ++++++----- cdist/conf/type/__filesystem/parameter/optional | 1 + cdist/conf/type/__filesystem/parameter/required | 1 - 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cdist/conf/type/__filesystem/explorer/lsblk b/cdist/conf/type/__filesystem/explorer/lsblk index a0a87a9d..9ae544ac 100644 --- a/cdist/conf/type/__filesystem/explorer/lsblk +++ b/cdist/conf/type/__filesystem/explorer/lsblk @@ -20,7 +20,11 @@ os=$("$__explorer/os") -blkdev="$(cat "$__object/parameter/device")" +if [ -f "$__object/parameter/device" ]; then + blkdev="$(cat "$__object/parameter/device")" +else + blkdev="$__object_id" +fi case "$os" in centos|fedora|redhat|suse|gentoo) diff --git a/cdist/conf/type/__filesystem/gencode-remote b/cdist/conf/type/__filesystem/gencode-remote index 66c25ef0..3ca1c498 100644 --- a/cdist/conf/type/__filesystem/gencode-remote +++ b/cdist/conf/type/__filesystem/gencode-remote @@ -20,7 +20,12 @@ fstype="$(cat "$__object/parameter/fstype")" -mydev="$(cat "$__object/parameter/device")" + +if [ -f "$__object/parameter/device" ]; then + mydev="$(cat "$__object/parameter/device")" +else + mydev="$__object_id" +fi label="$(cat "$__object/parameter/label")" mkfsoptions="$(cat "$__object/parameter/mkfsoptions")" diff --git a/cdist/conf/type/__filesystem/man.rst b/cdist/conf/type/__filesystem/man.rst index 25c2eeda..c69cc839 100644 --- a/cdist/conf/type/__filesystem/man.rst +++ b/cdist/conf/type/__filesystem/man.rst @@ -22,8 +22,12 @@ REQUIRED PARAMETERS fstype Filesystem type, for example 'ext3', 'btrfs' or 'xfs' + + +OPTIONAL PARAMETERS +------------------- device - Blockdevice for filesystem, + Blockdevice for filesystem, Defaults to object_id. On linux, it can be any by lsblk accepted device notation for example @@ -31,9 +35,6 @@ device or /dev/disk/by-xxxx/xxx or /dev/mapper/xxxx - -OPTIONAL PARAMETERS -------------------- label Label which sould apply on the filesystem @@ -61,7 +62,7 @@ EXAMPLES .. code-block:: sh # Ensures that device /dev/sdb is formated with xfs - __filesystem dev_sdb --fstype xfs --device /dev/sdb --label Testdisk1 + __filesystem /dev/sdb --fstype xfs --label Testdisk1 # The same thing with btrfs and disk spezified by pci path to disk 1:0 on vmware __filesystem dev_sdb --fstype btrfs --device /dev/disk/by-path/pci-0000:0b:00.0-scsi-0:0:0:0 --label Testdisk2 # Make sure that a multipath san device has a filesystem ... diff --git a/cdist/conf/type/__filesystem/parameter/optional b/cdist/conf/type/__filesystem/parameter/optional index 0f63435f..79dddc21 100644 --- a/cdist/conf/type/__filesystem/parameter/optional +++ b/cdist/conf/type/__filesystem/parameter/optional @@ -1,2 +1,3 @@ +device label mkfsoptions diff --git a/cdist/conf/type/__filesystem/parameter/required b/cdist/conf/type/__filesystem/parameter/required index 480e3669..98f8b69f 100644 --- a/cdist/conf/type/__filesystem/parameter/required +++ b/cdist/conf/type/__filesystem/parameter/required @@ -1,2 +1 @@ fstype -device