Class: Y2Remote::Modes::Manager
- Defined in:
- src/lib/y2remote/modes/manager.rb
Overview
This class is reponsible of vncmanager service management
Constant Summary collapse
- SERVICE =
[String] Service name
"vncmanager".freeze
- PACKAGES =
[Array
] Packages needed by the service ["vncmanager"].freeze
Instance Method Summary collapse
-
#disable! ⇒ Boolean
Convenience method to disable the service reporting an error in case of failure.
-
#enable! ⇒ Boolean
Convenience method to enable the service reporting an error in case of failure.
-
#enabled? ⇒ Boolean
Convenience method with return whether the service is enabled.
-
#required_packages ⇒ Array<String>
Return the list of the packages needed by the service.
-
#restart ⇒ Boolean
Convenience method to restart the service.
-
#restart! ⇒ Boolean
Convenience method to restart the service reporting an error in case of failure.
-
#stop ⇒ Boolean
Convenience method to stop the service.
-
#stop! ⇒ Boolean
Convenience method to stop the service reporting an error in case of failure.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Y2Remote::Modes::Base
Instance Method Details
#disable! ⇒ Boolean
Convenience method to disable the service reporting an error in case of failure. It return false if the service is not installed.
disabled; true if disabled with success
123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'src/lib/y2remote/modes/manager.rb', line 123 def disable! return false unless installed? textdomain "network" if !Yast::Service.Disable(SERVICE) Yast::Report.Error( format(_("Disabling service %{service} has failed"), service: SERVICE) ) return false end true end |
#enable! ⇒ Boolean
Convenience method to enable the service reporting an error in case of failure. It return false if the service is not installed.
enabled; true if enabled with success
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'src/lib/y2remote/modes/manager.rb', line 104 def enable! return false unless installed? textdomain "network" if !Yast::Service.Enable(SERVICE) Yast::Report.Error( format(_("Enabling service %{service} has failed"), service: SERVICE) ) return false end true end |
#enabled? ⇒ Boolean
Convenience method with return whether the service is enabled
41 42 43 |
# File 'src/lib/y2remote/modes/manager.rb', line 41 def enabled? Yast::Service.Enabled(SERVICE) end |
#required_packages ⇒ Array<String>
Return the list of the packages needed by the service
34 35 36 |
# File 'src/lib/y2remote/modes/manager.rb', line 34 def required_packages PACKAGES end |
#restart ⇒ Boolean
Convenience method to restart the service. It return false if the service is not installed.
restarted; true if restarted with success
77 78 79 80 81 |
# File 'src/lib/y2remote/modes/manager.rb', line 77 def restart return false unless installed? Yast::Service.Restart(SERVICE) end |
#restart! ⇒ Boolean
Convenience method to restart the service reporting an error in case of failure. It return false if the service is not installed.
restarted; true if restarted with success
88 89 90 91 92 93 94 95 96 97 |
# File 'src/lib/y2remote/modes/manager.rb', line 88 def restart! return false unless installed? if !Yast::Service.Restart(SERVICE) Yast::Report.Error(Yast::Message.CannotRestartService(SERVICE)) return false end true end |
#stop ⇒ Boolean
Convenience method to stop the service. It return false if the service is not installed.
stopped; true if stopped with success
50 51 52 53 54 |
# File 'src/lib/y2remote/modes/manager.rb', line 50 def stop return false unless installed? Yast::Service.Stop(SERVICE) end |
#stop! ⇒ Boolean
Convenience method to stop the service reporting an error in case of failure. It return false if the service is not installed.
stopped; true if stopped with success
61 62 63 64 65 66 67 68 69 70 |
# File 'src/lib/y2remote/modes/manager.rb', line 61 def stop! return false unless installed? if !Yast::Service.Stop(SERVICE) Yast::Report.Error(Yast::Message.CannotStopService(SERVICE)) return false end true end |