Skip to content

Commit

Permalink
Merge pull request #116 from PagerDuty/T2D2-306-Bug-broken-in-append-…
Browse files Browse the repository at this point in the history
…in-public-support-scripts

Fix: script no longer appends on new run
  • Loading branch information
JosefGoodyear authored May 14, 2024
2 parents 3829752 + 081b4f0 commit 3d3d07b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions get_info_on_all_users/get_users_by_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
allowed_roles=['admin','read_only_user','read_only_limited_user','user','limited_user','observer','restricted_access','owner']
team_managers=[]

def write_rows(column1, column2, column3):
def write_rows(column1, column2, column3, mode='a+'):
# one function for writing to csv
with open(filename, 'a+') as csvfile:
with open(filename, mode) as csvfile:
writer = csv.writer(csvfile)
writer.writerow([column1, column2, column3])

Expand Down Expand Up @@ -73,7 +73,7 @@ def get_teams(session):
filename = args.filename + '.csv'
else:
filename = args.filename
write_rows('Name','Role', 'Email')
write_rows('Name','Role', 'Email', mode='w')
for role in roles:
if role == "team_managers":
get_teams(session)
Expand Down

0 comments on commit 3d3d07b

Please sign in to comment.