* Updated Database->connect to always test if hosts table exists and load the core schema if not.
* Fixed Database->write to log all SQL when 'sys::database::log_transactions' is set.
* Got tools/scancore-update-states scanning and recording network interface data to the database. Also removed it writing out the XML status file.
Signed-off-by: Digimer <digimer@alteeve.ca>
my$query="SELECT COUNT(*) FROM pg_catalog.pg_tables WHERE tablename=".$an->data->{sys}{use_db_fh}->quote($an->data->{defaults}{sql}{test_table})." AND schemaname='public';";
my$query="SELECT network_interface_uuid FROM network_interfaces WHERE network_interface_mac_address = ".$an->data->{sys}{use_db_fh}->quote($network_interface_mac_address).";";
@ -143,7 +143,7 @@ The database connection error was:
<keyname="log_0080"><![CDATA[[ Error ] - The method Database->initialize() was asked to initialize the database: [#!variable!server!#] (id: [#!variable!id!#]) but the core SQL file: [#!variable!sql_file!#] doesn't exist.]]></key>
<keyname="log_0080"><![CDATA[[ Error ] - The method Database->initialize() was asked to initialize the database: [#!variable!server!#] (id: [#!variable!id!#]) but the core SQL file: [#!variable!sql_file!#] doesn't exist.]]></key>
<keyname="log_0081"><![CDATA[[ Error ] - The method Database->initialize() was asked to initialize the database: [#!variable!server!#] (id: [#!variable!id!#]) but the core SQL file: [#!variable!sql_file!#] exist, but can't be read.]]></key>
<keyname="log_0081"><![CDATA[[ Error ] - The method Database->initialize() was asked to initialize the database: [#!variable!server!#] (id: [#!variable!id!#]) but the core SQL file: [#!variable!sql_file!#] exist, but can't be read.]]></key>
<keyname="log_0082">The database: [#!variable!server!#] needs to be initialized using: [#!variable!sql_file!#].</key>
<keyname="log_0082">The database: [#!variable!server!#] needs to be initialized using: [#!variable!sql_file!#].</key>
<keyname="log_0083"></key>
<keyname="log_0083">About to record: [#!variable!id!#]:[#!variable!query!#]</key>
<keyname="log_0084"><![CDATA[[ Error ] - The method Database->query() was asked to query the database: [#!variable!server!#] but no query was given.]]></key>
<keyname="log_0084"><![CDATA[[ Error ] - The method Database->query() was asked to query the database: [#!variable!server!#] but no query was given.]]></key>
<keyname="log_0085"><![CDATA[[ Error ] - The method Database->write() was asked to write to the database: [#!variable!server!#] but no query was given.]]></key>
<keyname="log_0085"><![CDATA[[ Error ] - The method Database->write() was asked to write to the database: [#!variable!server!#] but no query was given.]]></key>
<keyname="log_0086"><![CDATA[[ Error ] - The method System->check_memory() was called without a program name to check.]]></key>
<keyname="log_0086"><![CDATA[[ Error ] - The method System->check_memory() was called without a program name to check.]]></key>
@ -198,6 +198,7 @@ The database connection error was:
<keyname="log_0127">Firewalld was not running, re-enabling it. If you do not want this behaviour, please set 'sys::daemons::restart_firewalld = 0' in the configuration file for this program (or in 'tools.conf').</key>
<keyname="log_0127">Firewalld was not running, re-enabling it. If you do not want this behaviour, please set 'sys::daemons::restart_firewalld = 0' in the configuration file for this program (or in 'tools.conf').</key>
<keyname="log_0128">Firewalld was not running, and 'sys::daemons::restart_firewalld = 0' is set. NOT starting it.</key>
<keyname="log_0128">Firewalld was not running, and 'sys::daemons::restart_firewalld = 0' is set. NOT starting it.</key>
<keyname="log_0129">all</key><!-- Used when logging DB writes to all DBs -->
<keyname="log_0129">all</key><!-- Used when logging DB writes to all DBs -->
<keyname="log_0130"><![CDATA[[ Error ] - The method: [#!variable!method!#] was called and the parameter: [#!variable!parameter!#] was passed an invalid UUID: [#!variable!uuid!#].]]></key>
<!-- Test words. Do NOT change unless you update 't/Words.t' or tests will needlessly fail. -->
<!-- Test words. Do NOT change unless you update 't/Words.t' or tests will needlessly fail. -->
network_interface_mac_addresstext,-- This is allowed to be NULL to support bonds and bridges
network_interface_mac_addresstextnotnull,
network_interface_current_nametextnotnull,-- This is the current name of the interface.
network_interface_current_nametextnotnull,-- This is the current name of the interface.
network_interface_requested_nametext,-- This is the name of the interface that the user requested. This will differ from the current name pending a commit request by the user.
network_interface_requested_nametext,-- This is the name of the interface that the user requested. This will differ from the current name pending a commit request by the user.
network_interface_speednumbernotnull,-- This is the speed, in bits-per-second, of the interface.
network_interface_speedbigintnotnull,-- This is the speed, in bits-per-second, of the interface.
network_interface_mtunumber,-- This is the MTU (Maximum Transmitable Size), in bytes, for this interface.
network_interface_mtubigint,-- This is the MTU (Maximum Transmitable Size), in bytes, for this interface.
network_interface_link_statetextnotnull,-- This is 'up', 'down' or 'unknown'
network_interface_link_statetextnotnull,-- 0 or 1
network_interface_operationaltextnotnull,-- This is 'up', 'down' or 'unknown'
network_interface_duplextextnotnull,-- This is 'full', 'half' or 'unknown'
network_interface_duplextextnotnull,-- This is 'full', 'half' or 'unknown'
network_interface_mediumtextnotnull,-- This is 'tp' (twisted pair), 'fiber' or whatever they invent in the future.
network_interface_mediumtext,-- This is 'tp' (twisted pair), 'fiber' or whatever they invent in the future.
network_interface_bond_uuiduuid,-- If this iface is in a bond, this will contain the 'bonds -> bond_uuid' that it is slaved to.
network_interface_bond_uuiduuid,-- If this iface is in a bond, this will contain the 'bonds -> bond_uuid' that it is slaved to.
network_interface_bridge_uuiduuid,-- If this iface is attached to a bridge, this will contain the 'bridgess -> bridge_uuid' that it is connected to.
network_interface_bridge_uuiduuid,-- If this iface is attached to a bridge, this will contain the 'bridgess -> bridge_uuid' that it is connected to.
my $speed = $link_state ? $an->Storage->read_file({file => $full_path."/speed"}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
my $speed = $link_state ? $an->Storage->read_file({file => $full_path."/speed"}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
if ($speed > 100000)
if ($speed > 100000)
{
{
# This is probably 0 now... Though someday >100 Gbps will be reasonable and
# NOTE: This is probably 0 now... Though someday >100 Gbps will be reasonable
# we'll need to change this.
# and we'll need to change this.
$speed = 0;
$speed = 0;
}
}
$an->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
# Find the media, if possible.
my $media = "unknown";
my $ethtool = $an->System->call({shell_call => $an->data->{path}{exe}{ethtool}});
foreach my $line (split/\n/, $ethtool)
{
if ($line =~ /Supported ports: \[ (.*?) \]/i)
{
$media = lc($1);
last;
}
}
# Log
$an->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {