diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-02 15:31:59 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-02 15:31:59 -0500 |
commit | fa608c69df18409aa7f1fc9953072e5a030a5c8f (patch) | |
tree | 4df58a955a7efff373f841c4304eb9783b3960fe | |
parent | ee18c157d4b9a859d86534e73e0bdb1ff548234d (diff) | |
download | horizon-fa608c69df18409aa7f1fc9953072e5a030a5c8f.tar.gz horizon-fa608c69df18409aa7f1fc9953072e5a030a5c8f.tar.bz2 horizon-fa608c69df18409aa7f1fc9953072e5a030a5c8f.tar.xz horizon-fa608c69df18409aa7f1fc9953072e5a030a5c8f.zip |
hscript: disk: More logging output
-rw-r--r-- | hscript/disk.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/hscript/disk.cc b/hscript/disk.cc index 44c2957..15e5863 100644 --- a/hscript/disk.cc +++ b/hscript/disk.cc @@ -94,6 +94,11 @@ bool DiskId::validate(ScriptOptions options) const { bool DiskId::execute(ScriptOptions options) const { bool match = false; + + output_info("installfile:" + std::to_string(line), + "diskid: Checking " + _block + " for identification string " + + _ident); + if(!options.test(InstallEnvironment)) return true; #ifdef HAS_INSTALL_ENV @@ -131,6 +136,16 @@ bool DiskId::execute(ScriptOptions options) const { if(serial) { std::string full_str(serial); match = (full_str.find(_ident) != std::string::npos); + } else { + output_error("installfile:" + std::to_string(line), + "diskid: failed to retrieve disk identification", + "cannot read disk information"); + } + + if(!match) { + output_error("installfile:" + std::to_string(line), + "diskid: device does not match expected identification " + "string"); } udev_device_unref(device); @@ -203,6 +218,10 @@ bool DiskLabel::execute(ScriptOptions options) const { break; } + output_info("installfile:" + std::to_string(this->lineno()), + "disklabel: creating new " + type_str + " disklabel on " + + device()); + if(options.test(Simulate)) { std::cout << "parted -ms " << this->device() << " mklabel " << type_str << std::endl; @@ -212,6 +231,7 @@ bool DiskLabel::execute(ScriptOptions options) const { #ifdef HAS_INSTALL_ENV PedDevice *pdevice = ped_device_get(this->device().c_str()); PedDiskType *label = ped_disk_type_get(type_str.c_str()); + if(label == nullptr) { output_error("installfile:" + std::to_string(this->lineno()), "disklabel: Parted does not support label type " + @@ -225,7 +245,7 @@ bool DiskLabel::execute(ScriptOptions options) const { if(disk == nullptr) { output_error("installfile:" + std::to_string(this->lineno()), "disklabel: internal error creating new " + - type_str + " label on " + _block); + type_str + " disklabel on " + _block); return false; } |