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

Make any2array return empty array on empty string #930

Merged
merged 1 commit into from
Jun 27, 2018

Commits on Jun 26, 2018

  1. Make any2array return empty array on empty string

    any2array currently returns an array containing the empty string, when
    given the empty string.
    
    Example:
    ```
    any2array('').each |$e| {
      notice('I\'m not empty!')
    }
    ```
    
    This is counter intuitive, as Puppet considers the empty string as
    Strings nil value, for which the equivalent Array is the empty array.
    
    This especially apparent when doing a lookup in a map with a non
    existing key.
    
    Example:
    ```
    $config = {}
    any2array($config['test']).each |$e| {
      notice('I\'m not empty!')
    }
    ```
    
    Both these cases print the string "I'm not empty", this PR fixes that.
    Jesper Brix Rosenkilde committed Jun 26, 2018
    Configuration menu
    Copy the full SHA
    2febc34 View commit details
    Browse the repository at this point in the history