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

[Breaking] Update signature of Driver.required_config block. #172

Merged
merged 1 commit into from
Jul 22, 2013

Conversation

fnichol
Copy link
Contributor

@fnichol fnichol commented Jul 22, 2013

Note: this change does not appear to affect any drivers currently in the wild (using GitHub code search)


Now a reference to the driver object will be passed into the block which
helps generate a better default error message and allows for more
complex validation logic (using the new computed defaults).

Before this commit, a Driver author could have custom validation logic
for an attribute with the following:

class Kitchen::Driver::SharkCloud < Kitchen::Driver::SSHBase

  required_config :fonzie do |attribute, value|
    # custom logic...
  end
end

With this change you need to pass in one additional argument:

class Kitchen::Driver::SharkCloud < Kitchen::Driver::SSHBase

  required_config :fonzie do |attribute, value, driver|
    # custom logic...
  end
end

Now a reference to the driver object will be passed into the block which
helps generate a better default error message and allows for more
complex validation logic (using the new computed defaults).

Before this commit, a Driver author could have custom validation logic
for an attribute with the following:

    class Kitchen::Driver::SharkCloud < Kitchen::Driver::SSHBase

      required_config :fonzie do |attribute, value|
        # custom logic...
      end
    end

With this change you need to pass in one additional argument:

    class Kitchen::Driver::SharkCloud < Kitchen::Driver::SSHBase

      required_config :fonzie do |attribute, value, driver|
        # custom logic...
      end
    end
fnichol added a commit that referenced this pull request Jul 22, 2013
[Breaking] Update signature of Driver.required_config block.
@fnichol fnichol merged commit d6db5da into master Jul 22, 2013
@fnichol fnichol deleted the driver-required-config-update branch July 22, 2013 23:10
@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant