diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-13 03:52:08 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-13 03:52:08 -0500 |
commit | 865571068d0e7327a41c42ae46202c95b3f116a9 (patch) | |
tree | 62bc2f27cfbf38153c56c97d20e782c666cf0fd7 /hscript | |
parent | bf8b44eccc3b47e5f3d274a22afa387bdeb818bc (diff) | |
download | horizon-865571068d0e7327a41c42ae46202c95b3f116a9.tar.gz horizon-865571068d0e7327a41c42ae46202c95b3f116a9.tar.bz2 horizon-865571068d0e7327a41c42ae46202c95b3f116a9.tar.xz horizon-865571068d0e7327a41c42ae46202c95b3f116a9.zip |
hscript: Ensure mounts are executed in proper order
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/script.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/hscript/script.cc b/hscript/script.cc index 989ea0f..d1608cd 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -446,6 +446,21 @@ bool Script::execute() const { output_error(phase, "The HorizonScript failed to execute",\ "Check the log file for more details.") + output_step_start("disk"); + /* Sort by mountpoint. + * This ensures that any subdirectory mounts come after their parent. */ + std::sort(this->internal->mounts.begin(), this->internal->mounts.end(), + [](std::unique_ptr<Keys::Mount> const &e1, std::unique_ptr<Keys::Mount> const &e2) { + return e1->mountpoint() < e2->mountpoint(); + }); + for(auto &mount : this->internal->mounts) { + if(!mount->execute(opts)) { + EXECUTE_FAILURE("disk"); + return false; + } + } + output_step_end("disk"); + output_step_start("pre-metadata"); if(!this->internal->hostname->execute(opts)) { EXECUTE_FAILURE("pre-metadata"); |