[Commotion-admin] [mlab-observatory] Modifying environment_bootstrap to overwrite files (with a warning) when... (#69)

Peter Boothe notifications at github.com
Thu Apr 16 16:45:54 EDT 2015


> @@ -24,6 +24,11 @@
>  
>  def setup_environment(environment_type):
>    link_name = 'static/js/observatory/js/paths.js'
> +
> +  if os.path.exists(link_name):
> +    print 'Warning: Replacing existing file: %s' % link_name
> +    os.remove(link_name)

This is worrying. "I'm screwing up your system riiiiiiiiight NOW."

Don't give a warning after you perform an irreversible action.  Either add some complication so that people have to affirmatively confirm that they want you to delete and existing file, or change the text to "Warning: replaced existing file".

I think the best thing of all would be only to remove the link if os.path.islink(link_name) returned true, and to error out otherwise.

---
Reply to this email directly or view it on GitHub:
https://github.com/opentechinstitute/mlab-observatory/pull/69/files#r28548156
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.chambana.net/pipermail/commotion-admin/attachments/20150416/4b050953/attachment.html>


More information about the Commotion-admin mailing list