Commit b8a7bf58 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[trac922] Using a parameter to distinguish filename

parent 3a54f64a
......@@ -358,11 +358,12 @@ ModuleCCSession::checkCommand() {
std::string
ModuleCCSession::addRemoteConfig(const std::string& spec_name,
void (*handler)(const std::string& module,
ConstElementPtr))
ConstElementPtr),
bool spec_is_filename)
{
std::string module_name;
ModuleSpec rmod_spec;
if (spec_name.find_first_of("./") != std::string::npos) {
if (spec_is_filename) {
// It's a file name, so load it
rmod_spec = readModuleSpecification(spec_name);
module_name =
......
......@@ -244,22 +244,23 @@ public:
* filename of the spec file to use or a name of module
* (in case it's a module name, the spec data is
* downloaded from the configuration manager, therefore
* the configuration manager must know it). A heuristic
* is used to guess which should be used - if it contains
* a slash or dot, filename is assumed, otherwise
* name of module is assumed.
* the configuration manager must know it). If
* spec_is_filenabe is true (the default), then a
* filename is assumed, otherwise a module name.
* \param handler The handler function called whenever there's a change.
* Called once initally from this function. May be NULL
* if you don't want any handler to be called and you're
* fine with requesting the data through
* getRemoteConfigValue() each time.
* \param spec_is_filename Says if spec_name is filename or module name.
* \return The name of the module specified in the given specification
* file
*/
std::string addRemoteConfig(const std::string& spec_name,
void (*handler)(const std::string& module_name,
isc::data::ConstElementPtr
update) = NULL);
update) = NULL,
bool spec_is_filename = true);
/**
* Removes the module with the given name from the remote config
......
......@@ -412,7 +412,8 @@ TEST_F(CCSessionTest, remoteConfig) {
session.getMessages()->add(createAnswer(0, spec.getFullSpec()));
session.getMessages()->add(createAnswer(0, el("{}")));
EXPECT_NO_THROW(module_name = mccs.addRemoteConfig("Spec2"));
EXPECT_NO_THROW(module_name = mccs.addRemoteConfig("Spec2", NULL,
false));
EXPECT_EQ("Spec2", module_name);
EXPECT_NO_THROW(item1 =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment