From d2eec6066876eeb4a295b81a670c70b0ff8ad2a7 Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Sun, 11 Apr 2021 23:05:48 +0300 Subject: [PATCH] [__download] make --sum optional --- cdist/conf/type/__download/explorer/state | 6 ++++++ cdist/conf/type/__download/man.rst | 15 ++++++--------- cdist/conf/type/__download/parameter/optional | 1 + cdist/conf/type/__download/parameter/required | 1 - 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cdist/conf/type/__download/explorer/state b/cdist/conf/type/__download/explorer/state index 00362545..68b517c5 100755 --- a/cdist/conf/type/__download/explorer/state +++ b/cdist/conf/type/__download/explorer/state @@ -8,6 +8,12 @@ then exit 0 fi +if [ ! -f "$__object/parameter/sum" ] +then + echo 'present' + exit 0 +fi + sum_should="$( cat "$__object/parameter/sum" )" if [ -f "$__object/parameter/cmd-sum" ] diff --git a/cdist/conf/type/__download/man.rst b/cdist/conf/type/__download/man.rst index 54503470..a1278cfb 100644 --- a/cdist/conf/type/__download/man.rst +++ b/cdist/conf/type/__download/man.rst @@ -8,9 +8,6 @@ cdist-type__download - Download a file DESCRIPTION ----------- -Destination (``$__object_id``) in target host must be persistent storage -in order to calculate checksum and decide if file must be (re-)downloaded. - By default type will try to use ``wget``, ``curl`` or ``fetch``. If download happens in target (see ``--download``) then type will fallback to (and install) ``wget``. @@ -25,14 +22,14 @@ REQUIRED PARAMETERS url File's URL. -sum - Checksum of file going to be downloaded. - By default output of ``cksum`` without filename is expected. - Other hash formats supported with prefixes: ``md5:``, ``sha1:`` and ``sha256:``. - OPTIONAL PARAMETERS ------------------- +sum + Checksum is used to decide if existing destination file must be redownloaded. + By default output of ``cksum`` without filename is expected. + Other hash formats supported with prefixes: ``md5:``, ``sha1:`` and ``sha256:``. + download If ``local`` (default), then download file to local storage and copy it to target host. If ``remote``, then download happens in target. @@ -81,7 +78,7 @@ Ander Punnar COPYING ------- -Copyright \(C) 2020 Ander Punnar. You can redistribute it +Copyright \(C) 2021 Ander Punnar. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. diff --git a/cdist/conf/type/__download/parameter/optional b/cdist/conf/type/__download/parameter/optional index 838e2fbf..d69e083e 100644 --- a/cdist/conf/type/__download/parameter/optional +++ b/cdist/conf/type/__download/parameter/optional @@ -1,3 +1,4 @@ +sum cmd-get cmd-sum download diff --git a/cdist/conf/type/__download/parameter/required b/cdist/conf/type/__download/parameter/required index 6ea4c38f..96cdd3b9 100644 --- a/cdist/conf/type/__download/parameter/required +++ b/cdist/conf/type/__download/parameter/required @@ -1,2 +1 @@ url -sum