Giter Site home page Giter Site logo

civmdisks's People

Contributors

jondwaite avatar

Stargazers

 avatar  avatar

Watchers

 avatar

civmdisks's Issues

Unexpected error when attempting to add disks in foreach loop

Not sure how active this project is anymore but I was using the module to attempt to create a bulk number of VMs in a VMware Cloud Director instance.

When doing this I am importing objects from a csv and parsing them with foreach loop. Each VM has multiple drives to add, up to 20 additional drives.

After the first VM is created, it will add the disks as expected. All other VMs created it will not add the disks. It returns an error of "Write-Error: Exception occurred attempting to add disk to VM, exiting."

Using Get-CIVMdisk I get Write-Error: Error retrieving VM properties from VCD API, exiting.

Hi,
I am using vCD version 10.3.3.19610595 and powershell 7.4 core

when running the following code:

$VMName = "Test-SRV01"
Install-Module CIVMDisks -Scope CurrentUser -AllowClobber
Import-Module CIVMDisks
$Vm = Get-CIVM -name $VMName
$Vm
$vm | Get-CIVMDisk | Format-Table

I get this error:
Write-Error: Error retrieving VM properties from VCD API, exiting.

The server is found when i output $vm

$vm

Name                           Status                      GuestOSFullName                          CpuCount MemoryGB
----                           ------                      ---------------                          -------- --------
Test-SRV01                  PoweredOff                  Microsoft Windows Server 2022 (64-bit)   1        4,000

anybody an idea?

Issue with incorrect API format

in function - Get-APIVersion
there is operation: Measure-Object -Property Version -Maximum).Maximum.ToString() + ".0"
it returns 36.2.0 for API. Which is not accepted by vCloud resulting in error : Error retrieving VM properties from VCD API, exiting.
Real reason is: Response status code does not indicate success: 406 (Not Acceptable).

vCloud Director expects API version 36.2
By placing comment of + ".0" everything works fine.
Measure-Object -Property Version -Maximum).Maximum.ToString() #+ ".0"

Get-APIVersion number format issue with non US English cultures

When running on culture other than US English, the non-exported function Get-APIVersion might return version in wrong format, which causes other functions to fail.

https://github.com/jondwaite/CIVMDisks/blob/master/CIVMDisks.psm1#L37

Example from a system using fi-FI culture. Note how decimal separator is replaced with comma.

C:\ [DBG]:>> $APIVersion = (($Versions.SupportedVersions.VersionInfo | `
>>             Where-Object { $_.deprecated -eq $false }) | `
>>             Measure-Object -Property Version -Maximum).Maximum.ToString()
C:\ [DBG]:>> $apiversion
36,3

This happens because Measure-Object -Maximum causes input to be parsed as a number and ToString() formats number according to user's current culture if no other formatting information is provided.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.