Skip to content

Commit

Permalink
Update Rust dependencies
Browse files Browse the repository at this point in the history
This is a `cargo update`, followed by updating dependencies found through
`cargo outdated -w` and removing unused dependencies found by
`cargo +nightly udeps --workspace`.

The manual updates are:
* nix to 0.17; no important changes
* http to 0.2; no important changes
* reqwest to 0.10; we now use the 'blocking' module since we only use reqwest synchronously
* gptman to 0.6.1; no important changes
  • Loading branch information
tjkirch committed Mar 2, 2020
1 parent 1665309 commit d802422
Show file tree
Hide file tree
Showing 16 changed files with 569 additions and 1,135 deletions.
1,643 changes: 538 additions & 1,105 deletions sources/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sources/api/apiserver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ futures = { version = "0.3", default-features = false }
libc = "0.2"
log = "0.4"
models = { path = "../../models" }
nix = "0.16.0"
nix = "0.17.0"
percent-encoding = "2.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
5 changes: 2 additions & 3 deletions sources/api/early-boot-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ build = "build.rs"

[dependencies]
apiclient = { path = "../apiclient" }
apiserver = { path = "../apiserver" }
http = "0.1"
http = "0.2"
log = "0.4"
reqwest = { version = "0.9", default-features = false, features = [] }
reqwest = { version = "0.10", default-features = false, features = ["blocking"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
simplelog = "0.7"
Expand Down
18 changes: 10 additions & 8 deletions sources/api/early-boot-config/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Currently, Amazon EC2 is supported through the IMDSv1 HTTP API. Data will be ta
extern crate log;

use http::StatusCode;
use reqwest::blocking::Client;
use serde::Serialize;
use serde_json::json;
use simplelog::{Config as LogConfig, LevelFilter, TermLogger, TerminalMode};
Expand Down Expand Up @@ -151,19 +152,20 @@ impl AwsDataProvider {
"http://169.254.169.254/2018-09-24/dynamic/instance-identity/document";

/// Helper to fetch an IMDSv2 session token that is valid for 60 seconds.
fn fetch_imds_session_token(client: &reqwest::Client) -> Result<String> {
fn fetch_imds_session_token(client: &Client) -> Result<String> {
let uri = Self::IMDS_TOKEN_ENDPOINT;
let mut response = client
let response = client
.put(uri)
.header("X-aws-ec2-metadata-token-ttl-seconds", "60")
.send()
.context(error::Request { method: "PUT", uri })?
.error_for_status()
.context(error::BadResponse { uri })?;
let code = response.status();
response.text().context(error::ResponseBody {
method: "PUT",
uri,
code: response.status(),
code,
})
}

Expand All @@ -173,7 +175,7 @@ impl AwsDataProvider {
/// this, otherwise Ok(Some(body)) with the response body.
fn fetch_imds(
file: &str,
client: &reqwest::Client,
client: &Client,
session_token: &str,
uri: &str,
description: &str,
Expand All @@ -185,7 +187,7 @@ impl AwsDataProvider {
));
}
debug!("Requesting {} from {}", description, uri);
let mut response = client
let response = client
.get(uri)
.header("X-aws-ec2-metadata-token", session_token)
.send()
Expand Down Expand Up @@ -229,7 +231,7 @@ impl AwsDataProvider {

/// Fetches user data, which is expected to be in TOML form and contain a `[settings]` section,
/// returning a SettingsJson representing the inside of that section.
fn user_data(client: &reqwest::Client, session_token: &str) -> Result<Option<SettingsJson>> {
fn user_data(client: &Client, session_token: &str) -> Result<Option<SettingsJson>> {
let desc = "user data";
let uri = Self::USER_DATA_ENDPOINT;
let file = Self::USER_DATA_FILE;
Expand All @@ -255,7 +257,7 @@ impl AwsDataProvider {
/// Fetches the instance identity, returning a SettingsJson representing the values from the
/// document which we'd like to send to the API - currently just region.
fn identity_document(
client: &reqwest::Client,
client: &Client,
session_token: &str,
) -> Result<Option<SettingsJson>> {
let desc = "instance identity document";
Expand Down Expand Up @@ -285,7 +287,7 @@ impl PlatformDataProvider for AwsDataProvider {
/// Return settings changes from the instance identity document and user data.
fn platform_data(&self) -> Result<Vec<SettingsJson>> {
let mut output = Vec::new();
let client = reqwest::Client::new();
let client = Client::new();

let session_token = Self::fetch_imds_session_token(&client)?;

Expand Down
3 changes: 1 addition & 2 deletions sources/api/host-containers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ build = "build.rs"

[dependencies]
apiclient = { path = "../apiclient" }
apiserver = { path = "../apiserver" }
http = "0.1"
http = "0.2"
log = "0.4"
models = { path = "../../models" }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion sources/api/migration/migrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build = "build.rs"
bottlerocket-release = { path = "../../../bottlerocket-release" }
lazy_static = "1.2"
log = "0.4"
nix = "0.16"
nix = "0.17"
rand = { version = "0.7", default-features = false, features = ["std"] }
regex = "1.1"
semver = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion sources/api/pluto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
build = "build.rs"

[dependencies]
reqwest = { version = "0.9", default-features = false, features = []}
reqwest = { version = "0.10", default-features = false, features = ["blocking"]}
serde_json = "1"
snafu = "0.6"

Expand Down
14 changes: 8 additions & 6 deletions sources/api/pluto/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ It makes calls to IMDS to get meta data:
- Node IP
- POD Infra Container Image
*/

use reqwest::blocking::Client;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::string::String;
Expand Down Expand Up @@ -127,7 +129,7 @@ use error::PlutoError;

type Result<T> = std::result::Result<T, PlutoError>;

fn get_text_from_imds(client: &reqwest::Client, uri: &str, session_token: &str) -> Result<String> {
fn get_text_from_imds(client: &Client, uri: &str, session_token: &str) -> Result<String> {
client
.get(uri)
.header("X-aws-ec2-metadata-token", session_token)
Expand All @@ -139,7 +141,7 @@ fn get_text_from_imds(client: &reqwest::Client, uri: &str, session_token: &str)
.context(error::ImdsText { uri })
}

fn get_max_pods(client: &reqwest::Client, session_token: &str) -> Result<String> {
fn get_max_pods(client: &Client, session_token: &str) -> Result<String> {
let instance_type = get_text_from_imds(&client, IMDS_INSTANCE_TYPE_ENDPOINT, session_token)?;
// Find the corresponding maximum number of pods supported by this instance type
let file = BufReader::new(
Expand All @@ -161,7 +163,7 @@ fn get_max_pods(client: &reqwest::Client, session_token: &str) -> Result<String>
error::NoInstanceTypeMaxPods { instance_type }.fail()
}

fn get_cluster_dns_ip(client: &reqwest::Client, session_token: &str) -> Result<String> {
fn get_cluster_dns_ip(client: &Client, session_token: &str) -> Result<String> {
let uri = IMDS_MAC_ENDPOINT;
let macs = get_text_from_imds(&client, uri, session_token)?;
// Take the first (primary) MAC address. Others will exist from attached ENIs.
Expand All @@ -184,11 +186,11 @@ fn get_cluster_dns_ip(client: &reqwest::Client, session_token: &str) -> Result<S
Ok(dns)
}

fn get_node_ip(client: &reqwest::Client, session_token: &str) -> Result<String> {
fn get_node_ip(client: &Client, session_token: &str) -> Result<String> {
get_text_from_imds(&client, IMDS_NODE_IPV4_ENDPOINT, session_token)
}

fn get_pod_infra_container_image(client: &reqwest::Client, session_token: &str) -> Result<String> {
fn get_pod_infra_container_image(client: &Client, session_token: &str) -> Result<String> {
// Get the region from the correct location.
let uri = IMDS_INSTANCE_IDENTITY_DOCUMENT_ENDPOINT;
let iid_text = get_text_from_imds(&client, uri, session_token)?;
Expand Down Expand Up @@ -231,7 +233,7 @@ fn parse_args(mut args: env::Args) -> String {
fn run() -> Result<()> {
let setting_name = parse_args(env::args());

let client = reqwest::Client::new();
let client = Client::new();
// Use IMDSv2 for accessing instance metadata
let uri = IMDS_SESSION_TOKEN_ENDPOINT;
let imds_session_token = client
Expand Down
2 changes: 1 addition & 1 deletion sources/api/schnauzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ base64 = "0.11"
bottlerocket-release = { path = "../../bottlerocket-release" }
erased-serde = "0.3"
handlebars = "3.0"
http = "0.1"
http = "0.2"
log = "0.4"
models = { path = "../../models" }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion sources/api/servicedog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build = "build.rs"
[dependencies]
apiclient = { path = "../apiclient" }
apiserver = { path = "../apiserver" }
http = "0.1"
http = "0.2"
log = "0.4"
models = { path = "../../models" }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion sources/api/settings-committer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build = "build.rs"
[dependencies]
apiclient = { path = "../apiclient" }
snafu = "0.6"
http = "0.1"
http = "0.2"
log = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1"
Expand Down
2 changes: 1 addition & 1 deletion sources/api/sundog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build = "build.rs"
[dependencies]
apiclient = { path = "../apiclient" }
apiserver = { path = "../apiserver" }
http = "0.1"
http = "0.2"
log = "0.4"
models = { path = "../../models" }
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion sources/api/thar-be-settings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build = "build.rs"
apiclient = { path = "../apiclient" }
erased-serde = "0.3"
handlebars = "3.0"
http = "0.1"
http = "0.2"
itertools = "0.8"
log = "0.4"
models = { path = "../../models" }
Expand Down
2 changes: 1 addition & 1 deletion sources/growpart/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
publish = false

[dependencies]
gptman = { version = "0.5.0", default-features = false }
gptman = { version = "0.6.1", default-features = false }
snafu = "0.6"
libc = "0.2"
block-party = { path = "../updater/block-party" }
Expand Down
2 changes: 1 addition & 1 deletion sources/updater/signpost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
[dependencies]
bit_field = "0.10.0"
block-party = { path = "../block-party" }
gptman = { version = "0.5.0", default-features = false }
gptman = { version = "0.6.1", default-features = false }
hex-literal = "0.2.0"
serde = { version = "1.0.91", features = ["derive"] }
serde_plain = "0.3.0"
Expand Down
1 change: 0 additions & 1 deletion sources/updater/updog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ serde_plain = "0.3.0"
signpost = { path = "../signpost" }
simplelog = "0.7"
snafu = "0.6.0"
time = "0.1"
toml = "0.5.1"
tough = { version = "0.4.0", features = ["http"] }
update_metadata = { path = "../update_metadata" }
Expand Down

0 comments on commit d802422

Please sign in to comment.