2018-10-26 Fred Gleason <fredg@paravelsystems.com>

* Added a warning when starting a module if the host does not
	have a corresponding entry in the database.
This commit is contained in:
Fred Gleason 2018-10-26 10:57:41 -04:00
parent 326de7c1aa
commit 501ed6ae1f
10 changed files with 107 additions and 3 deletions

View File

@ -17914,3 +17914,6 @@
* Update rdimport(1) logging to support both console, syslog, and
file output.
* Update rdservice(8) to use new rdimport(1) logging options.
2018-10-26 Fred Gleason <fredg@paravelsystems.com>
* Added a warning when starting a module if the host does not
have a corresponding entry in the database.

View File

@ -669,6 +669,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -665,6 +665,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -665,6 +665,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -635,6 +635,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -665,6 +665,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -665,6 +665,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -665,6 +665,18 @@
<source>mount(8) crashed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This host</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>does not have a Hosts entry in the database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open RDAdmin-&gt;ManageHosts-&gt;Add to create one.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RDAddCart</name>

View File

@ -93,12 +93,16 @@ RDApplication::~RDApplication()
}
bool RDApplication::open(QString *err_msg)
bool RDApplication::open(QString *err_msg,RDApplication::ErrorType *err_type)
{
int schema=0;
QString db_err;
bool skip_db_check=false;
if(err_type!=NULL) {
*err_type=RDApplication::ErrorOk;
}
//
// Read command switches
//
@ -126,6 +130,9 @@ bool RDApplication::open(QString *err_msg)
return false;
}
if((RD_VERSION_DATABASE!=schema)&&(!skip_db_check)) {
if(err_type!=NULL) {
*err_type=RDApplication::ErrorDbVersionSkew;
}
*err_msg=QObject::tr("Database version mismatch, should be")+
QString().sprintf(" %u, ",RD_VERSION_DATABASE)+
QObject::tr("is")+
@ -137,8 +144,17 @@ bool RDApplication::open(QString *err_msg)
//
// Open Accessors
//
app_system=new RDSystem();
app_station=new RDStation(app_config->stationName());
if(!app_station->exists()) {
if(err_type!=NULL) {
*err_type=RDApplication::ErrorNoHostEntry;
}
*err_msg=QObject::tr("This host")+" (\""+app_config->stationName()+"\") "+
QObject::tr("does not have a Hosts entry in the database.")+"\n"+
QObject::tr("Open RDAdmin->ManageHosts->Add to create one.");
return false;
}
app_system=new RDSystem();
app_library_conf=new RDLibraryConf(app_config->stationName());
app_logedit_conf=new RDLogeditConf(app_config->stationName());
app_airplay_conf=new RDAirPlayConf(app_config->stationName(),"RDAIRPLAY");

View File

@ -40,10 +40,11 @@ class RDApplication : public QObject
{
Q_OBJECT;
public:
enum ErrorType {ErrorOk=0,ErrorDbVersionSkew=1,ErrorNoHostEntry=2};
RDApplication(const QString &module_name,const QString &cmdname,
const QString &usage,QObject *parent=0);
~RDApplication();
bool open(QString *err_msg);
bool open(QString *err_msg,ErrorType *err_type=NULL);
RDAirPlayConf *airplayConf();
RDCae *cae();
RDCmdSwitch *cmdSwitch();