MCPcopy Index your code
hub / github.com/aws/aws-cli / login

Method login

awscli/customizations/codeartifact/login.py:288–332  ·  view source on GitHub ↗
(self, dry_run=False)

Source from the content-addressed store, hash-verified

286 _SOURCE_REGEX = re.compile(r'^\d+\.\s(?P<source_name>.+)\s\[.*\]')
287
288 def login(self, dry_run=False):
289 try:
290 source_to_url_dict = self._get_source_to_url_dict()
291 except OSError as ex:
292 if ex.errno == errno.ENOENT:
293 raise ValueError(
294 self._TOOL_NOT_FOUND_MESSAGE % self._get_tool_name()
295 )
296 raise ex
297
298 nuget_index_url = self._NUGET_INDEX_URL_FMT.format(
299 endpoint=self.repository_endpoint
300 )
301 source_name, already_exists = self._get_source_name(
302 nuget_index_url, source_to_url_dict
303 )
304
305 if already_exists:
306 command = self._get_configure_command(
307 'update', nuget_index_url, source_name
308 )
309 source_configured_message = self._SOURCE_UPDATED_MESSAGE
310 else:
311 command = self._get_configure_command(
312 'add', nuget_index_url, source_name
313 )
314 source_configured_message = self._SOURCE_ADDED_MESSAGE
315
316 if dry_run:
317 dry_run_command = ' '.join([str(cd) for cd in command])
318 uni_print(dry_run_command)
319 uni_print('\n')
320 return
321
322 try:
323 with original_ld_library_path():
324 self.subprocess_utils.run(
325 command, capture_output=True, check=True
326 )
327 except subprocess.CalledProcessError as e:
328 uni_print('Failed to update the NuGet.Config\n')
329 raise CommandFailedError(e, self.auth_token)
330
331 uni_print(source_configured_message % source_name)
332 self._write_success_message('nuget')
333
334 def _get_source_to_url_dict(self):
335 """

Callers

nothing calls this directly

Calls 10

_get_tool_nameMethod · 0.95
_get_source_nameMethod · 0.95
uni_printFunction · 0.90
original_ld_library_pathFunction · 0.90
CommandFailedErrorClass · 0.85
formatMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected