mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Remove Supervisor::NodeConfig (6.1 deprecation)
This commit is contained in:
parent
531276cfe0
commit
0d25583049
5 changed files with 1 additions and 61 deletions
|
@ -56,9 +56,6 @@ export {
|
||||||
## Additional script filenames/paths that the node should load
|
## Additional script filenames/paths that the node should load
|
||||||
## after any user-specified scripts.
|
## after any user-specified scripts.
|
||||||
addl_user_scripts: vector of string &default = vector();
|
addl_user_scripts: vector of string &default = vector();
|
||||||
## The former name of addl_user_scripts.
|
|
||||||
scripts: vector of string &default = vector()
|
|
||||||
&deprecated="Remove in 6.1. Use the addl_user_scripts field instead.";
|
|
||||||
## Environment variables to define in the supervised node.
|
## Environment variables to define in the supervised node.
|
||||||
env: table[string] of string &default=table();
|
env: table[string] of string &default=table();
|
||||||
## A cpu/core number to which the node will try to pin itself.
|
## A cpu/core number to which the node will try to pin itself.
|
||||||
|
|
|
@ -1279,21 +1279,6 @@ Supervisor::NodeConfig Supervisor::NodeConfig::FromRecord(const RecordVal* node)
|
||||||
rval.addl_user_scripts.emplace_back(std::move(script));
|
rval.addl_user_scripts.emplace_back(std::move(script));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto scripts_val = node->GetField("scripts")->AsVectorVal();
|
|
||||||
|
|
||||||
for ( auto i = 0u; i < scripts_val->Size(); ++i )
|
|
||||||
{
|
|
||||||
auto script = scripts_val->StringValAt(i)->ToStdString();
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
rval.scripts.emplace_back(std::move(script));
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
auto env_table_val = node->GetField("env")->AsTableVal();
|
auto env_table_val = node->GetField("env")->AsTableVal();
|
||||||
auto env_table = env_table_val->AsTable();
|
auto env_table = env_table_val->AsTable();
|
||||||
|
|
||||||
|
@ -1380,18 +1365,6 @@ Supervisor::NodeConfig Supervisor::NodeConfig::FromJSON(std::string_view json)
|
||||||
for ( auto it = addl_user_scripts.Begin(); it != addl_user_scripts.End(); ++it )
|
for ( auto it = addl_user_scripts.Begin(); it != addl_user_scripts.End(); ++it )
|
||||||
rval.addl_user_scripts.emplace_back(it->GetString());
|
rval.addl_user_scripts.emplace_back(it->GetString());
|
||||||
|
|
||||||
auto& scripts = j["scripts"];
|
|
||||||
|
|
||||||
for ( auto it = scripts.Begin(); it != scripts.End(); ++it )
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
rval.scripts.emplace_back(it->GetString());
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto& env = j["env"];
|
auto& env = j["env"];
|
||||||
|
|
||||||
for ( auto it = env.MemberBegin(); it != env.MemberEnd(); ++it )
|
for ( auto it = env.MemberBegin(); it != env.MemberEnd(); ++it )
|
||||||
|
@ -1473,21 +1446,6 @@ RecordValPtr Supervisor::NodeConfig::ToRecord() const
|
||||||
|
|
||||||
rval->AssignField("addl_user_scripts", std::move(addl_user_scripts_val));
|
rval->AssignField("addl_user_scripts", std::move(addl_user_scripts_val));
|
||||||
|
|
||||||
auto st = rt->GetFieldType<VectorType>("scripts");
|
|
||||||
auto scripts_val = make_intrusive<VectorVal>(std::move(st));
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
for ( const auto& s : scripts )
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
scripts_val->Assign(scripts_val->Size(), make_intrusive<StringVal>(s));
|
|
||||||
|
|
||||||
rval->AssignField("scripts", std::move(scripts_val));
|
|
||||||
|
|
||||||
auto et = rt->GetFieldType<TableType>("env");
|
auto et = rt->GetFieldType<TableType>("env");
|
||||||
auto env_val = make_intrusive<TableVal>(std::move(et));
|
auto env_val = make_intrusive<TableVal>(std::move(et));
|
||||||
rval->AssignField("env", env_val);
|
rval->AssignField("env", env_val);
|
||||||
|
@ -1695,14 +1653,6 @@ void SupervisedNode::Init(Options* options) const
|
||||||
|
|
||||||
stl.insert(stl.begin(), config.addl_base_scripts.begin(), config.addl_base_scripts.end());
|
stl.insert(stl.begin(), config.addl_base_scripts.begin(), config.addl_base_scripts.end());
|
||||||
stl.insert(stl.end(), config.addl_user_scripts.begin(), config.addl_user_scripts.end());
|
stl.insert(stl.end(), config.addl_user_scripts.begin(), config.addl_user_scripts.end());
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#endif
|
|
||||||
stl.insert(stl.end(), config.scripts.begin(), config.scripts.end());
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordValPtr Supervisor::Status(std::string_view node_name)
|
RecordValPtr Supervisor::Status(std::string_view node_name)
|
||||||
|
|
|
@ -239,11 +239,6 @@ public:
|
||||||
* after any user-specified scripts.
|
* after any user-specified scripts.
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> addl_user_scripts;
|
std::vector<std::string> addl_user_scripts;
|
||||||
/**
|
|
||||||
* The former name for addl_user_scripts, now deprecated.
|
|
||||||
*/
|
|
||||||
std::vector<std::string> scripts
|
|
||||||
[[deprecated("Remove in v6.1. Use NodeConfig::addl_user_scripts.")]];
|
|
||||||
/**
|
/**
|
||||||
* Environment variables and values to define in the node.
|
* Environment variables and values to define in the node.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
supervised node zeek_init(), counter at 1
|
supervised node zeek_init(), counter at 1
|
||||||
supervised node loaded addl_user_script.zeek, counter at 2
|
supervised node loaded addl_user_script.zeek, counter at 2
|
||||||
supervised node loaded script.zeek, counter at 3
|
|
||||||
supervised node zeek_done()
|
supervised node zeek_done()
|
||||||
|
|
|
@ -27,8 +27,7 @@ event zeek_init()
|
||||||
print supervisor_output_file, "supervisor zeek_init()";
|
print supervisor_output_file, "supervisor zeek_init()";
|
||||||
local sn = Supervisor::NodeConfig($name="grault",
|
local sn = Supervisor::NodeConfig($name="grault",
|
||||||
$addl_base_scripts=vector("../addl_base_script.zeek"),
|
$addl_base_scripts=vector("../addl_base_script.zeek"),
|
||||||
$addl_user_scripts=vector("../addl_user_script.zeek"),
|
$addl_user_scripts=vector("../addl_user_script.zeek"));
|
||||||
$scripts=vector("../script.zeek"));
|
|
||||||
local res = Supervisor::create(sn);
|
local res = Supervisor::create(sn);
|
||||||
|
|
||||||
if ( res != "" )
|
if ( res != "" )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue