Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 2, 2018
1 parent e3289c1 commit a9aa081
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/modules/TftpServer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ def main
# Required packages for operation
@required_packages = [PACKAGE_NAME]

# tftpd socket
@socket = SystemdSocket.find(SOCKET_NAME)
# if socket start tftp
@start = false

Expand All @@ -68,6 +66,11 @@ def firewall
@firewall ||= Y2Firewall::Firewalld.instance
end

# systemd socket for tfpt
def socket
@socket ||= SystemdSocket.find!(SOCKET_NAME)
end

# Returns true if the settings were modified
# @return settings were modified
def GetModified
Expand Down Expand Up @@ -104,8 +107,7 @@ def Read
@directory = @sysconfig.directory

# force find of socket. It can happen if we need to install package first
@socket = SystemdSocket.find!(SOCKET_NAME)
@start = @socket.enabled?
@start = socket.enabled?

# TODO only when we have our own Progress
#boolean progress_orig = Progress::set (false);
Expand Down Expand Up @@ -154,11 +156,11 @@ def WriteOnly

# enable and (re)start xinetd
if @start
@socket.enable
@socket.start
socket.enable
socket.start
else
@socket.disable
@socket.stop
socket.disable
socket.stop
end

# TODO only when we have our own Progress
Expand Down

0 comments on commit a9aa081

Please sign in to comment.