Skip to content

Commit 9d75ff2

Browse files
changed the files
1 parent 506fbcb commit 9d75ff2

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

infra/scripts/upload_team_config.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def check_team_exists(backend_url, team_id, user_principal_id):
1616
exists: bool
1717
"""
1818
check_endpoint = backend_url.rstrip('/') + f'/api/v3/team_configs/{team_id}'
19-
headers = {}
20-
if user_principal_id is not None:
21-
headers['x-ms-client-principal-id'] = user_principal_id
19+
headers = {
20+
'x-ms-client-principal-id': user_principal_id
21+
}
2222

2323
try:
2424
response = requests.get(check_endpoint, headers=headers)
@@ -39,18 +39,12 @@ def check_team_exists(backend_url, team_id, user_principal_id):
3939

4040
backend_url = sys.argv[1]
4141
directory_path = sys.argv[2]
42-
user_principal_id = sys.argv[3] if len(sys.argv) > 3 else None
42+
user_principal_id = sys.argv[3] if len(sys.argv) > 3 else "00000000-0000-0000-0000-000000000000"
4343

4444
# Convert to absolute path if provided as relative
4545
directory_path = os.path.abspath(directory_path)
4646
print(f"Scanning directory: {directory_path}")
4747

48-
# Determine if we should use authentication headers
49-
use_auth_headers = user_principal_id is not None
50-
if use_auth_headers:
51-
print(f"Using authentication with user ID: {user_principal_id}")
52-
else:
53-
print("No authentication - backend will use development mode")
5448

5549
files_to_process = [
5650
("hr.json", "00000000-0000-0000-0000-000000000001"),
@@ -84,9 +78,9 @@ def check_team_exists(backend_url, team_id, user_principal_id):
8478
files = {
8579
'file': (filename, file_data, 'application/json')
8680
}
87-
headers = {}
88-
if use_auth_headers:
89-
headers['x-ms-client-principal-id'] = user_principal_id
81+
headers = {
82+
'x-ms-client-principal-id': user_principal_id
83+
}
9084

9185
params = {
9286
'team_id': team_id

infra/scripts/upload_team_config.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,8 @@ else
7575
az account set --subscription "$currentSubscriptionId"
7676
fi
7777

78-
# Only get user principal ID if we have azSubscriptionId (indicating authentication is needed)
79-
if [ -n "$azSubscriptionId" ]; then
80-
echo "Getting user principal ID for authentication..."
81-
userPrincipalId=$(az ad signed-in-user show --query id -o tsv)
82-
echo "Using authenticated mode with user ID: $userPrincipalId"
83-
else
84-
echo "No subscription ID provided - using development mode (no authentication)"
85-
userPrincipalId=""
86-
fi
78+
userPrincipalId=$(az ad signed-in-user show --query id -o tsv)
79+
echo "User Principal ID: $userPrincipalId"
8780

8881
# Determine the correct Python command
8982
if command -v python && python --version &> /dev/null; then
@@ -120,11 +113,7 @@ pip install --quiet -r infra/scripts/requirements.txt
120113
echo "Requirements installed"
121114

122115
echo "Running the python script to upload team configuration"
123-
if [ -n "$userPrincipalId" ]; then
124-
$PYTHON_CMD infra/scripts/upload_team_config.py "$backendUrl" "$directoryPath" "$userPrincipalId"
125-
else
126-
$PYTHON_CMD infra/scripts/upload_team_config.py "$backendUrl" "$directoryPath"
127-
fi
116+
$PYTHON_CMD infra/scripts/upload_team_config.py "$backendUrl" "$directoryPath" "$userPrincipalId"
128117
if [ $? -ne 0 ]; then
129118
echo "Error: Team configuration upload failed."
130119
exit 1

0 commit comments

Comments
 (0)