From 7e1ee2f6d7cf9aa0adb5eda0ab7f085a882bbbfb Mon Sep 17 00:00:00 2001 From: molese Date: Tue, 30 Nov 2021 11:57:26 +0600 Subject: [PATCH 1/3] src/default.scm: HOSTNAME environment variable workaround Signed-off-by: molese --- src/default.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/default.scm b/src/default.scm index aaf45d4..293e632 100644 --- a/src/default.scm +++ b/src/default.scm @@ -7,11 +7,14 @@ ;; FIXME(Krey): Process DOMAIN -;; FIXME(Krey): getenv returns #f if it's variable is unassigned.. i don't know how to check for false -;(if (false? (getenv "HOSTNAME")) -; (throw 1 "Environment variable 'HOSTNAME' is not set, unable to apply sufficient configuration")) +;; function to print error if environment variable 'HOSTNAME' is not set or if it's value is empty +(define system-hostname-check (lambda () + (if (not (system-hostname-set?)) + (throw 1 "Environment variable 'HOSTNAME' is not set, unable to apply sufficient configuration")) + (if (eq? (getenv "HOSTNAME") #f) + (throw 1 "Environment variable 'HOSTNAME' is set to empty, unable to apply sufficient configuration")))) -;(define system-hostname (getenv "HOSTNAME")) +(define system-hostname (getenv "HOSTNAME")) ;; TODO(Krey): Process https://guix.gnu.org/manual/en/html_node/Invoking-guix-deploy.html -- 2.48.1 From 718aa2322e1cf94cbb2c4c0fe60009f78dc24043 Mon Sep 17 00:00:00 2001 From: molese Date: Tue, 30 Nov 2021 12:01:47 +0600 Subject: [PATCH 2/3] src/default.scm: rephrase last statement's phrase of `system-hostname-check` Signed-off-by: molese --- src/default.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/default.scm b/src/default.scm index 293e632..3e8acb3 100644 --- a/src/default.scm +++ b/src/default.scm @@ -12,7 +12,7 @@ (if (not (system-hostname-set?)) (throw 1 "Environment variable 'HOSTNAME' is not set, unable to apply sufficient configuration")) (if (eq? (getenv "HOSTNAME") #f) - (throw 1 "Environment variable 'HOSTNAME' is set to empty, unable to apply sufficient configuration")))) + (throw 1 "Environment variable 'HOSTNAME' is empty, unable to apply sufficient configuration")))) (define system-hostname (getenv "HOSTNAME")) -- 2.48.1 From 57a5c0b2e0be9fcb97c87187e400f219b49b71e6 Mon Sep 17 00:00:00 2001 From: molese Date: Tue, 30 Nov 2021 12:21:36 +0600 Subject: [PATCH 3/3] src/default.scm: add necessary FIXME for system-hostname-check function Signed-off-by: molese --- src/default.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/default.scm b/src/default.scm index 3e8acb3..85b7449 100644 --- a/src/default.scm +++ b/src/default.scm @@ -8,6 +8,7 @@ ;; FIXME(Krey): Process DOMAIN ;; function to print error if environment variable 'HOSTNAME' is not set or if it's value is empty +;; FIXME-QA(Molese): Needs test (define system-hostname-check (lambda () (if (not (system-hostname-set?)) (throw 1 "Environment variable 'HOSTNAME' is not set, unable to apply sufficient configuration")) -- 2.48.1