mirror of https://github.com/Icinga/icinga2.git
Cli: Bail early on 'repository commit' if changelog dir does not exist
refs #7255
This commit is contained in:
parent
16069a7368
commit
20a176680a
|
@ -60,8 +60,10 @@ ImpersonationLevel RepositoryCommitCommand::GetImpersonationLevel(void) const
|
||||||
*/
|
*/
|
||||||
int RepositoryCommitCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
|
int RepositoryCommitCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
|
||||||
{
|
{
|
||||||
/* create required repositories first, just in case */
|
if (!Utility::PathExists(RepositoryUtility::GetRepositoryChangeLogPath())) {
|
||||||
Utility::MkDirP(RepositoryUtility::GetRepositoryChangeLogPath(), 0750);
|
std::cout << "Repository Changelog path '" << RepositoryUtility::GetRepositoryChangeLogPath() << "' does not exist. Add objects first!\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (vm.count("simulate")) {
|
if (vm.count("simulate")) {
|
||||||
RepositoryUtility::PrintChangeLog(std::cout);
|
RepositoryUtility::PrintChangeLog(std::cout);
|
||||||
|
|
|
@ -150,16 +150,16 @@ std::vector<String> RepositoryObjectCommand::GetPositionalSuggestions(const Stri
|
||||||
return CLICommand::GetPositionalSuggestions(word);
|
return CLICommand::GetPositionalSuggestions(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RepositoryObjectCommand::GetMaxArguments(void) const
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImpersonationLevel RepositoryObjectCommand::GetImpersonationLevel(void) const
|
ImpersonationLevel RepositoryObjectCommand::GetImpersonationLevel(void) const
|
||||||
{
|
{
|
||||||
return ImpersonateRoot;
|
return ImpersonateRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RepositoryObjectCommand::GetMaxArguments(void) const
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry point for the "repository <type> <add/remove/list>" CLI command.
|
* The entry point for the "repository <type> <add/remove/list>" CLI command.
|
||||||
*
|
*
|
||||||
|
|
|
@ -629,7 +629,7 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
|
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
|
||||||
if (kv.first == "import" || kv.first == "name") {
|
if (kv.first == "import" || kv.first == "name" || kv.first == "__name") {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
fp << "\t" << kv.first << " = ";
|
fp << "\t" << kv.first << " = ";
|
||||||
|
|
Loading…
Reference in New Issue