Page MenuHomePhabricator

Cumin: "No such file or directory" when log_file has no directory
Closed, ResolvedPublic


Cumin version3.0.1
Python version3.6.1
Operating SystemOSX

Cumin yields a No such file or directory: '' when the log_file directive in config.yaml points to a file without a directory

Configuration and aliases (REMOVE ANY PRIVATE INFORMATION):

transport: clustershell  # Default transport to use, can be overriden by command line argument
log_file: cumin.log  # Absolute or relative path for the log file
# If set, use this backend to parse the query first and only if it fails, fallback to parse it with the general
# multi-query grammar [optional]
default_backend: direct

# Environment variables that will be defined [optional]
  ENV_VARIABLE: env_value

# Backend-specific configurations [optional]
  host: redacted
  port: 1234
  api_version: 4  # Supported versions are v3 and v4. If not specified, v4 will be used.
  urllib3_disable_warnings:  # List of Python urllib3 exceptions to ignore
    - SubjectAltNameWarning

  files:  # List of SSH known hosts files to load
    - /path/to/known_hosts

# Transport-specific configuration
  ssh_options:  # SSH options passed to ClusterShell [optional]
    - 'some_option'
  fanout: 16  # Max size of the sliding window of concurrent workers active at any given time [optional, default: 64]

Steps to reproduce:

  1. Copy/paste the config.yaml file from the documentation
  2. Change logs/cumin.log to cumin.log
  3. Run cumin with any option:
$ sudo cumin -c x.yaml  'A: x' x
Caught FileNotFoundError exception: [Errno 2] No such file or directory: ''

Event Timeline

Volans triaged this task as Medium priority.

@aggro Thanks a lot for reporting the issue and I can confirm it.
In effect there is a missing check on the log path once has been split from the filename. I'm sending a fix shortly.

Change 415587 had a related patch set uploaded (by Volans; owner: Volans):
[operations/software/cumin@master] CLI: fix setup_logging() when without path

Change 415587 merged by jenkins-bot:
[operations/software/cumin@master] CLI: fix setup_logging() when without path

Volans removed a project: Patch-For-Review.

@aggro the fix has been merged into master and will be included in the next cumin release.
For now as a quick workaround to generate the log file in the current directory you could use ./cumin.log in the configuration file instead of just cumin.log.
Thanks again for reporting the issue.