On Mon, Nov 02, 2020 at 04:12:15PM +0800, Cao Xueliang wrote:
On Mon, Nov 02, 2020 at 02:50:06PM +0800, Luan Shengde wrote:
disable assigning account for user if there is no my_email, my_name, my_uuid
[why]: my_email, my_name, my_uuid is required when initialize the default config file
[how]: check if the data has keys: my_email, my_name, my_uuid when get apply account request. the apply account will return with 'no my info' if missing any of my_email, my_name or my_uuid.
Signed-off-by: Luan Shengde luanshengde2@huawei.com
container/assign-account/assign-account.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/container/assign-account/assign-account.rb b/container/assign-account/assign-account.rb index e356c18..3afcc9f 100755 --- a/container/assign-account/assign-account.rb +++ b/container/assign-account/assign-account.rb @@ -7,7 +7,7 @@ require 'sinatra' require 'open3' require 'json' require 'yaml' -require_relative 'get_account_info.rb' +require_relative 'get_account_info'
set :bind, '0.0.0.0' set :port, 29999 @@ -17,8 +17,12 @@ get '/assign_account' do data = YAML.safe_load request.body.read rescue StandardError => e puts e.message
puts e.backtrace end
message = 'lack of my infos(my_email, my_name, my_uuid)'
These xxx fields are required?
just tell what kind of infos in the log
Thanks Luan Shengde
Thanks, Xueliang
- raise message unless %w[my_email my_name my_uuid].to_set.subset? data.keys.to_set
- ref_account_info = AccountStorage.new(data) account_info = ref_account_info.setup_jumper_account_info
-- 2.23.0