Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
7385c5e0
Commit
7385c5e0
authored
May 30, 2011
by
Jelte Jansen
Browse files
[trac736] fix after merge
parent
0ac3a688
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/bin/resolver/main.cc
View file @
7385c5e0
...
...
@@ -220,6 +220,7 @@ main(int argc, char* argv[]) {
LOG_DEBUG
(
resolver_logger
,
RESOLVER_DBG_INIT
,
RESOLVER_CONFIGLOAD
);
LOG_INFO
(
resolver_logger
,
RESOLVER_STARTED
);
io_service
.
run
();
}
catch
(
const
std
::
exception
&
ex
)
{
LOG_FATAL
(
resolver_logger
,
RESOLVER_FAILED
).
arg
(
ex
.
what
());
...
...
src/bin/resolver/resolver.cc
View file @
7385c5e0
...
...
@@ -638,6 +638,12 @@ Resolver::updateConfig(ConstElementPtr config) {
}
}
void
Resolver
::
updateLoggingConfig
(
ConstElementPtr
config
)
{
std
::
cout
<<
"[XX] Got new logger config: "
<<
std
::
endl
;
std
::
cout
<<
config
->
str
()
<<
std
::
endl
;
}
void
Resolver
::
setForwardAddresses
(
const
AddressList
&
addresses
)
{
...
...
src/bin/resolver/resolver.h
View file @
7385c5e0
...
...
@@ -95,6 +95,8 @@ public:
/// \brief Handle commands from the config session
isc
::
data
::
ConstElementPtr
updateConfig
(
isc
::
data
::
ConstElementPtr
config
);
void
updateLoggingConfig
(
isc
::
data
::
ConstElementPtr
config
);
/// \brief Assign an ASIO IO Service queue to this Resolver object
void
setDNSService
(
isc
::
asiodns
::
DNSService
&
dnss
);
...
...
src/lib/config/ccsession.cc
View file @
7385c5e0
...
...
@@ -35,6 +35,9 @@
#include
<config/config_log.h>
#include
<config/ccsession.h>
#include
<log/logger_support.h>
#include
<log/logger_specification.h>
using
namespace
std
;
using
isc
::
data
::
Element
;
...
...
@@ -151,6 +154,57 @@ parseCommand(ConstElementPtr& arg, ConstElementPtr command) {
}
}
void
my_logconfig_handler
(
const
std
::
string
&
n
,
ConstElementPtr
new_config
)
{
// TODO CHECK FORMAT
std
::
cout
<<
"[XX] n:"
<<
n
<<
std
::
endl
;
//resolver->updateLoggingConfig(new_config);
std
::
cout
<<
"[XX] "
<<
new_config
->
str
()
<<
std
::
endl
;
if
(
new_config
->
contains
(
"loggers"
))
{
BOOST_FOREACH
(
ConstElementPtr
logger
,
new_config
->
get
(
"loggers"
)
->
listValue
())
{
// create LoggerOptions
const
std
::
string
lname
=
logger
->
get
(
"name"
)
->
stringValue
();
isc
::
log
::
Severity
severity
=
isc
::
log
::
getSeverity
(
logger
->
get
(
"severity"
)
->
stringValue
());
int
dbg_level
=
logger
->
get
(
"debuglevel"
)
->
intValue
();
bool
additive
=
logger
->
get
(
"additive"
)
->
boolValue
();
isc
::
log
::
LoggerSpecification
logger_spec
(
lname
,
severity
,
dbg_level
,
additive
);
if
(
logger
->
contains
(
"output_options"
))
{
BOOST_FOREACH
(
ConstElementPtr
output_option_el
,
logger
->
get
(
"output_options"
)
->
listValue
())
{
// create outputoptions
isc
::
log
::
OutputOption
output_option
;
output_option
.
destination
=
isc
::
log
::
getDestination
(
output_option_el
->
get
(
"destination"
)
->
stringValue
());
if
(
output_option_el
->
contains
(
"stream"
))
{
output_option
.
stream
=
isc
::
log
::
getStream
(
output_option_el
->
get
(
"stream"
)
->
stringValue
());
}
if
(
output_option_el
->
contains
(
"flush"
))
{
output_option
.
flush
=
output_option_el
->
get
(
"flush"
)
->
boolValue
();
}
if
(
output_option_el
->
contains
(
"facility"
))
{
output_option
.
facility
=
output_option_el
->
get
(
"facility"
)
->
stringValue
();
}
if
(
output_option_el
->
contains
(
"filename"
))
{
output_option
.
filename
=
output_option_el
->
get
(
"filename"
)
->
stringValue
();
}
if
(
output_option_el
->
contains
(
"maxsize"
))
{
output_option
.
maxsize
=
output_option_el
->
get
(
"maxsize"
)
->
intValue
();
}
if
(
output_option_el
->
contains
(
"maxver"
))
{
output_option
.
maxver
=
output_option_el
->
get
(
"maxver"
)
->
intValue
();
}
logger_spec
.
addOutputOption
(
output_option
);
}
}
}
}
}
ModuleSpec
ModuleCCSession
::
readModuleSpecification
(
const
std
::
string
&
filename
)
{
std
::
ifstream
file
;
...
...
@@ -193,7 +247,8 @@ ModuleCCSession::ModuleCCSession(
isc
::
data
::
ConstElementPtr
new_config
),
isc
::
data
::
ConstElementPtr
(
*
command_handler
)(
const
std
::
string
&
command
,
isc
::
data
::
ConstElementPtr
args
),
bool
start_immediately
bool
start_immediately
,
bool
handle_logging
)
:
started_
(
false
),
session_
(
session
)
...
...
@@ -207,10 +262,8 @@ ModuleCCSession::ModuleCCSession(
session_
.
establish
(
NULL
);
session_
.
subscribe
(
module_name_
,
"*"
);
//session_.subscribe("Boss", "*");
//session_.subscribe("statistics", "*");
// send the data specification
// send the data specification
ConstElementPtr
spec_msg
=
createCommand
(
"module_spec"
,
module_specification_
.
getFullSpec
());
unsigned
int
seq
=
session_
.
group_sendmsg
(
spec_msg
,
"ConfigManager"
);
...
...
@@ -242,6 +295,11 @@ ModuleCCSession::ModuleCCSession(
if
(
start_immediately
)
{
start
();
}
// Keep track of logging settings automatically
if
(
handle_logging
)
{
addRemoteConfig
(
"Logging"
,
my_logconfig_handler
,
false
);
}
}
void
...
...
src/lib/config/ccsession.h
View file @
7385c5e0
...
...
@@ -161,6 +161,10 @@ public:
* configuration of the local module needs to be updated.
* This must refer to a valid object of a concrete derived class of
* AbstractSession without establishing the session.
* @param handle_logging If true, the ModuleCCSession will automatically
* take care of logging configuration through the virtual Logging config
* module.
*
* Note: the design decision on who is responsible for establishing the
* session is in flux, and may change in near future.
*
...
...
@@ -184,7 +188,8 @@ public:
isc
::
data
::
ConstElementPtr
(
*
command_handler
)(
const
std
::
string
&
command
,
isc
::
data
::
ConstElementPtr
args
)
=
NULL
,
bool
start_immediately
=
true
bool
start_immediately
=
true
,
bool
handle_logging
=
false
);
/// Start receiving new commands and configuration changes asynchronously.
...
...
src/lib/log/output_option.h
View file @
7385c5e0
...
...
@@ -78,7 +78,6 @@ struct OutputOption {
OutputOption
::
Destination
getDestination
(
const
std
::
string
&
dest_str
);
OutputOption
::
Stream
getStream
(
const
std
::
string
&
stream_str
);
}
// namespace log
}
// namespace isc
...
...
src/lib/python/isc/config/tests/cfgmgr_test.py
View file @
7385c5e0
...
...
@@ -176,7 +176,7 @@ class TestConfigManager(unittest.TestCase):
self
.
cm
.
set_module_spec
(
module_spec
)
self
.
assert_
(
module_spec
.
get_module_name
()
in
self
.
cm
.
module_specs
)
module_spec2
=
self
.
cm
.
get_module_spec
(
module_spec
.
get_module_name
())
self
.
assertEqual
(
module_spec
,
module_spec2
)
self
.
assertEqual
(
module_spec
.
get_full_spec
()
,
module_spec2
)
self
.
assertEqual
({},
self
.
cm
.
get_module_spec
(
"nosuchmodule"
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment