Refactor vCenter snapshot handling and VM operations
- Introduced a new method `resolveVCenterFromProduct` in `SnapshotService` to streamline vCenter resolution from product data. - Updated `CreateSnapshot`, `RemoveSnapshot`, and `RevertSnapshot` jobs to utilize the new vCenter resolution method. - Enhanced the `VmController` to support UUID-based service identification for VM operations. - Added new actions for changing VM IP and RDP port, encapsulating the logic for these operations. - Improved error handling and logging for VM operations, including detailed responses for API consumers. - Removed unnecessary relationships in model queries to optimize performance.
This commit is contained in:
@@ -30,7 +30,9 @@ class ModuleVmware extends Model
|
||||
'status'
|
||||
];
|
||||
|
||||
protected $casts = ['password' => 'hashed'];
|
||||
// NOTE: password must NOT use 'hashed' cast — it is a VM guest credential
|
||||
// used in plaintext by PowerShell scripts (Invoke-VMScript) via SSH/PowerCLI.
|
||||
protected $casts = [];
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Customer::class);
|
||||
@@ -56,6 +58,11 @@ class ModuleVmware extends Model
|
||||
return $this->belongsTo(\App\Models\Order::class);
|
||||
}
|
||||
|
||||
public function services()
|
||||
{
|
||||
return $this->hasMany(\App\Models\Service::class, 'vm_id', 'vmware_id');
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
return match ($this->status) {
|
||||
|
||||
Reference in New Issue
Block a user