update fix deadcode, security
This commit is contained in:
@@ -23,75 +23,6 @@ class VMConfigurationService
|
||||
$this->client->loginServer($vcenterModel);
|
||||
}
|
||||
|
||||
public function ConfigVirtualMachineUbuntu($vmware_id = '', $product = [], $password = ''): void
|
||||
{
|
||||
$this->setConfig($product->IpAddress->Host->Datacenter->vCenter);
|
||||
$VirtualMachine = "VirtualMachine-$vmware_id";
|
||||
$IPAddress = $product->IpAddress->ip;
|
||||
$Gateway = $product->IpAddress->gateway;
|
||||
$HostName = strtolower($product->hostname);
|
||||
|
||||
try {
|
||||
Log::channel('Custom')->info("===================================================================");
|
||||
Log::channel('Custom')->info("Configuring Ubuntu for VM #ID $VirtualMachine");
|
||||
|
||||
$cmd1 = "\$vm = get-vm -Id '$VirtualMachine';\$hostname ='$HostName'; \$ipadd = '$IPAddress'; \$gw = '$Gateway'; \$password = \"'$password'\"; cd /; C:\CLISave\createUbuntu1line.ps1;";
|
||||
Log::channel('Custom')->info($cmd1);
|
||||
$this->powerShellService->executePowerCLI($cmd1);
|
||||
|
||||
$cmd2 = "\$vm = get-vm -Id '$VirtualMachine'; \$ipadd = '$IPAddress'; \$gw = '$Gateway'; \$password = \"'$password'\"; cd /; C:\CLISave\changeLinux.ps1;";
|
||||
Log::channel('Custom')->info($cmd2);
|
||||
$this->powerShellService->executePowerCLI($cmd2);
|
||||
|
||||
Log::channel('Custom')->info("Configuration completed at " . Carbon::now());
|
||||
Log::channel('Custom')->info("===================================================================");
|
||||
} catch (Exception $error) {
|
||||
Log::channel('Custom')->error("Error configuring Ubuntu: " . $error->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function ConfigCentOSVersion8($vmware_id = '', $product = [], $password = ''): void
|
||||
{
|
||||
$this->setConfig($product->IpAddress->Host->Datacenter->vCenter);
|
||||
$VirtualMachine = "VirtualMachine-$vmware_id";
|
||||
$IPAddress = $product->IpAddress->ip;
|
||||
$Gateway = $product->IpAddress->gateway;
|
||||
$HostName = strtolower($product->hostname);
|
||||
|
||||
try {
|
||||
Log::channel('Custom')->info("Configuring CentOS 8 for VM #ID $VirtualMachine");
|
||||
|
||||
$cmd = "\$vm = get-vm -Id '$VirtualMachine';\$hostname ='$HostName'; \$ipadd = '$IPAddress'; \$gw = '$Gateway'; \$password = \"'$password'\"; cd /; C:\CLISave\createCentOS81line.ps1;";
|
||||
Log::channel('Custom')->info($cmd);
|
||||
$this->powerShellService->executePowerCLI($cmd);
|
||||
|
||||
Log::channel('Custom')->info("Configuration completed at " . Carbon::now());
|
||||
} catch (Exception $error) {
|
||||
Log::channel('Custom')->error("Error configuring CentOS 8: " . $error->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function ConfigCentOSVersion7($vmware_id = '', $product = [], $password = ''): void
|
||||
{
|
||||
$this->setConfig($product->IpAddress->Host->Datacenter->vCenter);
|
||||
$VirtualMachine = "VirtualMachine-$vmware_id";
|
||||
$IPAddress = $product->IpAddress->ip;
|
||||
$Gateway = $product->IpAddress->gateway;
|
||||
$HostName = strtolower($product->hostname);
|
||||
|
||||
try {
|
||||
Log::channel('Custom')->info("Configuring CentOS 7 for VM #ID $VirtualMachine");
|
||||
|
||||
$cmd = "\$vm = get-vm -Id '$VirtualMachine'; \$hostname ='$HostName';\$ipadd = '$IPAddress'; \$gw = '$Gateway'; \$password = \"'$password'\"; cd /; C:\CLISave\createCentOS71line.ps1;";
|
||||
Log::channel('Custom')->info($cmd);
|
||||
$this->powerShellService->executePowerCLI($cmd);
|
||||
|
||||
Log::channel('Custom')->info("Configuration completed at " . Carbon::now());
|
||||
} catch (Exception $error) {
|
||||
Log::channel('Custom')->error("Error configuring CentOS 7: " . $error->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function ConfigWindowsVersion10($vmware_id = '', $product = [], $password = ''): void
|
||||
{
|
||||
if (!$this->validateProductData($product, 'ConfigWindowsVersion10', $vmware_id)) return;
|
||||
|
||||
Reference in New Issue
Block a user