Sha256: 8462b125fb8357f399f7e423a1bb4ab045f9df6fc975658285e79da9755b190f
Contents?: true
Size: 924 Bytes
Versions: 1
Compression:
Stored size: 924 Bytes
Contents
module Caco::Postgres class UserCreate < Trailblazer::Operation step Subprocess(Caco::Postgres::Sql), input: ->(_ctx, user:, **) {{ sql: "select usename from pg_user where usename='#{user}';", }}, id: :sql_find_user step ->(_ctx, output:, user:, **) { output.match?(/^\s#{user}$/) }, Output(:success) => End(:success), Output(:failure) => Track(:success), id: :verify_user_exists step Subprocess(Caco::Executer), input: ->(ctx, user:, **) {{ command: "createuser -e #{user} #{ctx[:additional_args]}", }}, id: :create_user step Subprocess(Caco::Postgres::UserChangePassword), input: ->(ctx, user:, password:, **) {{ user: user, password: password, }}, id: :user_change_password step ->(ctx, **) { ctx[:created] = ctx[:changed] = true }, id: :mark_created end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caco-0.1.0 | lib/caco/postgres/user_create.rb |