diff options
| author | jbordalo <[email protected]> | 2026-02-11 13:59:59 +0000 |
|---|---|---|
| committer | jbordalo <[email protected]> | 2026-02-11 13:59:59 +0000 |
| commit | 5e5448bdd899ba9ba263200616a348acda5eb0ed (patch) | |
| tree | 08f273d3f7dedc1f044ad7017119718f6b10bfb5 /src/context.rs | |
| parent | 62e24e5a18b7041717668dff780bd923d0506c47 (diff) | |
Add support for differing username between cluster and local machine
Diffstat (limited to 'src/context.rs')
| -rw-r--r-- | src/context.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/context.rs b/src/context.rs index f67c302..4c1b639 100644 --- a/src/context.rs +++ b/src/context.rs | |||
| @@ -15,6 +15,7 @@ pub struct Context { | |||
| 15 | job_id: Option<u32>, | 15 | job_id: Option<u32>, |
| 16 | infer_job_id: bool, | 16 | infer_job_id: bool, |
| 17 | frontend_hostname: Option<String>, | 17 | frontend_hostname: Option<String>, |
| 18 | cluster_username: Option<String> | ||
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | impl Context { | 21 | impl Context { |
| @@ -22,12 +23,14 @@ impl Context { | |||
| 22 | job_id: Option<u32>, | 23 | job_id: Option<u32>, |
| 23 | infer_job_id: bool, | 24 | infer_job_id: bool, |
| 24 | frontend_hostname: Option<String>, | 25 | frontend_hostname: Option<String>, |
| 26 | cluster_username: Option<String> | ||
| 25 | ) -> Result<Self> { | 27 | ) -> Result<Self> { |
| 26 | Ok(Self { | 28 | Ok(Self { |
| 27 | node: get_execution_node().await?, | 29 | node: get_execution_node().await?, |
| 28 | job_id, | 30 | job_id, |
| 29 | infer_job_id, | 31 | infer_job_id, |
| 30 | frontend_hostname, | 32 | frontend_hostname, |
| 33 | cluster_username | ||
| 31 | }) | 34 | }) |
| 32 | } | 35 | } |
| 33 | 36 | ||
| @@ -57,6 +60,12 @@ impl Context { | |||
| 57 | .as_deref() | 60 | .as_deref() |
| 58 | .ok_or_else(|| eyre::eyre!("missing frontend hostname")) | 61 | .ok_or_else(|| eyre::eyre!("missing frontend hostname")) |
| 59 | } | 62 | } |
| 63 | |||
| 64 | pub fn cluster_username(&self) -> Result<&str> { | ||
| 65 | self.cluster_username | ||
| 66 | .as_deref() | ||
| 67 | .ok_or_else(|| eyre::eyre!("missing cluster username")) | ||
| 68 | } | ||
| 60 | } | 69 | } |
| 61 | 70 | ||
| 62 | async fn get_execution_node() -> Result<ExecutionNode> { | 71 | async fn get_execution_node() -> Result<ExecutionNode> { |
