Skip to content

Commit

Permalink
Merge pull request #384 from ucdavis/swe/Issue289
Browse files Browse the repository at this point in the history
Leave sshkey out of yaml when disabled/not relevant
  • Loading branch information
sprucely authored Jul 19, 2024
2 parents 01c9aab + 0508673 commit 4087f57
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions Hippo.Core/Services/AccountUpdateYamlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,41 @@ private string GetYaml(QueuedEventModel queuedEventModel)
var group = queuedEventModel.Data.Groups.SingleOrDefault();
var serializer = new Serializer();
return serializer.Serialize(
new
{
groups = group != null ? new[] { group.Name } : new string[] { },
account = new
string.IsNullOrWhiteSpace(account.Key)
? new
{
name = account.Name,
email = account.Email,
kerb = account.Kerberos,
iam = account.Iam,
mothra = account.Mothra,
key = account.Key
},
meta = new
groups = group != null ? new[] { group.Name } : new string[] { },
account = new
{
name = account.Name,
email = account.Email,
kerb = account.Kerberos,
iam = account.Iam,
mothra = account.Mothra,
// no key in this request, so excluding it from yaml
},
meta = new
{
cluster = queuedEventModel.Data.Cluster
}
}
: new
{
cluster = queuedEventModel.Data.Cluster
groups = group != null ? new[] { group.Name } : new string[] { },
account = new
{
name = account.Name,
email = account.Email,
kerb = account.Kerberos,
iam = account.Iam,
mothra = account.Mothra,
key = account.Key
},
meta = new
{
cluster = queuedEventModel.Data.Cluster
}
}
}
);
}

Expand Down

0 comments on commit 4087f57

Please sign in to comment.