Skip to content

Commit

Permalink
icinga2 pki ticket: print hint if --salt missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Apr 3, 2024
1 parent d551eae commit 550fa25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/cli/pkiticketcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ int PKITicketCommand::Run(const boost::program_options::variables_map& vm, const
}

String salt = VariableUtility::GetVariable("TicketSalt");
bool noSaltInVars = salt.IsEmpty();

if (vm.count("salt"))
salt = vm["salt"].as<std::string>();

if (salt.IsEmpty()) {
Log(LogCritical, "cli", "Ticket salt (--salt) must be specified.");
Log log (LogCritical, "cli", "Ticket salt (--salt) must be specified.");

if (noSaltInVars) {
log << " (Did you run 'icinga2 node wizard/setup' and 'icinga2 daemon -C' first?)";
}

return 1;
}

Expand Down

0 comments on commit 550fa25

Please sign in to comment.