Skip to content

Commit 211b5d2

Browse files
committed
send schedule source in activity-related things
1 parent 73c6bcb commit 211b5d2

File tree

24 files changed

+274
-274
lines changed

24 files changed

+274
-274
lines changed

Cargo.lock

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

application/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wings-rs"
33
rust-version = { workspace = true }
4-
version = "0.24.3"
4+
version = "0.24.4"
55
edition = "2024"
66

77
[dependencies]
@@ -43,14 +43,14 @@ rustls = { version = "0.23.27", features = ["aws-lc-rs"] }
4343
ignore = { version = "0.4.23", features = ["simd-accel"] }
4444
sha1 = "0.10.6"
4545
futures = "0.3.31"
46-
russh = "0.56.0"
46+
russh = "0.57.0"
4747
russh-sftp = "2.1.1"
4848
md5 = "0.8.0"
4949
human_bytes = "0.4.3"
5050
ansi_term = "0.12.1"
5151
clap = "4.5.37"
5252
dialoguer = "0.12.0"
53-
sysinfo = "0.37.0"
53+
sysinfo = "0.38.0"
5454
crc32fast = "1.4.2"
5555
cap-std = "4.0.0"
5656
rustix = "1.0.7"

application/src/remote/backups.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pub async fn backup_restic_configuration(
125125
pub async fn create_backup(
126126
client: &Client,
127127
server: uuid::Uuid,
128+
schedule: Option<uuid::Uuid>,
128129
name: Option<&str>,
129130
ignored_files: &[impl Serialize + AsRef<str>],
130131
) -> Result<(BackupAdapter, uuid::Uuid), anyhow::Error> {
@@ -133,6 +134,7 @@ pub async fn create_backup(
133134
.client
134135
.post(format!("{}/servers/{}/backups", client.url, server))
135136
.json(&json!({
137+
"schedule_uuid": schedule,
136138
"name": name,
137139
"ignored_files": ignored_files,
138140
}))

application/src/remote/client.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,34 +239,37 @@ impl Client {
239239
pub async fn set_server_startup_variable(
240240
&self,
241241
uuid: uuid::Uuid,
242+
schedule: Option<uuid::Uuid>,
242243
env_variable: &str,
243244
value: &str,
244245
) -> Result<(), anyhow::Error> {
245246
tracing::info!("setting server startup variable");
246247

247-
super::servers::set_server_startup_variable(self, uuid, env_variable, value).await
248+
super::servers::set_server_startup_variable(self, uuid, schedule, env_variable, value).await
248249
}
249250

250251
#[tracing::instrument(skip(self))]
251252
pub async fn set_server_startup_command(
252253
&self,
253254
uuid: uuid::Uuid,
255+
schedule: Option<uuid::Uuid>,
254256
command: &str,
255257
) -> Result<(), anyhow::Error> {
256258
tracing::info!("setting server startup command");
257259

258-
super::servers::set_server_startup_command(self, uuid, command).await
260+
super::servers::set_server_startup_command(self, uuid, schedule, command).await
259261
}
260262

261263
#[tracing::instrument(skip(self))]
262264
pub async fn set_server_startup_docker_image(
263265
&self,
264266
uuid: uuid::Uuid,
267+
schedule: Option<uuid::Uuid>,
265268
image: &str,
266269
) -> Result<(), anyhow::Error> {
267270
tracing::info!("setting server startup docker image");
268271

269-
super::servers::set_server_startup_docker_image(self, uuid, image).await
272+
super::servers::set_server_startup_docker_image(self, uuid, schedule, image).await
270273
}
271274

272275
#[tracing::instrument(skip(self))]
@@ -333,11 +336,12 @@ impl Client {
333336
pub async fn create_backup(
334337
&self,
335338
server: uuid::Uuid,
339+
schedule: Option<uuid::Uuid>,
336340
name: Option<&str>,
337341
ignored_files: &[impl Serialize + Debug + AsRef<str>],
338342
) -> Result<(BackupAdapter, uuid::Uuid), anyhow::Error> {
339343
tracing::info!("creating backup");
340344

341-
super::backups::create_backup(self, server, name, ignored_files).await
345+
super::backups::create_backup(self, server, schedule, name, ignored_files).await
342346
}
343347
}

application/src/remote/servers.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,15 @@ pub async fn set_server_transfer(
117117
pub async fn set_server_startup_variable(
118118
client: &Client,
119119
uuid: uuid::Uuid,
120+
schedule: Option<uuid::Uuid>,
120121
env_variable: &str,
121122
value: &str,
122123
) -> Result<(), anyhow::Error> {
123124
client
124125
.client
125126
.put(format!("{}/servers/{}/startup/variables", client.url, uuid))
126127
.json(&json!({
128+
"schedule_uuid": schedule,
127129
"env_variable": env_variable,
128130
"value": value,
129131
}))
@@ -137,12 +139,14 @@ pub async fn set_server_startup_variable(
137139
pub async fn set_server_startup_command(
138140
client: &Client,
139141
uuid: uuid::Uuid,
142+
schedule: Option<uuid::Uuid>,
140143
command: &str,
141144
) -> Result<(), anyhow::Error> {
142145
client
143146
.client
144147
.put(format!("{}/servers/{}/startup/command", client.url, uuid))
145148
.json(&json!({
149+
"schedule_uuid": schedule,
146150
"command": command,
147151
}))
148152
.send()
@@ -155,6 +159,7 @@ pub async fn set_server_startup_command(
155159
pub async fn set_server_startup_docker_image(
156160
client: &Client,
157161
uuid: uuid::Uuid,
162+
schedule: Option<uuid::Uuid>,
158163
image: &str,
159164
) -> Result<(), anyhow::Error> {
160165
client
@@ -164,6 +169,7 @@ pub async fn set_server_startup_docker_image(
164169
client.url, uuid
165170
))
166171
.json(&json!({
172+
"schedule_uuid": schedule,
167173
"image": image,
168174
}))
169175
.send()

application/src/routes/api/servers/_server_/files/compress.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ mod post {
161161
server.filesystem.clone(),
162162
writer,
163163
&root,
164-
data.files.into_iter().map(PathBuf::from).collect(),
164+
data.files,
165165
Some(progress),
166166
ignored.into(),
167167
crate::server::filesystem::archive::create::CreateTarOptions {
@@ -181,7 +181,7 @@ mod post {
181181
server.filesystem.clone(),
182182
writer,
183183
&root,
184-
data.files.into_iter().map(PathBuf::from).collect(),
184+
data.files,
185185
Some(progress),
186186
ignored.into(),
187187
crate::server::filesystem::archive::create::CreateZipOptions {
@@ -199,7 +199,7 @@ mod post {
199199
server.filesystem.clone(),
200200
writer,
201201
&root,
202-
data.files.into_iter().map(PathBuf::from).collect(),
202+
data.files,
203203
Some(progress),
204204
ignored.into(),
205205
crate::server::filesystem::archive::create::Create7zOptions {

application/src/routes/upload/file.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ mod post {
189189
"files": [filename],
190190
"directory": server.filesystem.relative_path(&directory),
191191
})),
192+
schedule: None,
192193
timestamp: chrono::Utc::now(),
193194
})
194195
.await;

application/src/server/activity.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub struct ApiActivity {
7979
metadata: Option<serde_json::Value>,
8080

8181
ip: Option<compact_str::CompactString>,
82+
schedule: Option<uuid::Uuid>,
8283
timestamp: chrono::DateTime<chrono::Utc>,
8384
}
8485

@@ -89,6 +90,7 @@ pub struct Activity {
8990
pub metadata: Option<serde_json::Value>,
9091

9192
pub ip: Option<IpAddr>,
93+
pub schedule: Option<uuid::Uuid>,
9294
pub timestamp: chrono::DateTime<chrono::Utc>,
9395
}
9496

@@ -267,6 +269,7 @@ impl ActivityManager {
267269
event: activity.event,
268270
metadata: activity.metadata,
269271
ip: activity.ip.map(|ip| ip.to_compact_string()),
272+
schedule: activity.schedule,
270273
timestamp: activity.timestamp,
271274
})
272275
.collect(),

application/src/server/backup/adapters/btrfs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl BackupExt for BtrfsBackup {
260260
filesystem,
261261
writer,
262262
Path::new(""),
263-
names.into_iter().map(PathBuf::from).collect(),
263+
names,
264264
None,
265265
ignore.into(),
266266
crate::server::filesystem::archive::create::CreateZipOptions {
@@ -280,7 +280,7 @@ impl BackupExt for BtrfsBackup {
280280
filesystem,
281281
writer,
282282
Path::new(""),
283-
names.into_iter().map(PathBuf::from).collect(),
283+
names,
284284
None,
285285
ignore.into(),
286286
crate::server::filesystem::archive::create::CreateTarOptions {

application/src/server/backup/adapters/s3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl BackupCreateExt for S3Backup {
238238
server.filesystem.clone(),
239239
writer,
240240
Path::new(""),
241-
sources.into_iter().map(PathBuf::from).collect(),
241+
sources,
242242
Some(Arc::clone(&progress)),
243243
ignore.into(),
244244
crate::server::filesystem::archive::create::CreateTarOptions {

0 commit comments

Comments
 (0)