integrations/trello: Stop logging to CSV file in Trello script.

The information logged to the CSV file is largely redundant, since
the ID of the webhook is already printed to the screen once a
webhook is setup correctly.

Since this is a script that the user is required to run
once, we should minimize its reliance on external files as much
as possible. This makes it easier to run the script when one
is SSH-ing into a server and doesn't really care about where
the script lives, for instance.
This commit is contained in:
Eeshan Garg 2018-09-14 17:48:54 -02:30
parent 1de6613825
commit 5210e79dbd
2 changed files with 1 additions and 27 deletions

View file

@ -81,24 +81,6 @@ def get_webhook_id(options: argparse.Namespace, id_model: str) -> str:
return webhook_info_json['id'] return webhook_info_json['id']
def log_webhook_info(options: argparse.Namespace, id_webhook: str) -> None:
"""log_webhook_info
Log webhook info in csv file for possible future use
:options: argparse.Namespace arguments
:id_webhook: str Trello webhook id
"""
with open('zulip_trello_webhooks.csv', 'a') as webhooks_file:
webhooks_file.write(
'{},{}\n'.format(
options.trello_board_name,
id_webhook
)
)
def create_webhook(options: argparse.Namespace) -> None: def create_webhook(options: argparse.Namespace) -> None:
"""create_webhook """create_webhook
@ -119,17 +101,10 @@ def create_webhook(options: argparse.Namespace) -> None:
id_webhook = get_webhook_id(options, id_model) id_webhook = get_webhook_id(options, id_model)
if id_webhook: if id_webhook:
print('Success! The webhook id is', id_webhook) print('Success! The webhook ID is', id_webhook)
# The webhook was successfully created,
# Log informations for possible future needs
print('Logging webhook information')
log_webhook_info(options, id_webhook)
print('Success! The webhook for the {} Trello board was successfully created.'.format( print('Success! The webhook for the {} Trello board was successfully created.'.format(
options.trello_board_name)) options.trello_board_name))
print('\nYou can find the webhooks information in the zulip_trello_webhooks.csv file.')
def main() -> None: def main() -> None:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()

View file

@ -1 +0,0 @@
trello_board_name,id_webhook
1 trello_board_name id_webhook