Module: ComputeUnit::Utils
- Included in:
- Device
- Defined in:
- lib/compute_unit/utils.rb
Class Method Summary collapse
-
.check_for_root ⇒ Boolean
-
returns true if user is root.
-
-
.root? ⇒ Boolean
-
return true if the current user is root.
-
Instance Method Summary collapse
-
#root? ⇒ Boolean
-
return true if the current user is root.
-
Class Method Details
.check_for_root ⇒ Boolean
Returns - returns true if user is root.
19 20 21 22 23 |
# File 'lib/compute_unit/utils.rb', line 19 def check_for_root raise Exceptions::NoPermission.new('Please run this command as root or with sudo') unless root? root? end |
.root? ⇒ Boolean
Returns - return true if the current user is root.
8 9 10 |
# File 'lib/compute_unit/utils.rb', line 8 def self.root? ::Etc.getpwuid.name == 'root' end |
Instance Method Details
#root? ⇒ Boolean
Returns - return true if the current user is root.
13 14 15 |
# File 'lib/compute_unit/utils.rb', line 13 def root? ::Etc.getpwuid.name == 'root' end |