From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B59B321D50 for ; Tue, 26 Jun 2018 07:11:49 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zxt8zJPvoG5K for ; Tue, 26 Jun 2018 07:11:49 -0400 (EDT) Received: from smtp45.i.mail.ru (smtp45.i.mail.ru [94.100.177.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 5871821A35 for ; Tue, 26 Jun 2018 07:11:47 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 2/3] Allow use existing user References: <9e713265548c04cbc3325929ae6ba3fbef533245.1529703268.git.avkhatskevich@tarantool.org> <4d20128b-9199-739a-83e4-3eacfa03465a@tarantool.org> <3ef155eb-a465-b96b-e0b8-736db5c758a1@tarantool.org> From: Vladislav Shpilevoy Message-ID: <2da4ba98-0c83-3284-c3c1-c3e4cbceabe1@tarantool.org> Date: Tue, 26 Jun 2018 14:11:44 +0300 MIME-Version: 1.0 In-Reply-To: <3ef155eb-a465-b96b-e0b8-736db5c758a1@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, Alex Khatskevich Thanks for the fixes! The patch is pushed. On 26/06/2018 00:55, Alex Khatskevich wrote: > >>> @@ -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. >> > done >