Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Layout/ParameterAlignment:
Layout/DotPosition:
Enabled: false

Layout/EmptyLineAfterGuardClause:
Enabled: false

Layout/FirstArgumentIndentation:
EnforcedStyle: consistent

Expand Down Expand Up @@ -115,6 +118,10 @@ Style/PreferredHashMethods:
Style/StringLiterals:
Enabled: false

Style/SymbolArray:
EnforcedStyle: brackets
MinSize: 1

Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex

Expand Down
94 changes: 0 additions & 94 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,6 @@
Layout/CaseIndentation:
Enabled: false

# Offense count: 123
# Cop supports --auto-correct.
Layout/EmptyLineAfterGuardClause:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Layout/EmptyLinesAroundArguments:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent

# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Layout/FirstHashElementIndentation:
Enabled: false

# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineArrayBraceLayout:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
Expand All @@ -65,28 +34,6 @@ Layout/MultilineMethodCallBraceLayout:
Layout/MultilineOperationIndentation:
Enabled: false

# Offense count: 45
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: space, no_space
Layout/SpaceAroundEqualsInParameterDefault:
Enabled: false

# Offense count: 136
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Layout/SpaceAroundOperators:
Enabled: false

# Offense count: 20
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBrackets: space, no_space
Layout/SpaceInsideArrayLiteralBrackets:
Enabled: false

# Offense count: 419
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
Expand Down Expand Up @@ -193,18 +140,6 @@ Style/ClassAndModuleChildren:
Style/ClassVars:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
Style/ColonMethodCall:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerBackticks.
# SupportedStyles: backticks, percent_x, mixed
Style/CommandLiteral:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Keywords.
Expand All @@ -216,27 +151,10 @@ Style/CommentAnnotation:
Style/DoubleNegation:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
Style/EmptyLiteral:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Enabled: false

# Offense count: 1
Style/EvalWithLocation:
Enabled: false

# Offense count: 34
# Cop supports --auto-correct.
Style/ExpandPathArguments:
Enabled: false

# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
Expand Down Expand Up @@ -335,11 +253,6 @@ Style/RandomWithOffset:
Style/RedundantPercentQ:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
Expand All @@ -366,13 +279,6 @@ Style/RescueStandardError:
Style/SignalException:
Enabled: false

# Offense count: 50
# Cop supports --auto-correct.
# Configuration parameters: MinSize.
# SupportedStyles: percent, brackets
Style/SymbolArray:
EnforcedStyle: brackets

# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: AllowNamedUnderscoreVariables.
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ gemspec
gem 'concurrent-ruby', '~> 1.0', require: 'concurrent'

Dir["#{File.dirname(__FILE__)}/bundler.d/*.rb"].each do |bundle|
self.instance_eval(Bundler.read_file(bundle))
instance_eval(Bundler.read_file(bundle))
end
2 changes: 1 addition & 1 deletion bin/smart-proxy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

$LOAD_PATH.unshift(*Dir[File.expand_path("../../lib", __FILE__), File.expand_path("../../modules", __FILE__)])
$LOAD_PATH.unshift(*Dir[File.expand_path('../lib', __dir__), File.expand_path('../modules', __dir__)])

require 'smart_proxy_main'
Proxy::Launcher.new.launch
2 changes: 1 addition & 1 deletion config.ru
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$LOAD_PATH.unshift *Dir[File.expand_path("../lib", __FILE__), File.expand_path("../modules", __FILE__)]
$LOAD_PATH.unshift *Dir[File.expand_path('lib', __dir__), File.expand_path('modules', __dir__)]

require 'smart_proxy_main'
::Proxy::PluginInitializer.new(::Proxy::Plugins.instance).initialize_plugins
Expand Down
2 changes: 1 addition & 1 deletion extra/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

cmd=`git log --pretty='format:%ci___%an <%ae>___%s'`
cmd = `git log --pretty='format:%ci___%an <%ae>___%s'`

list = {}
list_order = []
Expand Down
2 changes: 1 addition & 1 deletion extra/dhcpd_config_check.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$LOAD_PATH.unshift(*Dir[File.expand_path("../../modules", __FILE__)])
$LOAD_PATH.unshift(*Dir[File.expand_path('../modules', __dir__)])

require 'English'
require 'optparse'
Expand Down
48 changes: 24 additions & 24 deletions extra/migrations/20150327000000_migrate_monolithic_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,34 @@ def migrate
end

def modules
[ :settings, :tftp, :dns, :dhcp, :puppet, :puppetca, :bmc, :chef, :realm ]
[:settings, :tftp, :dns, :dhcp, :puppet, :puppetca, :bmc, :chef, :realm]
end

def known_options
{
:daemon => :settings,
:daemon_pid => :settings,
:log_file => :settings,
:log_level => :settings,
:port => :settings,
:ssl_ca_file => :settings,
:ssl_certificate => :settings,
:ssl_private_key => :settings,
:trusted_hosts => :settings,
:virsh_network => :settings,
:foreman_url => :settings,
:settings_directory => :settings,
:http_port => :settings,
:https_port => :settings,
:use_cache => :settings,
:cache_location => :settings,
:puppetca_use_sudo => :puppetca,
:puppetdir => :puppetca,
:ssldir => :puppetca,
:sudo_command => :puppetca,
:customrun_args => :puppet,
:customrun_cmd => :puppet,
:freeipa_remove_dns => :realm,
:daemon => :settings,
:daemon_pid => :settings,
:log_file => :settings,
:log_level => :settings,
:port => :settings,
:ssl_ca_file => :settings,
:ssl_certificate => :settings,
:ssl_private_key => :settings,
:trusted_hosts => :settings,
:virsh_network => :settings,
:foreman_url => :settings,
:settings_directory => :settings,
:http_port => :settings,
:https_port => :settings,
:use_cache => :settings,
:cache_location => :settings,
:puppetca_use_sudo => :puppetca,
:puppetdir => :puppetca,
:ssldir => :puppetca,
:sudo_command => :puppetca,
:customrun_args => :puppet,
:customrun_cmd => :puppet,
:freeipa_remove_dns => :realm,
}
end

Expand Down
16 changes: 8 additions & 8 deletions extra/migrations/20150611000000_migrate_dns_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ def migrate

def known_dns_options
{
:enabled => [:dns],
:dns_provider => [:dns],
:dns_key => [:dns_nsupdate],
:dns_server => [:dns_nsupdate, :dns_nsupdate_gss, :dns_dnscmd],
:dns_ttl => [:dns],
:dns_tsig_keytab => [:dns_nsupdate_gss],
:dns_tsig_principal => [:dns_nsupdate_gss],
:enabled => [:dns],
:dns_provider => [:dns],
:dns_key => [:dns_nsupdate],
:dns_server => [:dns_nsupdate, :dns_nsupdate_gss, :dns_dnscmd],
:dns_ttl => [:dns],
:dns_tsig_keytab => [:dns_nsupdate_gss],
:dns_tsig_principal => [:dns_nsupdate_gss],
}
end

def migrate_dns_configuration(data)
output = Hash.new { |h, k| h[k] = Hash.new }
output = Hash.new { |h, k| h[k] = {} }

data.each do |option, value|
if known_dns_options.include? option
Expand Down
20 changes: 10 additions & 10 deletions extra/migrations/20150826000000_migrate_dhcp_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

class MigrateDhcpSettings < ::Proxy::Migration
KNOWN_PARAMETERS = {
:enabled => [:dhcp, :enabled],
:dhcp_vendor => [:dhcp, :use_provider, :old_provider_name_to_new],
:dhcp_subnets => [:dhcp, :subnets],
:dhcp_config => [:dhcp_isc, :config],
:dhcp_leases => [:dhcp_isc, :leases],
:dhcp_key_name => [:dhcp_isc, :key_name],
:dhcp_key_secret => [:dhcp_isc, :key_secret],
:dhcp_omapi_port => [:dhcp_isc, :omapi_port],
:dhcp_server => [:dhcp, :server],
:enabled => [:dhcp, :enabled],
:dhcp_vendor => [:dhcp, :use_provider, :old_provider_name_to_new],
:dhcp_subnets => [:dhcp, :subnets],
:dhcp_config => [:dhcp_isc, :config],
:dhcp_leases => [:dhcp_isc, :leases],
:dhcp_key_name => [:dhcp_isc, :key_name],
:dhcp_key_secret => [:dhcp_isc, :key_secret],
:dhcp_omapi_port => [:dhcp_isc, :omapi_port],
:dhcp_server => [:dhcp, :server],
}

def remap_parameter(aparameter, avalue)
Expand Down Expand Up @@ -42,7 +42,7 @@ def old_provider_name_to_new(aname)
end

def migrate_dhcp_configuration(to_migrate)
migrated = Hash.new { |h, k| h[k] = Hash.new }
migrated = Hash.new { |h, k| h[k] = {} }
to_migrate.each do |option, value|
module_name, parameter_name, parameter_value = remap_parameter(option, value)
migrated[module_name][parameter_name] = parameter_value
Expand Down
34 changes: 17 additions & 17 deletions extra/migrations/20160413000000_migrate_puppet_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

class MigratePuppetSettings < ::Proxy::Migration
KNOWN_PARAMETERS = {
:enabled => [:puppet, :enabled],
:puppet_provider => [:puppet, :use_provider],
:puppet_user => [:puppet_proxy_puppetrun, :puppet_proxy_mcollective, :puppet_user],
:salt_puppetrun_cmd => [:puppet_proxy_salt, :command],
:customrun_cmd => [:puppet_proxy_customrun, :command],
:customrun_args => [:puppet_proxy_customrun, :command_arguments],
:puppet_url => [:puppet_proxy_puppet_api, :puppet_url],
:puppet_ssl_ca => [:puppet_proxy_puppet_api, :puppet_ssl_ca],
:puppet_ssl_cert => [:puppet_proxy_puppet_api, :puppet_ssl_cert],
:puppet_ssl_key => [:puppet_proxy_puppet_api, :puppet_ssl_key],
:puppetssh_sudo => [:puppet_proxy_ssh, :use_sudo],
:puppetssh_command => [:puppet_proxy_ssh, :command],
:puppetssh_wait => [:puppet_proxy_ssh, :wait],
:puppetssh_user => [:puppet_proxy_ssh, :user],
:puppetssh_keyfile => [:puppet_proxy_ssh, :keyfile],
:mcollective_user => [:puppet_proxy_mcollective, :user],
:enabled => [:puppet, :enabled],
:puppet_provider => [:puppet, :use_provider],
:puppet_user => [:puppet_proxy_puppetrun, :puppet_proxy_mcollective, :puppet_user],
:salt_puppetrun_cmd => [:puppet_proxy_salt, :command],
:customrun_cmd => [:puppet_proxy_customrun, :command],
:customrun_args => [:puppet_proxy_customrun, :command_arguments],
:puppet_url => [:puppet_proxy_puppet_api, :puppet_url],
:puppet_ssl_ca => [:puppet_proxy_puppet_api, :puppet_ssl_ca],
:puppet_ssl_cert => [:puppet_proxy_puppet_api, :puppet_ssl_cert],
:puppet_ssl_key => [:puppet_proxy_puppet_api, :puppet_ssl_key],
:puppetssh_sudo => [:puppet_proxy_ssh, :use_sudo],
:puppetssh_command => [:puppet_proxy_ssh, :command],
:puppetssh_wait => [:puppet_proxy_ssh, :wait],
:puppetssh_user => [:puppet_proxy_ssh, :user],
:puppetssh_keyfile => [:puppet_proxy_ssh, :keyfile],
:mcollective_user => [:puppet_proxy_mcollective, :user],
}

def migrate
Expand Down Expand Up @@ -52,7 +52,7 @@ def old_provider_name_to_new(aname)
end

def migrate_puppet_configuration(to_migrate)
migrated = Hash.new { |h, k| h[k] = Hash.new }
migrated = Hash.new { |h, k| h[k] = {} }
to_migrate.each do |option, value|
remap_parameter(option, value).each { |module_name, parameter_name, parameter_value| migrated[module_name][parameter_name] = parameter_value }
end
Expand Down
12 changes: 6 additions & 6 deletions extra/migrations/20161209000000_migrate_realm_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

class MigrateRealmSettings < ::Proxy::Migration
KNOWN_PARAMETERS = {
:enabled => [:realm, :enabled],
:realm_provider => [:realm, :use_provider],
:realm_keytab => [:realm_freeipa, :keytab_path],
:realm_principal => [:realm_freeipa, :principal],
:freeipa_remove_dns => [:realm_freeipa, :remove_dns],
:enabled => [:realm, :enabled],
:realm_provider => [:realm, :use_provider],
:realm_keytab => [:realm_freeipa, :keytab_path],
:realm_principal => [:realm_freeipa, :principal],
:freeipa_remove_dns => [:realm_freeipa, :remove_dns],
}

def migrate
Expand All @@ -29,7 +29,7 @@ def remap_parameter(aparameter, avalue)
end

def migrate_realm_configuration(to_migrate)
migrated = Hash.new { |h, k| h[k] = Hash.new }
migrated = Hash.new { |h, k| h[k] = {} }
to_migrate.each do |option, value|
module_name, parameter_name, parameter_value = remap_parameter(option, value)
migrated[module_name][parameter_name] = parameter_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def remap_parameter(aparameter, avalue)
end

def migrate_autosign_configuration(to_migrate)
migrated = Hash.new { |h, k| h[k] = Hash.new }
migrated = Hash.new { |h, k| h[k] = {} }
to_migrate.each do |option, value|
module_name, parameter_name, parameter_value = remap_parameter(option, value)
migrated[module_name][parameter_name] = parameter_value
Expand Down
Loading