Skip to content

Commit

Permalink
make rubocop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 24, 2017
1 parent 9e752d8 commit 2456ca5
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/lib/cfa/chrony_conf.rb
Expand Up @@ -127,7 +127,7 @@ def pure_pools
def pool_matcher(address)
Matcher.new do |k, v|
k == "pool[]" &&
(v.respond_to?(:value) ? v.value == address : v == address)
(v.respond_to?(:value) ? v.value == address : v == address)
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions src/lib/y2ntp_client/dialog/main.rb
Expand Up @@ -9,6 +9,7 @@

module Y2NtpClient
module Dialog
# Main entry point for Ntp Client
class Main < CWM::Dialog
def initialize
textdomain "ntp-client"
Expand Down Expand Up @@ -63,10 +64,10 @@ def hardware_clock_widgets
if Yast::NtpClient.ntp_conf.hardware_clock?
[
Label(_("Hardware clock configured as source. YaST will keep it untouched.")),
VSpacing(1),
VSpacing(1)
]
else
[ Empty() ]
[Empty()]
end
end

Expand Down
3 changes: 2 additions & 1 deletion src/lib/y2ntp_client/dialog/pool.rb
Expand Up @@ -9,6 +9,7 @@

module Y2NtpClient
module Dialog
# Dialog to add/edit ntp pool server
class Pool < CWM::Dialog
# @param pool_entry [nil, Hash]
def initialize(address = "", options = {})
Expand All @@ -34,7 +35,7 @@ def contents
HBox(
Widgets::Iburst.new(@options),
HSpacing(),
Widgets::Offline.new(@options),
Widgets::Offline.new(@options)
)
)
end
Expand Down
17 changes: 12 additions & 5 deletions src/lib/y2ntp_client/widgets/main_widgets.rb
Expand Up @@ -11,6 +11,7 @@

module Y2NtpClient
module Widgets
# Widget for netconfig policy
class PolicyCombo < CWM::ComboBox
def initialize
textdomain "ntp-client"
Expand Down Expand Up @@ -50,14 +51,15 @@ def init
end

def store
if value != Yast::NtpClient.ntp_policy
log.info "ntp policy modifed to #{value.inspect}"
Yast::NtpClient.modified = true
Yast::NtpClient.ntp_policy = value
end
return if value == Yast::NtpClient.ntp_policy

log.info "ntp policy modifed to #{value.inspect}"
Yast::NtpClient.modified = true
Yast::NtpClient.ntp_policy = value
end
end

# Widget to configure how ntp will be started
class NtpStart < CWM::RadioButtons
def initialize(replace_point)
textdomain "ntp-client"
Expand Down Expand Up @@ -108,6 +110,7 @@ def store
end
end

# Widget representing how often synchronize via cron
class SyncInterval < CWM::IntField
def initialize
textdomain "ntp-client"
Expand All @@ -130,6 +133,7 @@ def store
end
end

# Table with ntp pool servers
class ServersTable < CWM::Table
def initialize
textdomain "ntp-client"
Expand Down Expand Up @@ -170,6 +174,7 @@ def items
end
end

# Button to add ntp pool server
class AddPoolButton < CWM::PushButton
def initialize
textdomain "ntp-client"
Expand All @@ -194,6 +199,7 @@ def handle
end
end

# Button to edit ntp pool server
class EditPoolButton < CWM::PushButton
def initialize(table)
textdomain "ntp-client"
Expand All @@ -216,6 +222,7 @@ def handle
end
end

# Button to delete ntp pool server
class DeletePoolButton < CWM::PushButton
def initialize(table)
textdomain "ntp-client"
Expand Down
10 changes: 7 additions & 3 deletions src/lib/y2ntp_client/widgets/pool_widgets.rb
Expand Up @@ -6,6 +6,7 @@

module Y2NtpClient
module Widgets
# Input field with address
class PoolAddress < CWM::InputField
attr_reader :address

Expand All @@ -32,6 +33,7 @@ def store
end
end

# Button that tests if server is reachable
class TestButton < CWM::PushButton
def initialize(address_widget)
textdomain "ntp-client"
Expand All @@ -49,6 +51,7 @@ def handle
end
end

# Enable iburst option
class Iburst < CWM::CheckBox
def initialize(options)
textdomain "ntp-client"
Expand Down Expand Up @@ -78,6 +81,7 @@ def help
end
end

# Enable offline option
class Offline < CWM::CheckBox
def initialize(options)
textdomain "ntp-client"
Expand All @@ -101,9 +105,9 @@ def store
end

def help
_("<b>Start Offline</b> specifies if option offline is used. This option skip this server " \
"during start. It is useful for machine which start without network, because it speed up " \
" boot and sync when machine is connected to network.")
_("<b>Start Offline</b> specifies if option offline is used. This option skip this " \
"server during start. It is useful for machine which start without network, because " \
"it speed up boot and sync when machine is connected to network.")
end
end
end
Expand Down
1 change: 1 addition & 0 deletions src/modules/NtpClient.rb
Expand Up @@ -476,6 +476,7 @@ def Write
# @param [Hash] settings The YCP structure to be imported.
# @return [Boolean] True on success
def Import(settings)
log.info "Import with #{settings}"
# TODO: implement for chrony
@modified = true
true
Expand Down

0 comments on commit 2456ca5

Please sign in to comment.