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

Fixes #22382 - Remove ldap_filter 255 chars limit #5206

Merged
merged 1 commit into from Jan 29, 2018

Conversation

dLobatog
Copy link
Member

No description provided.

@theforeman-bot
Copy link
Member

Issues: #22382

@@ -16,12 +16,12 @@ def setup
should allow_value('').for(:ldap_filter)
should allow_value(' ').for(:ldap_filter)
should allow_value('key=value').for(:ldap_filter)
should allow_value("key=#{"a" * 256}").for(:ldap_filter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings inside interpolations.

@ares
Copy link
Member

ares commented Jan 24, 2018

LGTM, just rubocop is not happy

Copy link
Member Author

@dLobatog dLobatog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ares Rubocop is happy now, the only error is the usual Capybara::Poltergeist::StatusFailError: Request to 'http://127.0.0.1:43104/hosts' failed to reach server, check DNS and/or server status...

@ohadlevy
Copy link
Member

[test foreman]

@@ -0,0 +1,5 @@
class RemoveLimitLdapFilter < ActiveRecord::Migration[5.1]
def change
change_column 'auth_sources', :ldap_filter, :text, :limit => nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration is irreversible, you need to make an up/down migration (since it doesn't know what the old limit is)

Copy link
Member Author

@dLobatog dLobatog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tbrisker Thanks for the review - now it has a down migration which reverts to string & 255 limit if needed

end

def down
change_column 'auth_sources', :ldap_filter, :string, :limit => 255
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous schema allowed :null => true as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tbrisker I think that's by default, t.string "ldap_filter", limit: 255 - if you see schema.rb only :null => false is ever specified

Copy link
Member Author

@dLobatog dLobatog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tbrisker tbrisker merged commit 5501f0b into theforeman:develop Jan 29, 2018
@tbrisker
Copy link
Member

Thanks @dLobatog !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants