Skip to content

Commit

Permalink
The prompt has a space after the colon so don't anchor the end of the…
Browse files Browse the repository at this point in the history
… string
  • Loading branch information
carbonin committed Jul 15, 2019
1 parent a5bbfab commit 58e0541
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/ansible/runner/credential/machine_credential.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def command_line

def write_password_file
password_hash = {
"^SSH [pP]assword:$" => auth.password,
"^BECOME [pP]assword:$" => auth.become_password
"^SSH [pP]assword:" => auth.password,
"^BECOME [pP]assword:" => auth.become_password
}.delete_blanks

File.write(password_file, password_hash.to_yaml) if password_hash.present?
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/ansible/runner/credential/machine_credential_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def password_hash
cred.write_password_file

expect(password_hash).to eq(
"^SSH [pP]assword:$" => "secret",
"^BECOME [pP]assword:$" => "othersecret"
"^SSH [pP]assword:" => "secret",
"^BECOME [pP]assword:" => "othersecret"
)

expect(File.read(key_file)).to eq("key_data")
Expand All @@ -98,7 +98,7 @@ def password_hash

cred.write_password_file

expect(password_hash["^SSH [pP]assword:$"]).to eq(password)
expect(password_hash["^SSH [pP]assword:"]).to eq(password)
end
end
end
Expand Down

0 comments on commit 58e0541

Please sign in to comment.