Class: DanarchyDeploy::Groups

Inherits:
Object
  • Object
show all
Defined in:
lib/danarchy_deploy/groups.rb

Class Method Summary collapse

Class Method Details

.new(deployment, options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/danarchy_deploy/groups.rb', line 4

def self.new(deployment, options)
  return deployment if ! deployment[:groups]
  puts "\n" + self.name
  (groupadd_result, groupdel_result) = nil

  deployment[:groups].each do |group|
    puts " > Checking if group '#{group[:groupname]}' already exists."
    groupcheck_result = groupcheck(group, options)

    if groupcheck_result[:stdout]
      puts "   - Group: #{group[:groupname]} already exists!"
    else
      puts "   |+ Adding group: #{group[:groupname]}"
      groupadd_result = groupadd(group, options)
    end
  end

  deployment
end