Skip to content

Commit c418f8b

Browse files
authored
Revert "Add debug logging to identify problematic IDP group"
This reverts commit 9638298.
1 parent 9638298 commit c418f8b

File tree

3 files changed

+54
-115
lines changed

3 files changed

+54
-115
lines changed

src/Octoshift/Commands/CreateTeam/CreateTeamCommandHandler.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,15 @@ public async Task Handle(CreateTeamCommandArgs args)
4444
}
4545
else
4646
{
47-
_log.LogInformation($"Attempting to link team '{args.TeamName}' to IDP group '{args.IdpGroup}'");
48-
4947
var members = await _githubApi.GetTeamMembers(args.GithubOrg, teamSlug);
50-
_log.LogInformation($"Found {members.Count()} existing team members to remove before linking to IDP group");
5148

5249
foreach (var member in members)
5350
{
54-
_log.LogInformation($"Removing team member '{member}' from team '{teamSlug}'");
5551
await _githubApi.RemoveTeamMember(args.GithubOrg, teamSlug, member);
5652
}
5753

58-
_log.LogInformation($"Searching for IDP group '{args.IdpGroup}' in organization '{args.GithubOrg}'");
59-
60-
int idpGroupId;
61-
try
62-
{
63-
idpGroupId = await _githubApi.GetIdpGroupId(args.GithubOrg, args.IdpGroup);
64-
_log.LogInformation($"Found IDP group '{args.IdpGroup}' with ID: {idpGroupId}");
65-
}
66-
catch (OctoshiftCliException ex)
67-
{
68-
_log.LogError($"Failed to find IDP group: {ex.Message}");
69-
throw;
70-
}
54+
var idpGroupId = await _githubApi.GetIdpGroupId(args.GithubOrg, args.IdpGroup);
7155

72-
_log.LogInformation($"Adding IDP group '{args.IdpGroup}' (ID: {idpGroupId}) to team '{teamSlug}'");
7356
await _githubApi.AddEmuGroupToTeam(args.GithubOrg, teamSlug, idpGroupId);
7457

7558
_log.LogSuccess("Successfully linked team to Idp group");

src/Octoshift/Services/GithubApi.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ mutation startRepositoryMigration(
390390
$lockSource: Boolean)";
391391
var gql = @"
392392
startRepositoryMigration(
393-
input: {
393+
input: {
394394
sourceId: $sourceId,
395395
ownerId: $ownerId,
396396
sourceRepositoryUrl: $sourceRepositoryUrl,
@@ -456,7 +456,7 @@ mutation startOrganizationMigration (
456456
$targetEnterpriseId: ID!,
457457
$sourceAccessToken: String!)";
458458
var gql = @"
459-
startOrganizationMigration(
459+
startOrganizationMigration(
460460
input: {
461461
sourceOrgUrl: $sourceOrgUrl,
462462
targetOrgName: $targetOrgName,
@@ -620,15 +620,8 @@ public virtual async Task<int> GetIdpGroupId(string org, string groupName)
620620
{
621621
var url = $"{_apiUrl}/orgs/{org.EscapeDataString()}/external-groups";
622622

623-
var allGroups = await _client.GetAllAsync(url, data => (JArray)data["groups"]).ToListAsync();
624-
625-
var group = allGroups.SingleOrDefault(x => string.Equals((string)x["group_name"], groupName, StringComparison.OrdinalIgnoreCase));
626-
627-
if (group == null)
628-
{
629-
var availableGroups = string.Join(", ", allGroups.Select(g => $"'{g["group_name"]}'"));
630-
throw new OctoshiftCliException($"IDP group '{groupName}' not found in organization '{org}'. Available groups: {availableGroups}");
631-
}
623+
var group = await _client.GetAllAsync(url, data => (JArray)data["groups"])
624+
.SingleAsync(x => string.Equals((string)x["group_name"], groupName, StringComparison.OrdinalIgnoreCase));
632625

633626
return (int)group["group_id"];
634627
}
@@ -1084,7 +1077,7 @@ mutation abortRepositoryMigration(
10841077
)";
10851078
var gql = @"
10861079
abortRepositoryMigration(
1087-
input: {
1080+
input: {
10881081
migrationId: $migrationId
10891082
})
10901083
{ success }";

0 commit comments

Comments
 (0)