fogservice.class.php (fogproject-1.5.8) | : | fogservice.class.php (fogproject-1.5.9) | ||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
* @var array | * @var array | |||
*/ | */ | |||
public $procRef = array(); | public $procRef = array(); | |||
/** | /** | |||
* Process pipes | * Process pipes | |||
* | * | |||
* @var array | * @var array | |||
*/ | */ | |||
public $procPipes = array(); | public $procPipes = array(); | |||
/** | /** | |||
* Node IPs we have in the database to check in service startup | ||||
* | ||||
* @var array | ||||
*/ | ||||
public static $knownips = array(); | ||||
/** | ||||
* Initializes the FOGService class | * Initializes the FOGService class | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
public function __construct() | public function __construct() | |||
{ | { | |||
parent::__construct(); | parent::__construct(); | |||
$logpath = trim(trim(self::getSetting('SERVICE_LOG_PATH'), '/')); | $logpath = trim(trim(self::getSetting('SERVICE_LOG_PATH'), '/')); | |||
if (!$logpath) { | if (!$logpath) { | |||
$logpath = 'opt/fog/log'; | $logpath = 'opt/fog/log'; | |||
} | } | |||
self::$logpath = sprintf( | self::$logpath = sprintf( | |||
'/%s/', | '/%s/', | |||
$logpath | $logpath | |||
); | ); | |||
Route::listem( | ||||
'storagenode', | ||||
'name', | ||||
false, | ||||
[ 'isEnabled' => [1] ] | ||||
); | ||||
$StorageNodes = json_decode( | ||||
Route::getData() | ||||
)->storagenodes; | ||||
foreach ((array)$StorageNodes as &$StorageNode) { | ||||
self::$knownips[] = $StorageNode->ip; | ||||
} | ||||
} | } | |||
/** | /** | |||
* Checks if the node runnning this is indeed the master | * Checks if the node runnning this is indeed the master | |||
* | * | |||
* @return array | * @return array | |||
*/ | */ | |||
protected function checkIfNodeMaster() | protected function checkIfNodeMaster() | |||
{ | { | |||
self::getIPAddress(); | self::getIPAddress(); | |||
$find = [ | $find = [ | |||
skipping to change at line 134 | skipping to change at line 152 | |||
); | ); | |||
} | } | |||
/** | /** | |||
* Wait to ensure the network interface is ready | * Wait to ensure the network interface is ready | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
public function waitInterfaceReady() | public function waitInterfaceReady() | |||
{ | { | |||
self::getIPAddress(true); | self::getIPAddress(true); | |||
if (!count(self::$ips) || !in_array(self::getSetting('FOG_WEB_HOST'), se lf::$ips)) { | if (!count(self::$ips) || !array_intersect(self::$knownips, self::$ips)) { | |||
self::outall( | self::outall( | |||
sprintf( | sprintf( | |||
'%s: %s', | '%s: %s', | |||
_('Interface not ready, waiting for it to come up'), | _('Interface not ready, waiting for it to come up'), | |||
self::getSetting('FOG_WEB_HOST') | self::getSetting('FOG_WEB_HOST') | |||
) | ) | |||
); | ); | |||
sleep(10); | sleep(10); | |||
$this->waitInterfaceReady(); | $this->waitInterfaceReady(); | |||
return; | ||||
} | } | |||
foreach (self::$ips as &$ip) { | foreach (self::$ips as &$ip) { | |||
self::outall( | self::outall( | |||
_("Interface Ready with IP Address: $ip") | _("Interface Ready with IP Address: $ip") | |||
); | ); | |||
unset($ip); | unset($ip); | |||
} | } | |||
} | } | |||
/** | /** | |||
* Wait to ensure the DB is ready | * Wait to ensure the DB is ready | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 20 lines changed or added |