Class: LoomExt::CoreMods::User

Inherits:
Loom::Mods::Module show all
Defined in:
lib/loomext/coremods/user.rb

Defined Under Namespace

Modules: Actions

Constant Summary collapse

SudoersDNoExistError =
Class.new Loom::Mods::ModActionError
SudoersDNotIncluded =
Class.new Loom::Mods::ModActionError
SUDOERS_FILE =
"/etc/sudoers"
SUDOERS_DIR =
"/etc/sudoers.d"
LOOM_SUDOERS_FILE =
SUDOERS_DIR + "/90-loom-sudoers"

Instance Attribute Summary

Attributes inherited from Loom::Mods::Module

#action_proxy, #loom, #loom_config, #mods, #shell

Instance Method Summary collapse

Methods inherited from Loom::Mods::Module

action_proxy, bind_action, #execute, import_actions, #init_action, #initialize, register_mod, required_commands

Constructor Details

This class inherits a constructor from Loom::Mods::Module

Instance Method Details

#includes_sudoers?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/loomext/coremods/user.rb', line 18

def includes_sudoers?
  shell.test :grep, :"-e", :"'^#includedir #{SUDOERS_DIR}$'", SUDOERS_FILE
end

#sudoersd_exists?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/loomext/coremods/user.rb', line 22

def sudoersd_exists?
  shell.test :test, %Q[-d #{SUDOERS_DIR}]
end

#user_exists?(user) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/loomext/coremods/user.rb', line 14

def user_exists?(user)
  shell.test :getent, :passwd, user
end