Sha256: 2a8ecd23dd39c458cb3b4e3a6dfe20f340ba307db249fd1183a46f97d58830d9
Contents?: true
Size: 764 Bytes
Versions: 4
Compression:
Stored size: 764 Bytes
Contents
module Resource class User < Base block_attr :password, :uid, :gid, :shell, :action, :username def initialize username, &block set_base_defaults @username = username @shell = '/bin/bash' self.instance_eval(&block) end def run Execution.block 'Creating new user', @username, @owner do |b| b.always_run @always_run users = `cat /etc/passwd | grep "/home" |cut -d: -f1` users = users.scan(/[a-zA-Z\-_]+/) if users.include? @username Output.warn 'Aborted, I think this user already exists', users.inspect else b.run "useradd -b /home -u #{@uid} -s #{@shell} -g #{@username} -m -k /home/#{@username} #{@username}" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
atesta-0.0.4 | lib/resource/user.rb |
atesta-0.0.3 | lib/resource/user.rb |
atesta-0.0.2 | lib/resource/user.rb |
atesta-0.0.1 | lib/resource/user.rb |