Sha256: 17dc11fa8fbcd775522aef986e1cdf0105c9f2b3235a346a93133753864348c2

Contents?: true

Size: 767 Bytes

Versions: 148

Compression:

Stored size: 767 Bytes

Contents

module Specinfra
  class HostInventory
    class Group < Base
      def get
        cmd = backend.command.get(:get_inventory_group)
        ret = backend.run_command(cmd)
        if ret.exit_status == 0
          parse(ret.stdout)
        else
          nil
        end
      end

      def parse(cmd_ret)
        groups = {}
        lines = cmd_ret.split(/\n/)
        lines.each do |line|
          group = line.split(':')
          members = if group[3]
                      group[3].split(',')
                    else
                      []
                    end
          groups[group[0]] = {
            'name' => group[0],
            'gid' => group[2],
            'members' => members
          }
        end
        groups
      end
    end
  end
end

Version data entries

148 entries across 148 versions & 2 rubygems

Version Path
specinfra-2.70.2 lib/specinfra/host_inventory/group.rb
specinfra-2.70.1 lib/specinfra/host_inventory/group.rb
specinfra-2.70.0 lib/specinfra/host_inventory/group.rb
specinfra-2.69.0 lib/specinfra/host_inventory/group.rb
specinfra-2.68.2 lib/specinfra/host_inventory/group.rb
specinfra-2.68.1 lib/specinfra/host_inventory/group.rb
specinfra-2.68.0 lib/specinfra/host_inventory/group.rb
specinfra-2.67.10 lib/specinfra/host_inventory/group.rb
specinfra-2.67.9 lib/specinfra/host_inventory/group.rb
specinfra-2.67.8 lib/specinfra/host_inventory/group.rb
specinfra-2.67.7 lib/specinfra/host_inventory/group.rb
specinfra-2.67.6 lib/specinfra/host_inventory/group.rb
specinfra-2.67.5 lib/specinfra/host_inventory/group.rb
specinfra-2.67.3 lib/specinfra/host_inventory/group.rb
specinfra-2.67.2 lib/specinfra/host_inventory/group.rb
specinfra-2.67.1 lib/specinfra/host_inventory/group.rb
specinfra-2.67.0 lib/specinfra/host_inventory/group.rb
specinfra-2.66.9 lib/specinfra/host_inventory/group.rb
specinfra-2.66.8 lib/specinfra/host_inventory/group.rb
specinfra-2.66.7 lib/specinfra/host_inventory/group.rb