Skip to content

Commit a12ab3f

Browse files
authored
Merge pull request #673 from vigh-m/rust-go-update
Update first-party packages
2 parents 3c166ac + b006ac6 commit a12ab3f

File tree

65 files changed

+1686
-1443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1686
-1443
lines changed

sources/Cargo.lock

Lines changed: 1200 additions & 866 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sources/Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ actix-web-actors = { version = "4", default-features = false }
110110
argh = "0.1"
111111
async-trait = "0.1"
112112
aws-config = "1"
113-
aws-lc-rs = "1"
113+
aws-lc-rs = "=1.13.0"
114114
aws-sdk-cloudformation = "1"
115115
aws-sdk-ec2 = "1"
116116
aws-sdk-eks = "1"
@@ -147,7 +147,7 @@ http = "0.2"
147147
httparse = "1"
148148
httptest = "0.15"
149149
hyper = { version = "1", default-features = false }
150-
hyper-http-proxy = "1"
150+
hyper-http-proxy = "~1.0"
151151
hyper-rustls = { version = "0.27", default-features = false }
152152
hyper-util = { version = "0.1", default-features = false }
153153
hyper-unix-connector = "0.2"
@@ -156,7 +156,7 @@ ipnet = "2"
156156
itertools = "0.13"
157157
lazy_static = "1"
158158
libc = "0.2"
159-
log = "0.4.21"
159+
log = "0.4.28"
160160
lz4 = "1"
161161
maplit = "1.0"
162162
nix = "0.26"
@@ -168,11 +168,10 @@ once_cell = "1"
168168
pathdiff = "0.2"
169169
pentacle = "1"
170170
percent-encoding = "2"
171-
pest = "2.5"
172-
pest_derive = "2.5"
171+
pest = "2.8"
172+
pest_derive = "2.8"
173173
pin-project-lite = "0.2"
174174
proc-macro2 = "1"
175-
quick-xml = "0.26"
176175
quote = "1"
177176
rand = { version = "0.8", default-features = false }
178177
regex = "1"
@@ -204,7 +203,7 @@ tower = "0.4"
204203
tracing = "0.1"
205204
unindent = "0.2"
206205
url = "2"
207-
walkdir = "2.4"
206+
walkdir = "2.5"
208207
which = "4"
209208
x509-parser = "0.16"
210209
base64 = "0.22"

sources/api/apiclient/src/exec.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ where
147147
if let Err(e) = res {
148148
let msg = e.to_string();
149149
if !msg.is_empty() {
150-
error!("{}", e);
150+
error!("{e}");
151151
}
152152
}
153153
}
@@ -164,7 +164,7 @@ where
164164
// Stop if we receive a terminal signal.
165165
signal = &mut signal_handler.signal_rx => {
166166
drop(terminal);
167-
debug!("Received signal: {:?}", signal);
167+
debug!("Received signal: {signal:?}");
168168
signal_ret = Some(signal);
169169
}
170170

@@ -405,10 +405,10 @@ impl ReadFromUser {
405405
match serde_json::to_string(&ClientMessage::ContentComplete) {
406406
Ok(msg) => {
407407
if let Err(e) = tx.unbounded_send(Message::Text(msg)) {
408-
warn!("Unable to send ContentComplete to server, may hang if process doesn't exit: {}", e);
408+
warn!("Unable to send ContentComplete to server, may hang if process doesn't exit: {e}");
409409
}
410410
}
411-
Err(e) => warn!("Unable to serialize ContentComplete, may hang if process doesn't exit: {}", e),
411+
Err(e) => warn!("Unable to serialize ContentComplete, may hang if process doesn't exit: {e}"),
412412
}
413413
return Ok(());
414414
} else {
@@ -611,7 +611,7 @@ impl HandleSignals {
611611
debug!("Spawning thread to manage signals");
612612
thread::spawn(move || {
613613
if let Err(e) = Self::handle_signals(signals, winch_tx, signal_tx) {
614-
error!("Signal manager failed: {}", e);
614+
error!("Signal manager failed: {e}");
615615
}
616616
});
617617

sources/api/apiclient/src/exec/terminal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Terminal {
4343
let stdin_tty = isatty(STDIN_FILENO) == Ok(true);
4444
let stdout_tty = isatty(STDOUT_FILENO) == Ok(true);
4545
let is_tty = stdin_tty && stdout_tty;
46-
debug!("Detected tty: {}", is_tty);
46+
debug!("Detected tty: {is_tty}");
4747
is_tty
4848
}
4949
};

sources/api/apiclient/src/main.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ async fn check(args: &Args) -> Result<String> {
893893
match serde_json::from_str::<serde_json::Value>(&output) {
894894
Ok(value) => println!("{value:#}"),
895895
Err(e) => {
896-
warn!("Unable to deserialize response (invalid JSON?): {}", e);
896+
warn!("Unable to deserialize response (invalid JSON?): {e}");
897897
println!("{output}");
898898
}
899899
}
@@ -907,7 +907,7 @@ async fn check(args: &Args) -> Result<String> {
907907
/// Main entry point, dispatches subcommands.
908908
async fn run() -> Result<()> {
909909
let (args, subcommand) = parse_args(env::args());
910-
trace!("Parsed args for subcommand {:?}: {:?}", subcommand, args);
910+
trace!("Parsed args for subcommand {subcommand:?}: {args:?}");
911911

912912
// We use TerminalMode::Stderr because apiclient users expect server response data on stdout.
913913
TermLogger::init(
@@ -975,7 +975,7 @@ async fn run() -> Result<()> {
975975
Subcommand::Set(set) => {
976976
let settings = match set {
977977
SetArgs::Simple(simple) => {
978-
trace!("User supplied Key Value settings {:#?}", simple);
978+
trace!("User supplied Key Value settings {simple:#?}");
979979
// Construct the Key Pair struct.
980980
let set_key_pair = SetKeyPairSettings {
981981
request_payload: simple,
@@ -985,7 +985,7 @@ async fn run() -> Result<()> {
985985
SettingsInput::KeyPair(settings_string)
986986
}
987987
SetArgs::Json(json) => {
988-
trace!("User supplied Json settings {:#?}", json);
988+
trace!("User supplied Json settings {json:#?}");
989989
// Convert JSON Value to a string.
990990
SettingsInput::Json(json.to_string())
991991
}
@@ -1246,10 +1246,7 @@ mod tests {
12461246
assert_eq!(actual.tty, expected.tty);
12471247
assert_eq!(actual.command, expected.command);
12481248
}
1249-
_ => panic!(
1250-
"Expected Exec subcommand: {:?}, got: {:?}",
1251-
expected_subcommand, subcommand
1252-
),
1249+
_ => panic!("Expected Exec subcommand: {expected_subcommand:?}, got: {subcommand:?}"),
12531250
}
12541251
}
12551252

@@ -1293,10 +1290,7 @@ mod tests {
12931290
assert_eq!(actual.tty, expected.tty, "TTY setting should match");
12941291
assert_eq!(actual.command, expected.command, "Command should match");
12951292
}
1296-
_ => panic!(
1297-
"Expected Exec subcommand: {:?}, got: {:?}",
1298-
expected_subcommand, subcommand
1299-
),
1293+
_ => panic!("Expected Exec subcommand: {expected_subcommand:?}, got: {subcommand:?}"),
13001294
}
13011295
}
13021296
}

sources/api/apiclient/src/update.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn required(check_output: &str) -> bool {
6363
false
6464
}
6565
_ => {
66-
debug!("Saw state '{}', assuming update is required", state);
66+
debug!("Saw state '{state}', assuming update is required");
6767
true
6868
}
6969
}
@@ -202,7 +202,7 @@ where
202202
}
203203
.fail();
204204
};
205-
debug!("Found initial timestamp '{}'", before_timestamp);
205+
debug!("Found initial timestamp '{before_timestamp}'");
206206

207207
// Make the real request the user wanted.
208208
let (_code, response_body) = raw_request(&socket_path, &url, &method, data)
@@ -258,10 +258,7 @@ where
258258
Ok((code, status_body)) => (code, status_body),
259259
Err(e) => {
260260
failures += 1;
261-
warn!(
262-
"Unable to check for update status, failure #{}: {}",
263-
failures, e
264-
);
261+
warn!("Unable to check for update status, failure #{failures}: {e}");
265262
continue;
266263
}
267264
};
@@ -273,8 +270,7 @@ where
273270
} else if !code.is_success() {
274271
failures += 1;
275272
warn!(
276-
"Got code {} when checking update status, failure #{}: {}",
277-
code, failures, status_body
273+
"Got code {code} when checking update status, failure #{failures}: {status_body}"
278274
);
279275
continue;
280276
}
@@ -284,8 +280,7 @@ where
284280
.unwrap_or_else(|| "missing".to_string());
285281
let after_command = response_field(&["most_recent_command", "cmd_type"], &status_body)
286282
.unwrap_or_else(|| "missing".to_string());
287-
debug!("Found timestamp '{}' and command '{}' (looking for command '{}' and a change from initial timestamp '{}')",
288-
after_timestamp, after_command, command_name, before_timestamp);
283+
debug!("Found timestamp '{after_timestamp}' and command '{after_command}' (looking for command '{command_name}' and a change from initial timestamp '{before_timestamp}')");
289284

290285
// If we have a new timestamp and see our expected command, we're done.
291286
// Note: we keep waiting if the timestamp changed but the command isn't what we expected;

sources/api/apiserver/src/server/controller.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ pub(crate) fn get_settings_keys<D: DataStore>(
325325
) -> Result<Settings> {
326326
let mut data = HashMap::new();
327327
for key_str in keys {
328-
trace!("Pulling value from datastore for key: {}", key_str);
328+
trace!("Pulling value from datastore for key: {key_str}");
329329
let key = Key::new(KeyType::Data, key_str).context(error::NewKeySnafu {
330330
key_type: "data",
331331
name: *key_str,
@@ -445,10 +445,7 @@ pub(crate) fn set_settings<D: DataStore>(
445445
})?;
446446
}
447447

448-
info!(
449-
"Writing Settings to pending transaction in datastore: {:?}",
450-
pairs
451-
);
448+
info!("Writing Settings to pending transaction in datastore: {pairs:?}");
452449
datastore
453450
.set_keys(&pairs, &pending)
454451
.context(error::DataStoreSnafu { op: "set_keys" })
@@ -470,7 +467,7 @@ pub(crate) fn get_metadata_for_data_keys<D: DataStore, S: AsRef<str>>(
470467

471468
let mut result = HashMap::new();
472469
for data_key_str in data_key_strs {
473-
trace!("Pulling metadata from datastore for key: {}", data_key_str);
470+
trace!("Pulling metadata from datastore for key: {data_key_str}");
474471
let data_key = Key::new(KeyType::Data, data_key_str).context(error::NewKeySnafu {
475472
key_type: "data",
476473
name: *data_key_str,
@@ -597,9 +594,7 @@ pub(crate) fn get_settings_generator_metadata<D: DataStore, S: AsRef<str>>(
597594
.context(error::DeserializeSettingsGeneratorSnafu)?;
598595

599596
trace!(
600-
"Getting the metadata for key {:?} with setting generator {:?}",
601-
data_key,
602-
setting_generator
597+
"Getting the metadata for key {data_key:?} with setting generator {setting_generator:?}"
603598
);
604599
expand_setting_generator(datastore, &data_key, setting_generator, &mut result)?;
605600
}
@@ -761,7 +756,7 @@ where
761756
if let Some(keys_limit) = keys_limit {
762757
let keys_limit: Vec<&str> = keys_limit.iter().map(|s| s.as_ref()).collect();
763758
// Prepare input to config applier; it uses the changed keys to update the right config
764-
trace!("Serializing the commit's changed keys: {:?}", keys_limit);
759+
trace!("Serializing the commit's changed keys: {keys_limit:?}");
765760
let cmd_input =
766761
serde_json::to_string(&keys_limit).context(error::CommandSerializationSnafu {
767762
given: "commit's changed keys",

sources/api/apiserver/src/server/ephemeral_storage.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,15 @@ pub fn initialize(fs: Option<Filesystem>, disks: Option<Vec<String>>) -> Result<
7171
}
7272
);
7373

74-
info!("initializing ephemeral storage disks={:?}", disks);
74+
info!("initializing ephemeral storage disks={disks:?}");
7575
// with a single disk, there is no need to create the array
7676
let device_name = match disks.len() {
7777
1 => disks.first().expect("non-empty").clone(),
7878
_ => {
7979
let scan_output = mdadm_scan()?;
8080
// no previously configured array found, so construct a new one
8181
if scan_output.is_empty() {
82-
info!(
83-
"creating array named {:?} from {:?}",
84-
RAID_DEVICE_NAME, disks
85-
);
82+
info!("creating array named {RAID_DEVICE_NAME:?} from {disks:?}");
8683
mdadm_create(RAID_DEVICE_NAME, disks.iter().map(|x| x.as_str()).collect())?;
8784
}
8885
// Once it is built, it will be available in `/dev/md/`
@@ -92,13 +89,10 @@ pub fn initialize(fs: Option<Filesystem>, disks: Option<Vec<String>>) -> Result<
9289

9390
let fs = fs.unwrap_or(Filesystem::Xfs);
9491
if !is_formatted(&device_name, &fs)? {
95-
info!("formatting {:?} as {}", device_name, fs);
92+
info!("formatting {device_name:?} as {fs}");
9693
format_device(&device_name, &fs)?;
9794
} else {
98-
info!(
99-
"{:?} is already formatted as {}, skipping format",
100-
device_name, fs
101-
);
95+
info!("{device_name:?} is already formatted as {fs}, skipping format");
10296
}
10397

10498
Ok(())
@@ -158,7 +152,7 @@ pub fn bind(variant: &str, dirs: Vec<String>) -> Result<()> {
158152
}
159153
std::fs::create_dir_all(mount_point).context(error::MkdirSnafu {})?;
160154

161-
info!("mounting {:?} as {:?}", device_name, mount_point);
155+
info!("mounting {device_name:?} as {mount_point:?}");
162156
let output = Command::new(MOUNT)
163157
.args([
164158
OsString::from(device_name.clone()),
@@ -188,13 +182,13 @@ pub fn bind(variant: &str, dirs: Vec<String>) -> Result<()> {
188182
std::fs::create_dir_all(&mount_destination).context(error::MkdirSnafu {})?;
189183

190184
if is_mounted(dir)? {
191-
info!("skipping bind mount of {:?}, already mounted", dir);
185+
info!("skipping bind mount of {dir:?}, already mounted");
192186
continue;
193187
}
194188
// call the equivalent of
195189
// mount --rbind /mnt/.ephemeral/._var_lib_kubelet /var/lib/kubelet
196190
let source_dir = OsString::from(&dir);
197-
info!("binding {:?} to {:?}", source_dir, mount_destination);
191+
info!("binding {source_dir:?} to {mount_destination:?}");
198192

199193
let output = Command::new(MOUNT)
200194
.args([
@@ -216,7 +210,7 @@ pub fn bind(variant: &str, dirs: Vec<String>) -> Result<()> {
216210

217211
for dir in dirs {
218212
let source_dir = OsString::from(&dir);
219-
info!("sharing mounts for {:?}", source_dir);
213+
info!("sharing mounts for {source_dir:?}");
220214
// mount --make-rshared /var/lib/kubelet
221215
let output = Command::new(MOUNT)
222216
.args([OsStr::new("--make-rshared"), &source_dir])

sources/api/apiserver/src/server/exec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl StreamHandler<Result<Message, ws::ProtocolError>> for WsExec {
269269

270270
// This means the client is done with us; stop the actor.
271271
Ok(Message::Close(reason)) => {
272-
info!("Client closed exec connection with reason: {:?}", reason);
272+
info!("Client closed exec connection with reason: {reason:?}");
273273
ctx.close(reason);
274274
ctx.stop();
275275
}
@@ -285,7 +285,7 @@ impl StreamHandler<Result<Message, ws::ProtocolError>> for WsExec {
285285
Ok(Message::Nop) => {}
286286

287287
Err(e) => {
288-
error!("Stopping after receiving error message: {}", e);
288+
error!("Stopping after receiving error message: {e}");
289289
ctx.stop();
290290
}
291291
}

sources/api/apiserver/src/server/exec/child.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ impl ChildHandles {
124124
// meaning no ANSI escapes are passed back and forth.
125125
command.env("TERM", "screen");
126126

127-
debug!("Spawning command for exec request: {:?}", command);
127+
debug!("Spawning command for exec request: {command:?}");
128128
let mut child = command.spawn().context(error::SpawnSnafu)?;
129129

130130
// `Command` returns pid as u32, but we want i32 to deal with nix.
131131
let pid_raw = i32::try_from(child.id())
132132
.ok()
133133
.context(error::InvalidPidSnafu { given: child.id() })?;
134134
let pid = Pid::from_raw(pid_raw);
135-
debug!("Spawned child has pid {}", pid);
135+
debug!("Spawned child has pid {pid}");
136136

137137
// Work around partial move of 'init' into closure; not needed in Rust 2021?
138138
let tty = init.tty;
@@ -423,7 +423,7 @@ impl WriteToChild {
423423
// If we can't write to the child process, end the loop and drop the channel so the
424424
// WebSocket receiver knows we can't accept any more and it should close.
425425
if let Err(e) = file.write_all(&data) {
426-
error!("Failed to write to child process: {}", e);
426+
error!("Failed to write to child process: {e}");
427427
break;
428428
}
429429

@@ -576,7 +576,7 @@ impl ReadFromChild {
576576
if e == Errno::EIO {
577577
debug!("Child closed output");
578578
} else {
579-
error!("Failed reading from child: {}", e);
579+
error!("Failed reading from child: {e}");
580580
}
581581
break;
582582
}

0 commit comments

Comments
 (0)