Skip to content

Commit 2e248b1

Browse files
committed
refactor: Slightly optimize conditional kerberos keytab generation
1 parent 99f346a commit 2e248b1

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

rust/operator-binary/src/backend/kerberos_keytab.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ cluster.local = {realm_name}
209209
.context(WriteConfigSnafu)?;
210210
}
211211

212-
let keytab_data =
213-
if selector.provision_parts == ProvisionParts::PublicPrivate {
212+
let keytab = match selector.provision_parts {
213+
ProvisionParts::Public => None,
214+
ProvisionParts::PublicPrivate => {
214215
let admin_keytab_file_path = tmp.path().join("admin-keytab");
215216
{
216217
let mut admin_keytab_file = File::create(&admin_keytab_file_path)
@@ -304,15 +305,13 @@ cluster.local = {realm_name}
304305
.context(ReadProvisionedKeytabSnafu)?;
305306

306307
Some(keytab_data)
307-
} else {
308-
// NOTE (@Techassi): I kinda hate this, but I guess there is no way around it
309-
None
310-
};
308+
}
309+
};
311310

312311
Ok(SecretContents::new(SecretData::WellKnown(
313312
WellKnownSecretData::Kerberos(well_known::Kerberos {
314-
keytab: keytab_data,
315313
krb5_conf: profile.into_bytes(),
314+
keytab,
316315
}),
317316
)))
318317
}

0 commit comments

Comments
 (0)