From 05af1cba0dd302a3da55a8da7d68973eb4e9d371 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 26 Nov 2015 08:09:24 +0100 Subject: [PATCH] Use the NodeName constant in 'api setup' fixes #10641 --- lib/cli/apisetupcommand.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cli/apisetupcommand.cpp b/lib/cli/apisetupcommand.cpp index 562a44d64..8d6aa35fe 100644 --- a/lib/cli/apisetupcommand.cpp +++ b/lib/cli/apisetupcommand.cpp @@ -19,6 +19,7 @@ #include "cli/apisetupcommand.hpp" #include "cli/apisetuputility.hpp" +#include "cli/variableutility.hpp" #include "base/logger.hpp" #include "base/console.hpp" #include @@ -55,7 +56,12 @@ int ApiSetupCommand::GetMaxArguments(void) const */ int ApiSetupCommand::Run(const boost::program_options::variables_map& vm, const std::vector& ap) const { - if (!ApiSetupUtility::SetupMaster(Utility::GetFQDN(), true)) + String cn = VariableUtility::GetVariable("NodeName"); + + if (cn.IsEmpty()) + cn = Utility::GetFQDN(); + + if (!ApiSetupUtility::SetupMaster(cn, true)) return 1; return 0;