minor work on multiserver-client-deployment

This commit is contained in:
Michael Kaufmann (d00p)
2010-10-22 21:29:47 +00:00
parent 26084a19fa
commit 8b3c634652
4 changed files with 46 additions and 20 deletions

View File

@@ -92,7 +92,15 @@ return array(
'default' => '', 'default' => '',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ),
'froxlorclient_install_destination' => array(
'label' => $lng['froxlorclient']['install_destination'],
'settinggroup' => 'client',
'varname' => 'install_destination',
'type' => 'string',
'default' => '/usr/share/froxlor/',
'save_method' => 'storeSettingField'
),
) )
) )
) )

View File

@@ -131,7 +131,10 @@ class FroxlorPkgCreator
*/ */
public function addFile($name, $data) public function addFile($name, $data)
{ {
$this->_manualFiles[] = array("name" => $name, "data" => $data; $this->_manualFiles[] = array(
'name' => $name,
'data' => $data
);
} }
/** /**

View File

@@ -1529,6 +1529,7 @@ $lng['admin']['froxlorclients']['settings'] = 'settings';
$lng['admin']['froxlorclients']['deploy'] = 'deploy'; $lng['admin']['froxlorclients']['deploy'] = 'deploy';
$lng['menue']['multiserver']['clients'] = 'Multiserver clients'; $lng['menue']['multiserver']['clients'] = 'Multiserver clients';
$lng['admin']['froxlorclient'] = 'Multiserver client settings'; $lng['admin']['froxlorclient'] = 'Multiserver client settings';
$lng['admin']['froxlorclient_settings'] = 'Froxlor client settings:';
$lng['froxlorclient']['ipaddress'] = 'Client IP'; $lng['froxlorclient']['ipaddress'] = 'Client IP';
$lng['froxlorclient']['hostname'] = 'Client hostname'; $lng['froxlorclient']['hostname'] = 'Client hostname';
$lng['froxlorclient']['deploy_mode'] = 'Deploy mode'; $lng['froxlorclient']['deploy_mode'] = 'Deploy mode';
@@ -1537,6 +1538,6 @@ $lng['froxlorclient']['ssh_user'] = 'SSH user';
$lng['froxlorclient']['ssh_passphrase'] = 'SSH passphrase'; $lng['froxlorclient']['ssh_passphrase'] = 'SSH passphrase';
$lng['froxlorclient']['ssh_pubkey'] = 'SSH public key'; $lng['froxlorclient']['ssh_pubkey'] = 'SSH public key';
$lng['froxlorclient']['ssh_privkey'] = 'SSH private key'; $lng['froxlorclient']['ssh_privkey'] = 'SSH private key';
$lng['admin']['froxlorclient_settings'] = 'Froxlor client settings:'; $lng['froxlorclient']['install_destination'] = 'Froxlor client data destination';
?> ?>

View File

@@ -76,24 +76,22 @@ class client_deployer
if($ssh instanceof FroxlorSshTransport) if($ssh instanceof FroxlorSshTransport)
{ {
/** $time = time();
* @TODO implement me $deployList = "/tmp/froxlor_deploy_".$time.".txt";
*/ $zipPath = "/tmp/froxlor_deploy_".$time.".zip";
$deployList = "/tmp/froxlor_deploy_".time().".txt"; $remoteTo = $this->_client->getSetting('client', 'install_destination');
$zipPath = "/tmp/froxlor_deploy_".time().".zip";
$remoteTo = "/var/ww/froxlor/"; // TODO setting variable?!
// TODO get a deploy configuration from database/panel? // TODO get a deploy configuration from database/panel?
// create the deploy list // create the deploy list
$mypath = dirname(dirname((dirname(dirname(__FILE)))));
FroxlorDeployfileCreator::createList( FroxlorDeployfileCreator::createList(
array( array(
"/var/www/froxlor/lib/", makeCorrectDir($mypath."/lib/"),
"/var/www/froxlor/lng/", makeCorrectDir($mypath."/lng/"),
"/var/www/froxlor/scripts/", makeCorrectDir($mypath."/scripts/"),
"/var/www/froxlor/actions/", makeCorrectDir($mypath."/actions/"),
"/var/www/froxlor/templates/" makeCorrectDir($mypath."/templates/")
) )
); );
@@ -119,7 +117,8 @@ class client_deployer
private function _transferArchive($ssh, $from, $to) private function _transferArchive($ssh, $from, $to)
{ {
if ($ssh->sendFile($from, $to)) { if ($ssh->sendFile($from, $to)) {
return stat($from)['7']; $filenfo = stat($from);
return $filenfo['7'];
} else { } else {
return 0.0; return 0.0;
} }
@@ -133,7 +132,7 @@ class client_deployer
*/ */
private function _prepareFiles($deployList, $toPath) private function _prepareFiles($deployList, $toPath)
{ {
$pkg = FroxlorPkgCreator($deployList, $toPath); $pkg = new FroxlorPkgCreator($deployList, $toPath);
/** /**
* create userdata file which * create userdata file which
@@ -155,9 +154,24 @@ class client_deployer
* !!! don't forget to set $server_id to the correct value !!! * !!! don't forget to set $server_id to the correct value !!!
* *
* @return string full path to the created file * @return string full path to the created file
*
* @TODO master-db settings
*/ */
private function _createUserdataFile() private function _createUserdataFile()
{ {
return "Chuck Norris doesn't need a userdata.inc.php to run Froxlor!"; $userdata = '';
$userdata .= "<?php\n";
$userdata .= "// automatically generated userdata.inc.php for Froxlor-Client '".$this->_client->Get('name')."'\n";
$userdata .= "\$sql['host']='".$this->_client->getSetting('client', 'masterdb_host')."';\n";
$userdata .= "\$sql['user']='".$this->_client->getSetting('client', 'masterdb_usr')."';\n";
$userdata .= "\$sql['password']='".$this->_client->getSetting('client', 'masterdb_pwd')."';\n";
$userdata .= "\$sql['db']='".$this->_client->getSetting('client', 'masterdb_db')."';\n";
$userdata .= "\$sql_root[0]['caption']='Master database';\n";
$userdata .= "\$sql_root[0]['host']='".$this->_client->getSetting('client', 'masterdb_host')."';\n";
$userdata .= "\$sql_root[0]['user']='".$this->_client->getSetting('client', 'masterdb_rootusr')."';\n";
$userdata .= "\$sql_root[0]['password']='".$this->_client->getSetting('client', 'masterdb_rootpwd')."';\n";
$userdata .= "// Define our system id\n";
$userdata .= "\$server_id = ".(int)$this->_client->Get('id').";\n";
return $userdata;
} }
} }