[tarantool-patches] Re: [PATCH 2/3] Allow use existing user
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sat Jun 23 01:12:00 MSK 2018
Thanks for the patch! See 1 comment below.
On 23/06/2018 00:43, AKhatskevich wrote:
> This commit allows to create vshard user outside of vshard.
>
> This feature is tested in the next commit (destroy).
>
> Closes #52
> ---
> vshard/storage/init.lua | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/vshard/storage/init.lua b/vshard/storage/init.lua
> index 57076e1..059e705 100644
> --- a/vshard/storage/init.lua
> +++ b/vshard/storage/init.lua
> @@ -138,11 +138,19 @@ end
> --------------------------------------------------------------------------------
> -- Schema
> --------------------------------------------------------------------------------
> +local function create_user(username, password)
> + box.schema.user.create(username, {
> + password = password,
> + if_not_exists = true,
> + })
> + -- Replication may has not been granted, if user exists.
> + box.schema.user.grant(username, 'replication', nil, nil,
> + {if_not_exists = true})
> +end
>
> local function storage_schema_v1(username, password)
> log.info("Initializing schema")
> - box.schema.user.create(username, {password = password})
> - box.schema.user.grant(username, 'replication')
> + create_user(username, password)
1. Please, just inline this function. It is not needed anywhere else
and is extremely simple.
>
> local bucket = box.schema.space.create('_bucket')
> bucket:format({
>
More information about the Tarantool-patches
mailing list