From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, AKhatskevich <avkhatskevich@tarantool.org> Subject: [tarantool-patches] Re: [PATCH 2/3] Allow use existing user Date: Sat, 23 Jun 2018 01:12:00 +0300 [thread overview] Message-ID: <4d20128b-9199-739a-83e4-3eacfa03465a@tarantool.org> (raw) In-Reply-To: <9e713265548c04cbc3325929ae6ba3fbef533245.1529703268.git.avkhatskevich@tarantool.org> 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({ >
next prev parent reply other threads:[~2018-06-22 22:12 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-22 21:43 [tarantool-patches] [PATCH 0/3][vshard] Small patches AKhatskevich 2018-06-22 21:43 ` [tarantool-patches] [PATCH 1/3] Do not force login/pass in URI AKhatskevich 2018-06-22 22:11 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-25 21:56 ` Alex Khatskevich 2018-06-26 11:11 ` Vladislav Shpilevoy 2018-06-22 21:43 ` [tarantool-patches] [PATCH 2/3] Allow use existing user AKhatskevich 2018-06-22 22:12 ` Vladislav Shpilevoy [this message] 2018-06-25 21:55 ` [tarantool-patches] " Alex Khatskevich 2018-06-26 11:11 ` Vladislav Shpilevoy 2018-06-22 21:43 ` [tarantool-patches] [PATCH 3/3] Introduce destroy module feature AKhatskevich 2018-06-22 22:11 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-25 21:54 ` Alex Khatskevich 2018-06-26 11:11 ` Vladislav Shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4d20128b-9199-739a-83e4-3eacfa03465a@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=avkhatskevich@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 2/3] Allow use existing user' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox