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

Bad Zone can mess up getting GCE instance #180

Open
muschellij2 opened this issue Sep 1, 2021 · 2 comments
Open

Bad Zone can mess up getting GCE instance #180

muschellij2 opened this issue Sep 1, 2021 · 2 comments
Assignees
Labels

Comments

@muschellij2
Copy link
Contributor

Describe the bug
I accidentally sent a bad zone and gce_get_instance didn't fail. This affects gce_vm in the error catching. It didn't cause an error. It errors only when you go to show the object:

token = gargle::credentials_gce()
googleAuthR::gar_auth(token = token, cache = FALSE)
#> ℹ 2021-09-01 23:08:03 > Setting client.id from options(googleAuthR.client_id)
x = googleComputeEngineR::gce_get_instance("blah", 
                                           project = "MYPROJECT",
                                           "us-east4-c#/bin/bash")
x
#> ==Google Compute Engine Instance==
#> 
#> Name:                us-east4-c
#> Created:             1969-12-31 16:00:00
#> Error in basename(x$machineType): a character vector argument expected

Created on 2021-09-01 by the reprex package (v2.0.0)

@muschellij2 muschellij2 added the bug label Sep 1, 2021
muschellij2 added a commit to muschellij2/googleComputeEngineR that referenced this issue Sep 1, 2021
@MarkEdmondson1234
Copy link
Collaborator

MarkEdmondson1234 commented Sep 2, 2021

The print out error is a cosmetic bug via print S3 method here:

print.gce_instance <- function(x, ...){
cat("==Google Compute Engine Instance==\n")
cat("\nName: ", x$name)
cat("\nCreated: ", as.character(timestamp_to_r(x$creationTimestamp)))
cat("\nMachine Type: ", basename(x$machineType))
cat("\nStatus: ", x$status)
cat("\nZone: ", basename(x$zone))
cat("\nExternal IP: ", x$networkInterfaces$accessConfigs[[1]]$natIP)
cat("\nDisks: \n")
print(x$disks[ , c("deviceName","type","mode","boot","autoDelete")])
cat("\nMetadata: \n")
print(x$metadata$items[!x$metadata$items$key %in% c("startup-script","user-data"),])

The instance object itself will still be valid if you view it via str() - but it should also make sure the zone is valid - I guess if the API didn't error it ignroed it?

@muschellij2
Copy link
Contributor Author

muschellij2 commented Sep 2, 2021 via email

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

No branches or pull requests

2 participants