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 parsed data has keys: - my_email - my_name - my_uuid
Signed-off-by: Luan Shengde luanshengde2@huawei.com --- container/assign-account/assign-account.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/container/assign-account/assign-account.rb b/container/assign-account/assign-account.rb index e356c18..834f666 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,17 @@ get '/assign_account' do data = YAML.safe_load request.body.read rescue StandardError => e puts e.message + puts e.backtrace end
+ check_to_assign_account(data) +end + +def check_to_assign_account(data) + lacked_info = %w[my_email my_name my_uuid] - data.keys + error_message = "lack of my infos: #{lacked_info.join(', ')}." + raise error_message unless lacked_info.empty? + ref_account_info = AccountStorage.new(data) account_info = ref_account_info.setup_jumper_account_info
About subject: subject should be a brief description of this patch, not the changed file name.
So how about the follow: assign-account: add three key fields check step
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 parsed data has keys: - my_email
- my_name
- my_uuid
About changelog: 1. no ':' [Why]: => [Why]
2. format All paragraphs should be put under [Why] or [How] or [Other]. So the below paragraph should in [How], or delete it directly.
disable assigning account for user if there is no:
- my_email
- my_name
- my_uuid
-------- Thanks Yu Chuan
Signed-off-by: Luan Shengde luanshengde2@huawei.com
container/assign-account/assign-account.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/container/assign-account/assign-account.rb b/container/assign-account/assign-account.rb index e356c18..834f666 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,17 @@ get '/assign_account' do data = YAML.safe_load request.body.read rescue StandardError => e puts e.message
puts e.backtrace end
check_to_assign_account(data)
+end
+def check_to_assign_account(data)
- lacked_info = %w[my_email my_name my_uuid] - data.keys
- error_message = "lack of my infos: #{lacked_info.join(', ')}."
- raise error_message unless lacked_info.empty?
- ref_account_info = AccountStorage.new(data) account_info = ref_account_info.setup_jumper_account_info
-- 2.23.0
On Wed, Nov 04, 2020 at 04:25:43PM +0800, Yu Chuan wrote:
About subject: subject should be a brief description of this patch, not the changed file name.
So how about the follow: assign-account: add three key fields check step
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 parsed data has keys: - my_email
- my_name
- my_uuid
About changelog:
- no ':'
[Why]: => [Why]
- format
All paragraphs should be put under [Why] or [How] or [Other]. So the below paragraph should in [How], or delete it directly.
OK, I will pay attention for it
Thanks, Luan Shengde
disable assigning account for user if there is no:
- my_email
- my_name
- my_uuid
Thanks Yu Chuan
Signed-off-by: Luan Shengde luanshengde2@huawei.com
container/assign-account/assign-account.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/container/assign-account/assign-account.rb b/container/assign-account/assign-account.rb index e356c18..834f666 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,17 @@ get '/assign_account' do data = YAML.safe_load request.body.read rescue StandardError => e puts e.message
puts e.backtrace end
check_to_assign_account(data)
+end
+def check_to_assign_account(data)
- lacked_info = %w[my_email my_name my_uuid] - data.keys
- error_message = "lack of my infos: #{lacked_info.join(', ')}."
- raise error_message unless lacked_info.empty?
- ref_account_info = AccountStorage.new(data) account_info = ref_account_info.setup_jumper_account_info
-- 2.23.0