Sha256: b89ad130215a77a605f33213cf5331f674feaa527d691ac552e8284ced2f0069

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

module Caco::Debian
  class UserHome < Trailblazer::Operation
    step Subprocess(Caco::FileReader),
      input: ->(_ctx, **) {{
        path: "/etc/passwd",
      }},
      output: { output: :passwd_output }
    step :find_user_home

    def find_user_home(ctx, user:, passwd_output:, **)
      match = passwd_output.match(/^#{user}:[^:]*:[^:]*:[^:]*:[^:]*:([^:]*):.*$/)
      return false unless match

      ctx[:user_home] = match[1]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caco-0.1.0 lib/caco/debian/user_home.rb