Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-RubrikSnapshot not working correctly when confirming the action #699

Closed
JanPillarRubrik opened this issue Oct 28, 2020 · 1 comment · Fixed by #714
Closed

New-RubrikSnapshot not working correctly when confirming the action #699

JanPillarRubrik opened this issue Oct 28, 2020 · 1 comment · Fixed by #714

Comments

@JanPillarRubrik
Copy link

Current Behavior:

Using New-RubrikSnapshot prompts whether we want to proceed using:
Are you sure you want to perform this action?
Performing the operation "Testing SLA" on target "Gold".

There seems to be two issues here:

  1. If you enter "N", it still proceeds and takes a new snapshot.
  2. If you enter "Y", it proceeds and takes a snapshot using the SLA specified (Gold in the example below). If you select "N", it uses *Forever" SLA.
PS C:\Users\Jan> Get-RubrikVM -name "jp-lt-rhel"  | new-rubriksnapshot -sla Gold -verbose
VERBOSE: Validate the Rubrik token exists
VERBOSE: Found a Rubrik token for authentication
VERBOSE: Gather API Data for New-RubrikSnapshot
VERBOSE: Selected 1.0 API Data for New-RubrikSnapshot
VERBOSE: Load API data for New-RubrikSnapshot
VERBOSE: Description: Create an on-demand snapshot for the given object ID

Confirm
Are you sure you want to perform this action?
Performing the operation "Testing SLA" on target "Gold".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): N
VERBOSE: Multiple URIs detected. Selecting URI based on VirtualMachine:::298e0713-6c59-484a-9009-38686e422170-vm-12970
VERBOSE: Loading VMware API data
VERBOSE: List of set parameters: [SLA, Gold] [Verbose, True] [id,
VirtualMachine:::298e0713-6c59-484a-9009-38686e422170-vm-12970]
VERBOSE: Build the body parameters
VERBOSE: Adding forceFullSnapshot...
VERBOSE: Adding slaId...
VERBOSE: No body for this request
VERBOSE: Submitting the request
VERBOSE: Invoking request with a custom timeout of 15 seconds
VERBOSE: POST
https://192.168.75.180/api/v1/vmware/vm/VirtualMachine:::298e0713-6c59-484a-9009-38686e422170-vm-12970/snapshot with
-1-byte payload
VERBOSE: received 382-byte response of content type application/json
VERBOSE: Received HTTP Status 202
VERBOSE: Formatting return value
VERBOSE: Filter the results


progress  : 0.0
status    : QUEUED
startTime : 2020-10-28T13:50:13.944Z
id        : CREATE_VMWARE_SNAPSHOT_298e0713-6c59-484a-9009-38686e422170-vm-12970_56f5a180-e5ea-4043-b9c7-20b4d2f04fa9::
            :0
links     : @{rel=self; href=https://192.168.75.180/api/v1/vmware/vm/request/CREATE_VMWARE_SNAPSHOT_298e0713-6c59-484a-
            9009-38686e422170-vm-12970_56f5a180-e5ea-4043-b9c7-20b4d2f04fa9:::0}



PS C:\Users\Jan>

Expected Behavior:
I would say that the expectation is that we are prompted whether we are 100 % sure we want to take a snapshot. If we reply "Y", then snapshot is taken (using the SLA specified). If "N" is entered, snapshot is not taken.

Steps to Reproduce:

Please provide detailed steps for reproducing the issue.

  1. Run "Get-RubrikVM -name <VM_THAT_EXISTS> | new-rubriksnapshot -sla <SLA_NAME_THAT_EXISTS>"
  2. You are prompted if you want to proceed.
  3. Enter "N" - snapshot is still taken.
  4. Check the snapshot that was created - it was created with "FOREVER" SLA instead of your specified <SLA_NAME_THAT_EXISTS>

Context:

  • Rubrik PowerShell Module Version: 5.0.3
  • PowerShell Version: 5.1.18362.752
  • Operating System: Microsoft Windows 10 Pro

Failure Logs

N/A

@jaapbrasser
Copy link
Contributor

Hey @JanPillarRubrik,

I've changed the behavior of the New-RubrikSnapshot cmdlet:

  • It will not prompt for Test-RubrikSLA by default anymore
  • If -Confirm is used and Test-RubrikSLA didn't run, the script will not continue, determining that if SLAID is empty while SLA was specified, something is wrong.

The changes are staged in #714

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants