zalando-zmon / zmon-cli

ZMON Command Line Interface
http://zmon.readthedocs.org/en/latest/developer/zmon-cli.html
Other
9 stars 9 forks source link

ZMON CLI users on windows should be able to use the default temp directory #84

Open JonSingh opened 6 years ago

JonSingh commented 6 years ago

Currently on windows, if a user attempts to use the ZMON CLI, they'll get the following error:

Traceback (most recent call last):
  File "c:\program files\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python36\Scripts\zmon.exe\__main__.py", line 9, in <module>
  File "c:\program files\python36\lib\site-packages\zmon_cli\main.py", line 9, in main
    cli()
  File "c:\program files\python36\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\program files\python36\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\program files\python36\lib\site-packages\click\core.py", line 1134, in invoke
    Command.invoke(self, ctx)
  File "c:\program files\python36\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\program files\python36\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\program files\python36\lib\site-packages\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\program files\python36\lib\site-packages\zmon_cli\cmds\command.py", line 63, in cli
    configure_logging(logging.DEBUG if verbose else logging.INFO)
  File "c:\program files\python36\lib\site-packages\zmon_cli\config.py", line 19, in configure_logging
    format='%(asctime)s %(levelname)s %(name)s: %(message)s')
  File "c:\program files\python36\lib\logging\__init__.py", line 1781, in basicConfig
    h = FileHandler(filename, mode)
  File "c:\program files\python36\lib\logging\__init__.py", line 1030, in __init__
    StreamHandler.__init__(self, self._open())
  File "c:\program files\python36\lib\logging\__init__.py", line 1059, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\tmp\\zmon-cli.log'

This might be because the default temp directory on windows is c:\temp and not c:\tmp. Once I made a c:\tmp directory, the issue was solved.

Pre Requisites

Steps to Reproduce

  1. run pip install zmon-cli in your terminal
  2. run the zmon command, confirm that you get a list of options and that it was installed correctly.
  3. run zmon e (or any other command other than just zmon)

Observed Result The above stack trace.

Expected Result The command works normally and is able to create a log file.