[PATCH compass-ci] lib/job.cr: set "pub_key" field as level-1 parameter for password-free login

[why] The "pub_key" field in yaml is used as the field to determine whether to password-free login. Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- src/lib/job.cr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/job.cr b/src/lib/job.cr index a4402ab..44a6ecf 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -184,7 +184,7 @@ class Job end private def set_sshr_info - return unless self["sshd"]? + return unless @hash["pub_key"]? self["sshr_port"] = ENV["SSHR_PORT"] self["sshr_port_base"] = ENV["SSHR_PORT_BASE"] @@ -196,8 +196,7 @@ class Job end private def set_my_ssh_pubkey - sshd = @hash["sshd"].as_h? || Hash(String, JSON::Any).new() - pub_key = sshd["pub_key"]?.to_s + pub_key = @hash["pub_key"]?.to_s update_account_my_pub_key(pub_key) @hash["my_ssh_pubkey"] = @account_info["my_ssh_pubkey"] -- 2.23.0

On Tue, Dec 01, 2020 at 05:39:39PM +0800, Zhang Yale wrote:
[why] The "pub_key" field in yaml is used as the field to determine whether to password-free login.
Make it clear, why change the sshd to pub_key. Thanks, Xueliang
Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- src/lib/job.cr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index a4402ab..44a6ecf 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -184,7 +184,7 @@ class Job end
private def set_sshr_info - return unless self["sshd"]? + return unless @hash["pub_key"]?
self["sshr_port"] = ENV["SSHR_PORT"] self["sshr_port_base"] = ENV["SSHR_PORT_BASE"] @@ -196,8 +196,7 @@ class Job end
private def set_my_ssh_pubkey - sshd = @hash["sshd"].as_h? || Hash(String, JSON::Any).new() - pub_key = sshd["pub_key"]?.to_s + pub_key = @hash["pub_key"]?.to_s update_account_my_pub_key(pub_key)
@hash["my_ssh_pubkey"] = @account_info["my_ssh_pubkey"] -- 2.23.0

On Tue, Dec 01, 2020 at 11:17:32PM +0800, Cao Xueliang wrote:
On Tue, Dec 01, 2020 at 05:39:39PM +0800, Zhang Yale wrote:
[why] The "pub_key" field in yaml is used as the field to determine whether to password-free login.
Make it clear, why change the sshd to pub_key.
Thanks, Xueliang
Ok Thanks, Yale
Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- src/lib/job.cr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index a4402ab..44a6ecf 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -184,7 +184,7 @@ class Job end
private def set_sshr_info - return unless self["sshd"]? + return unless @hash["pub_key"]?
self["sshr_port"] = ENV["SSHR_PORT"] self["sshr_port_base"] = ENV["SSHR_PORT_BASE"] @@ -196,8 +196,7 @@ class Job end
private def set_my_ssh_pubkey - sshd = @hash["sshd"].as_h? || Hash(String, JSON::Any).new() - pub_key = sshd["pub_key"]?.to_s + pub_key = @hash["pub_key"]?.to_s update_account_my_pub_key(pub_key)
@hash["my_ssh_pubkey"] = @account_info["my_ssh_pubkey"] -- 2.23.0
participants (2)
-
Cao Xueliang
-
Zhang Yale