Sha256: d79b24cbff7a495d220095789ff5981aefaacec2c389cc5d7f071ba2d7f65d6e

Contents?: true

Size: 706 Bytes

Versions: 148

Compression:

Stored size: 706 Bytes

Contents

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

      def parse(cmd_ret)
        users = {}
        lines = cmd_ret.split(/\n/)
        lines.each do |line|
          user = line.split(':')
          users[user[0]] = {
            'name' => user[0],
            'uid' => user[2],
            'gid' => user[3],
            'gecos' => user[4],
            'directory' => user[5],
            'shell' => user[6]
          }
        end
        users
      end
    end
  end
end

Version data entries

148 entries across 148 versions & 2 rubygems

Version Path
specinfra-2.82.25 lib/specinfra/host_inventory/user.rb
specinfra-2.82.24 lib/specinfra/host_inventory/user.rb
specinfra-2.82.23 lib/specinfra/host_inventory/user.rb
specinfra-2.82.22 lib/specinfra/host_inventory/user.rb
specinfra-2.82.21 lib/specinfra/host_inventory/user.rb
specinfra-2.82.20 lib/specinfra/host_inventory/user.rb
specinfra-2.82.19 lib/specinfra/host_inventory/user.rb
specinfra-2.82.18 lib/specinfra/host_inventory/user.rb
specinfra-2.82.17 lib/specinfra/host_inventory/user.rb
specinfra-2.82.16 lib/specinfra/host_inventory/user.rb
specinfra-2.82.15 lib/specinfra/host_inventory/user.rb
specinfra-2.82.14 lib/specinfra/host_inventory/user.rb
specinfra-2.82.13 lib/specinfra/host_inventory/user.rb
specinfra-2.82.12 lib/specinfra/host_inventory/user.rb
specinfra-2.82.11 lib/specinfra/host_inventory/user.rb
specinfra-2.82.10 lib/specinfra/host_inventory/user.rb
specinfra-2.82.9 lib/specinfra/host_inventory/user.rb
specinfra-2.82.8 lib/specinfra/host_inventory/user.rb
specinfra-2.82.7 lib/specinfra/host_inventory/user.rb
specinfra-2.82.6 lib/specinfra/host_inventory/user.rb