Sha256: c749255f27a67dbc1537983b3dc88606e1211e411a37abfd17dcc6f63ba8e720

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

class Specinfra::Command::Base::Group < Specinfra::Command::Base
  class << self
    def check_exists(group)
      "getent group #{escape(group)}"
    end

    def check_has_gid(group, gid)
      "getent group #{escape(group)} | cut -f 3 -d ':' | grep -w -- #{escape(gid)}"
    end

    def get_gid(group)
      "getent group #{escape(group)} | cut -f 3 -d ':'"
    end

    def update_gid(group, gid)
      "groupmod -g #{escape(gid)} #{escape(group)}"
    end

    def add(group, options)
      command = ['groupadd']
      command << '-g' << escape(options[:gid])  if options[:gid]
      command << '-r' if options[:system_group]
      command << escape(group)
      command.join(' ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
specinfra-2.80.0 lib/specinfra/command/base/group.rb