Skip to content

Commit

Permalink
Enhance provider's paramters validation
Browse files Browse the repository at this point in the history
Fix #186
  • Loading branch information
ggiamarchi committed Jan 18, 2015
1 parent 9d90a8f commit e3cab4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/lib/vagrant-openstack-provider/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ def rsync_include(inc)
def validate(machine)
errors = _detected_errors

errors << I18n.t('vagrant_openstack.config.password_required') unless @password
errors << I18n.t('vagrant_openstack.config.username_required') unless @username
errors << I18n.t('vagrant_openstack.config.password_required') if @password.nil? || @password.empty?
errors << I18n.t('vagrant_openstack.config.username_required') if @username.nil? || @username.empty?
errors << I18n.t('vagrant_openstack.config.tenant_name_required') if @tenant_name.nil? || @tenant_name.empty?
errors << I18n.t('vagrant_openstack.config.invalid_endpoint_type') unless %w(publicURL adminURL internalURL).include?(@endpoint_type)

validate_ssh_username(machine, errors)
Expand Down
2 changes: 2 additions & 0 deletions source/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ en:
A password is required.
username_required: |-
A username is required.
tenant_name_required: |-
A tenant name is required.
invalid_uri: |-
The value for %{key} is not a valid URI: %{uri}
invalid_stack: |-
Expand Down

0 comments on commit e3cab4a

Please sign in to comment.