mirror of https://github.com/Icinga/icinga2.git
Cli: Make sure that ChangeLog directory exists on 'repository commit'
refs #7255
This commit is contained in:
parent
4cb3d5b1f0
commit
d92dc8539d
|
@ -21,18 +21,7 @@
|
|||
#include "cli/repositoryutility.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/application.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/dynamicobject.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/serializer.hpp"
|
||||
#include "base/netstring.hpp"
|
||||
#include "base/stdiostream.hpp"
|
||||
#include "base/debug.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/console.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include "base/utility.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -71,10 +60,13 @@ ImpersonationLevel RepositoryCommitCommand::GetImpersonationLevel(void) 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 */
|
||||
Utility::MkDirP(RepositoryUtility::GetRepositoryChangeLogPath(), 0750);
|
||||
|
||||
if (vm.count("simulate")) {
|
||||
RepositoryUtility::PrintChangeLog(std::cout);
|
||||
std::cout << "\n";
|
||||
std::cout << "Simulation not yet implemented (#)\n";
|
||||
std::cout << "Simulation not yet implemented.\n";
|
||||
//TODO
|
||||
return 1;
|
||||
} else if (vm.count("clear")) {
|
||||
|
|
|
@ -155,6 +155,11 @@ int RepositoryObjectCommand::GetMaxArguments(void) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
ImpersonationLevel RepositoryObjectCommand::GetImpersonationLevel(void) const
|
||||
{
|
||||
return ImpersonateRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* The entry point for the "repository <type> <add/remove/list>" CLI command.
|
||||
*
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
virtual int GetMaxArguments(void) const;
|
||||
virtual void InitParameters(boost::program_options::options_description& visibleDesc,
|
||||
boost::program_options::options_description& hiddenDesc) const;
|
||||
virtual ImpersonationLevel GetImpersonationLevel(void) const;
|
||||
virtual std::vector<String> GetPositionalSuggestions(const String& word) const;
|
||||
virtual int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const;
|
||||
|
||||
|
|
|
@ -590,15 +590,10 @@ void RepositoryUtility::FormatChangelogEntry(std::ostream& fp, const Dictionary:
|
|||
boost::algorithm::to_lower(type);
|
||||
Dictionary::Ptr attrs = change->Get("attrs");
|
||||
|
||||
fp << " " << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << type << ConsoleColorTag(Console_Normal) << " '";
|
||||
fp << " " << ConsoleColorTag(Console_ForegroundMagenta | Console_Bold) << type << ConsoleColorTag(Console_Normal) << " '";
|
||||
fp << ConsoleColorTag(Console_ForegroundBlue | Console_Bold) << change->Get("name") << ConsoleColorTag(Console_Normal) << "'";
|
||||
|
||||
if (!attrs || attrs->GetLength() == 0) {
|
||||
fp << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
fp << " with attributes: \n";
|
||||
fp << ": \n";
|
||||
|
||||
BOOST_FOREACH(const Dictionary::Pair& kv, attrs) {
|
||||
/* skip the name */
|
||||
|
|
Loading…
Reference in New Issue