Class: Koch::User

Inherits:
Resource show all
Defined in:
lib/koch/user.rb

Overview

Represents a Linux user

Instance Attribute Summary

Attributes inherited from Resource

#changed, #name

Instance Method Summary collapse

Methods inherited from Resource

dsl_writer, #initialize

Constructor Details

This class inherits a constructor from Koch::Resource

Instance Method Details

#apply!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/koch/user.rb', line 10

def apply!
  if exist? name
    debug "User #{name} already exists"
    return
  end

  @changed = true

  params = +""
  params << " --uid #{uid}" if uid
  params << " --gid #{gid}" if gid
  params << " --home-dir #{home}" if home
  params << " --shell #{shell}" if shell
  params << " --system" if system_user

  maybe "useradd#{params} #{name}"
end