cloudyr / aws.ec2metadata
Showing 1 of 1 files from the diff.

@@ -2,18 +2,17 @@
Loading
2 2
    strsplit(x, "\n")[[1]]
3 3
}
4 4
5 -
get_instance_metadata <- 
6 -
function(item,
7 -
         version = "latest",
8 -
         base_url = "http://169.254.169.254/", 
9 -
         parse = "text",
10 -
         ...) {
5 +
get_instance_metadata <- function(item,
6 +
                                  version = "latest",
7 +
                                  base_url = "http://169.254.169.254/", 
8 +
                                  parse = "text",
9 +
                                  ...) {
11 10
    if (!missing(item)) {
12 11
        uri <- paste0(base_url, version, "/", item)
13 12
    } else {
14 13
        uri <- base_url
15 14
    }
16 -
    response <- try(curl_fetch_memory(uri), silent = TRUE)
15 +
    response <- try(curl::curl_fetch_memory(uri, handle = curl::new_handle(timeout_ms = 100)), silent = TRUE)
17 16
    if (inherits(response, "try-error")) {
18 17
        stop("Request failed", call. = FALSE)
19 18
    } else if (response[["status_code"]] >= 400) {
@@ -190,16 +189,16 @@
Loading
190 189
#' @export
191 190
is_ecs <- function() {
192 191
    container_relative <- Sys.getenv(ENV_CONTAINER_CREDS)
193 -
    return(!is.null(container_relative)&&(container_relative != ""))
192 +
    return(!is.null(container_relative) && (container_relative != ""))
194 193
}
195 194
196 195
#' @rdname ec2metadata
197 196
#' @param base_url Base URL for querying instance metadata
198 197
#' @export
199 -
ecs_metadata <- function(base_url="http://169.254.170.2") {
198 +
ecs_metadata <- function(base_url = "http://169.254.170.2") {
200 199
    container_relative <- Sys.getenv(ENV_CONTAINER_CREDS)
201 200
    uri <- paste0(base_url, container_relative)
202 -
    response <- try(curl::curl_fetch_memory(uri), silent = TRUE)
201 +
    response <- try(curl::curl_fetch_memory(uri, handle = curl::new_handle(timeout_ms = 100)), silent = TRUE)
203 202
    if (inherits(response, "try-error")) {
204 203
        out <- NULL
205 204
    } else {
Files Coverage
R 29.03%
Project Totals (2 files) 29.03%
Notifications are pending CI completion. Periodically Codecov will check the CI state, when complete notifications will be submitted. Push notifications now.
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading