Skip to content

Commit

Permalink
NetworkService: provide a method for reseting internals
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Oct 29, 2019
1 parent 2310696 commit 1159114
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion library/network/src/modules/NetworkService.rb
Expand Up @@ -207,6 +207,12 @@ def Read
nil
end

def reset!
@initialized = false
@current_name = nil
@cached_name = nil
end

# Helper to apply a change of the network service
def EnableDisableNow
return if !Modified()
Expand All @@ -216,7 +222,7 @@ def EnableDisableNow
disable_service(current_name)
end

RunSystemCtl(BACKENDS[cached_name], "enable", force: true) if cached_name
enable_service(cached_name) if cached_name

@initialized = false
Read()
Expand Down Expand Up @@ -433,6 +439,10 @@ def disable_service(service)
RunSystemCtl(BACKENDS[service], "disable")
end

def enable_service(service)
RunSystemCtl(BACKENDS[service], "enable", force: true)
end

publish function: :Read, type: "void ()"
publish function: :Modified, type: "boolean ()"
publish function: :is_backend_available, type: "boolean (symbol)"
Expand Down

0 comments on commit 1159114

Please sign in to comment.