mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-11-26 07:10:11 +01:00
2017-09-30 Fred Gleason <fredg@paravelsystems.com>
* Added a [Provisioning] section to rd.conf(5). * Moved code to create new hosts to the 'RDStation::create()' method. * Moved code to delete hosts to the 'RDStation::remove()' method. * Implemented 'CreateHost=' and 'NewHostTemplate=' parameters in the [Provisioning] section of rd.conf(5).
This commit is contained in:
35
cae/cae.cpp
35
cae/cae.cpp
@@ -42,6 +42,8 @@
|
||||
#include <rdsocket.h>
|
||||
#include <rdconf.h>
|
||||
#include <rdcheck_daemons.h>
|
||||
#include <rddb.h>
|
||||
#include <rdescape_string.h>
|
||||
#include <rddebug.h>
|
||||
#include <rdcmd_switch.h>
|
||||
#include <rdsystem.h>
|
||||
@@ -240,6 +242,11 @@ MainObject::MainObject(QObject *parent,const char *name)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Provisioning
|
||||
//
|
||||
InitProvisioning();
|
||||
|
||||
//
|
||||
// Start Up the Drivers
|
||||
//
|
||||
@@ -568,6 +575,34 @@ void MainObject::updateMeters()
|
||||
}
|
||||
|
||||
|
||||
void MainObject::InitProvisioning() const
|
||||
{
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
QString err_msg;
|
||||
|
||||
if(rd_config->provisioningCreateHost()) {
|
||||
if(!rd_config->provisioningHostTemplate().isEmpty()) {
|
||||
sql=QString("select NAME from STATIONS where ")+
|
||||
"NAME=\""+RDEscapeString(rd_config->stationName())+"\"";
|
||||
q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
if(RDStation::create(rd_config->stationName(),&err_msg,rd_config->provisioningHostTemplate())) {
|
||||
syslog(LOG_INFO,"created new host entry \"%s\"",
|
||||
(const char *)rd_config->stationName());
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"caed: unable to provision host [%s]\n",
|
||||
(const char *)err_msg);
|
||||
exit(256);
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainObject::InitMixers()
|
||||
{
|
||||
for(int i=0;i<RD_MAX_CARDS;i++) {
|
||||
|
||||
Reference in New Issue
Block a user