Skip to content

Commit 7e00560

Browse files
author
Yue Tu
committed
modified warning msg
1 parent ff0bc4b commit 7e00560

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/sagemaker/git_utils.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -145,36 +145,30 @@ def _clone_command_for_github_like(git_config, dest_dir):
145145

146146
def _clone_command_for_github_like_ssh(git_config, dest_dir):
147147
if "username" in git_config or "password" in git_config or "token" in git_config:
148-
warnings.warn("Unnecessary credential argument(s) provided.")
148+
warnings.warn("SSH cloning, authentication information in git config will be ignored.")
149149
_run_clone_command(git_config["repo"], dest_dir)
150150

151151

152152
def _clone_command_for_github_like_https_2fa_disabled(git_config, dest_dir):
153153
updated_url = git_config["repo"]
154154
if "token" in git_config:
155155
if "username" in git_config or "password" in git_config:
156-
warnings.warn(
157-
"Using token for authentication, "
158-
"but unnecessary credential argument(s) provided."
159-
)
156+
warnings.warn("Using token for authentication, " "other credentials will be ignored.")
160157
updated_url = _insert_token_to_repo_url(url=git_config["repo"], token=git_config["token"])
161158
elif "username" in git_config and "password" in git_config:
162159
updated_url = _insert_username_and_password_to_repo_url(
163160
url=git_config["repo"], username=git_config["username"], password=git_config["password"]
164161
)
165162
elif "username" in git_config or "password" in git_config:
166-
warnings.warn("Unnecessary credential argument(s) provided.")
163+
warnings.warn("Credentials provided in git config will be ignored.")
167164
_run_clone_command(updated_url, dest_dir)
168165

169166

170167
def _clone_command_for_github_like_https_2fa_enabled(git_config, dest_dir):
171168
updated_url = git_config["repo"]
172169
if "token" in git_config:
173170
if "username" in git_config or "password" in git_config:
174-
warnings.warn(
175-
"Using token for authentication, "
176-
"but unnecessary credential argument(s) provided."
177-
)
171+
warnings.warn("Using token for authentication, " "other credentials will be ignored.")
178172
updated_url = _insert_token_to_repo_url(url=git_config["repo"], token=git_config["token"])
179173
_run_clone_command(updated_url, dest_dir)
180174

tests/unit/test_git_utils.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def test_git_clone_repo_with_token_no_2fa_unnecessary_creds_provided(isfile, mkd
298298
with pytest.warns(UserWarning) as warn:
299299
ret = git_utils.git_clone_repo(git_config=git_config, entry_point=entry_point)
300300
assert (
301-
"Using token for authentication, but unnecessary credential argument(s) provided."
301+
"Using token for authentication, other credentials will be ignored."
302302
in warn[0].message.args[0]
303303
)
304304
check_call.assert_any_call(
@@ -334,7 +334,10 @@ def test_git_clone_repo_with_token_2fa_unnecessary_creds_provided(isfile, mkdtem
334334
env["GIT_TERMINAL_PROMPT"] = "0"
335335
with pytest.warns(UserWarning) as warn:
336336
ret = git_utils.git_clone_repo(git_config=git_config, entry_point=entry_point)
337-
assert "unnecessary credential argument(s) provided." in warn[0].message.args[0]
337+
assert (
338+
"Using token for authentication, other credentials will be ignored."
339+
in warn[0].message.args[0]
340+
)
338341
check_call.assert_any_call(
339342
[
340343
"git",

0 commit comments

Comments
 (0)