eyre.users

gather-script

(gather-script shell-type)

Returns the embedded collection script for shell-type. Falls back to the POSIX script when no specific script is available.

gather-users

(gather-users {:keys [exec shell]})

Gathers identity and group membership facts for the user the executor runs as on the host reachable via exec.

Arguments

Takes a map with:

  • :exec - an executor function that runs a script string on the target host and returns {:exit int :out string :err string}.
  • :shell - the shell map returned by eyre.shell/gather-shell; its :type selects which embedded collection script is run. Shells without a specific script fall back to the POSIX script.

Returns

A map with:

  • :uid - {:id :name} for the executing user.
  • :gid - {:id :name} for the user’s primary group, or nil on Windows.
  • :groups - vector of {:id :name} maps, one per group the user belongs to (including the primary group).
  • :group-ids - set of the :id values from :groups.
  • :group-names - set of the :name values from :groups.

On unix (data from id) ids are integers and names are strings:

{:uid {:id 1000 :name "crispin"}
 :gid {:id 1000 :name "crispin"}
 :groups [{:id 1000 :name "crispin"} {:id 998 :name "wheel"}]
 :group-ids #{1000 998}
 :group-names #{"crispin" "wheel"}}

On Windows (:powershell / :cmd-exe shells) there is no uid/gid concept; instead :uid and each :groups entry carry the account name and its SID string, and :gid is nil:

{:uid {:name "HOST\\user" :id "S-1-5-21-..."}
 :gid nil
 :groups [{:name "Administrators" :id "S-1-5-32-544"} ...]
 :group-ids #{"S-1-5-32-544" ...}
 :group-names #{"Administrators" ...}}

process-users

(process-users shell-type sections)

Processes parsed users collection sections into a users facts map.