Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed JSON.DUMPs for the scripter #101

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion odins_spear/scripts/aa_cc_hg_audit.py
Original file line number Diff line number Diff line change
@@ -70,6 +70,6 @@ def main(api, service_provider_id: str, group_id: str):
del aa_cc_hg["typeTag"]
return_data["huntGroups"].append(aa_cc_hg)

return json.dumps(return_data)
return return_data


6 changes: 3 additions & 3 deletions odins_spear/scripts/bulk_password_reset.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ def main(api, service_provider_id: str, group_id: str, users: list, password_typ

print("Setting new SIP passwords complete.")
formatted_user_and_new_passwords = [{"userId": user[0], "newPassword": user[1]} for user in users_and_new_passwords]
return json.dumps(formatted_user_and_new_passwords)
return (formatted_user_and_new_passwords)

# intigration password
elif password_type.lower() == "web":
@@ -32,7 +32,7 @@ def main(api, service_provider_id: str, group_id: str, users: list, password_typ

print("Setting new SIP passwords complete.")
formatted_user_and_new_passwords = [{"userId": user[0], "newPassword": user[1]} for user in users_and_new_passwords]
return json.dumps(formatted_user_and_new_passwords)
return (formatted_user_and_new_passwords)

# voicemail/ oortal
elif password_type.lower() == "vm": # voicemail
@@ -47,7 +47,7 @@ def main(api, service_provider_id: str, group_id: str, users: list, password_typ

print("Setting new voicemail passcodes complete.")
formatted_user_and_new_passcodes = [{"userId": user[0], "newPasscode": user[1]} for user in users_and_new_passcodes]
return json.dumps(formatted_user_and_new_passcodes)
return (formatted_user_and_new_passcodes)

# raise error if user attempts to change another type of password.
else:
20 changes: 14 additions & 6 deletions odins_spear/scripts/find_alias.py
Original file line number Diff line number Diff line change
@@ -106,17 +106,25 @@ def main(api, service_provider_id: str, group_id: str, alias: str):
print(f"Failed to process {entity_type} - {service_user_id} after {MAX_RETRIES} retries. Skipping.")

for broadwork_entity in tqdm(OBJECT_WITH_ALIAS, desc=f"Searching AA, HG, and CC for alias {alias}"):

if locate_alias(alias, broadwork_entity['aliases']):
return f"""
Alias ({alias}) found: {broadwork_entity['type']} - {broadwork_entity['name']}"""
return {
"alias": alias,
"broadwork_entity": broadwork_entity['aliases'],
"name": broadwork_entity['name'],
"type": broadwork_entity['type']
}

users = api.get.users(service_provider_id, group_id, extended=True)
print("Fetched users.")

for user in tqdm(users, desc=f"Searching Users for alias: {alias}"):

if locate_alias(alias, user['aliases']):
return f"\n\n\tAlias ({alias}) found: User - {user['userId']}\n"
return {
"alias": alias,
"user_id": user['userId'],
"type": "user"
}

return f"\n\n\tAlias ({alias}) not found."
from ..exceptions import OSAliasNotFound
return OSAliasNotFound
4 changes: 1 addition & 3 deletions odins_spear/scripts/service_pack_audit.py
Original file line number Diff line number Diff line change
@@ -29,6 +29,4 @@ def main(api, service_provider_id, group_id):

assigned_service_pack_services.append(sps)

return json.dumps({
"servicePackServices": assigned_service_pack_services
})
return assigned_service_pack_services
2 changes: 1 addition & 1 deletion odins_spear/scripts/service_provider_trunking_capacity.py
Original file line number Diff line number Diff line change
@@ -107,4 +107,4 @@ def main(api: object, service_provider_id: str):
return_data["callCapacityDifference"] = return_data["maxActiveCalls"] - return_data["groupsCallCapacityTotal"]
return_data["burstingCallCapacityDifference"] = return_data["burstingMaxActiveCalls"] - return_data["groupsBurstingCallCapacityTotal"]

return json.dumps(return_data)
return return_data
2 changes: 1 addition & 1 deletion odins_spear/scripts/user_association.py
Original file line number Diff line number Diff line change
@@ -56,4 +56,4 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
except Exception:
USER_DATA["callCenters"] = None

return json.dumps(USER_DATA)
return USER_DATA