Method: Specinfra::Command::Base::User.add

Defined in:
lib/specinfra/command/base/user.rb

.add(user, options) ⇒ Object


73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/specinfra/command/base/user.rb', line 73

def add(user, options)
  command = ['useradd']
  command << '-g' << escape(options[:gid])            if options[:gid]
  command << '-d' << escape(options[:home_directory]) if options[:home_directory]
  command << '-p' << escape(options[:password])       if options[:password]
  command << '-s' << escape(options[:shell])          if options[:shell]
  command << '-m' if options[:create_home]
  command << '-r' if options[:system_user]
  command << '-u' << escape(options[:uid])            if options[:uid]
  command << escape(user)
  command.join(' ')
end