Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces in enabledLogDrivers list causes sdc-docker service to fail to start #108

Open
ynnadrules opened this issue Jan 31, 2017 · 1 comment

Comments

@ynnadrules
Copy link

Currently, enabled log drivers are parsed from a comma-separated list and placed in an array of strings. Those strings are then used as property indexes on a LOG_DRIVERS object.

This breaks if there were any spaces in the comma-separated list of drivers, "json-file, none, gets split(",") that results in ["json-file", " none"] which eventually leads to LOG_DRIVERS.hasOwnProperty(" none") and that ultimately leads to assertion failure.

Here's the snippet of code that does the validation of log drivers.

    if (config.enabledLogDrivers) {
        assert.string(config.enabledLogDrivers, 'config.enabledLogDrivers-raw');
        config.enabledLogDrivers = config.enabledLogDrivers.split(',');
    } else {
        config.enabledLogDrivers = ['json-file'];
    }
    assert.arrayOfString(config.enabledLogDrivers, 'config.enabledLogDrivers');
    config.enabledLogDrivers.forEach(function _checkLogDriver(driver) {
        assert.ok(common.LOG_DRIVERS.hasOwnProperty(driver),
            'config.enabledLogDrivers.' + driver + ' is not a valid driver');
    });

A valid fix is to trim each log driver from the comma-separated list after it's been converted into an array:

config.enabledLogDrivers = config.enabledLogDrivers.split(',').map(function(driver) { 
    return driver.trim();  
});
@ynnadrules
Copy link
Author

PR coming right up

@ynnadrules ynnadrules changed the title Spaces in config.enabledLogDrivers causes sdc-docker service to fail to start Spaces in enabledLogDrivers list causes sdc-docker service to fail to start Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant