newrelic-lambda-cli 0.9.12__tar.gz → 0.9.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/PKG-INFO +1 -1
  2. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/layers.py +22 -3
  3. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/PKG-INFO +1 -1
  4. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/setup.py +1 -1
  5. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_layers.py +25 -12
  6. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/CODE_OF_CONDUCT.md +0 -0
  7. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/CONTRIBUTING.md +0 -0
  8. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/LICENSE +0 -0
  9. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/MANIFEST.in +0 -0
  10. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/README.md +0 -0
  11. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/THIRD_PARTY_NOTICES.md +0 -0
  12. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/__init__.py +0 -0
  13. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/api.py +0 -0
  14. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/__init__.py +0 -0
  15. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/decorators.py +0 -0
  16. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/functions.py +0 -0
  17. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/integrations.py +0 -0
  18. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/layers.py +0 -0
  19. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/otel_ingestions.py +0 -0
  20. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cli/subscriptions.py +0 -0
  21. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/cliutils.py +0 -0
  22. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/functions.py +0 -0
  23. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/integrations.py +0 -0
  24. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/otel_ingestions.py +0 -0
  25. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/permissions.py +0 -0
  26. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/subscriptions.py +0 -0
  27. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/templates/import-template.yaml +0 -0
  28. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/templates/license-key-secret.yaml +0 -0
  29. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/templates/nr-lambda-integration-role.yaml +0 -0
  30. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/types.py +0 -0
  31. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli/utils.py +0 -0
  32. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/SOURCES.txt +0 -0
  33. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/dependency_links.txt +0 -0
  34. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/entry_points.txt +0 -0
  35. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/not-zip-safe +0 -0
  36. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/requires.txt +0 -0
  37. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/newrelic_lambda_cli.egg-info/top_level.txt +0 -0
  38. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/pyproject.toml +0 -0
  39. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/setup.cfg +0 -0
  40. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_api.py +0 -0
  41. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_functions.py +0 -0
  42. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_integrations.py +0 -0
  43. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_new_relic_gql.py +0 -0
  44. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_permissions.py +0 -0
  45. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_subscriptions.py +0 -0
  46. {newrelic_lambda_cli-0.9.12 → newrelic_lambda_cli-0.9.13}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.12
3
+ Version: 0.9.13
4
4
  Summary: A CLI to install the New Relic AWS Lambda integration and layers.
5
5
  Home-page: https://github.com/newrelic/newrelic-lambda-cli
6
6
  Author: New Relic
@@ -47,7 +47,18 @@ def index(region, runtime, architecture):
47
47
  ]
48
48
 
49
49
 
50
- def layer_selection(available_layers, runtime, architecture):
50
+ def layer_selection(
51
+ available_layers, runtime, architecture, upgrade=False, existing_layer_arn=None
52
+ ):
53
+ if upgrade and existing_layer_arn:
54
+ base_arn = existing_layer_arn.rsplit(":", 1)[0]
55
+
56
+ for i, layer in enumerate(available_layers):
57
+ candidate_arn = layer["LatestMatchingVersion"]["LayerVersionArn"]
58
+ candidate_base_arn = candidate_arn.rsplit(":", 1)[0]
59
+ if candidate_base_arn == base_arn:
60
+ return candidate_arn
61
+
51
62
  if len(available_layers) == 1:
52
63
  return available_layers[0]["LatestMatchingVersion"]["LayerVersionArn"]
53
64
 
@@ -147,8 +158,16 @@ def _add_new_relic(input, config, nr_license_key):
147
158
  % (config["Configuration"]["FunctionArn"], runtime, architecture)
148
159
  )
149
160
  return False
150
-
151
- new_relic_layer = layer_selection(available_layers, runtime, architecture)
161
+ existing_layer_arn = (
162
+ existing_newrelic_layer[0] if existing_newrelic_layer else None
163
+ )
164
+ new_relic_layer = layer_selection(
165
+ available_layers,
166
+ runtime,
167
+ architecture,
168
+ upgrade=input.upgrade,
169
+ existing_layer_arn=existing_layer_arn,
170
+ )
152
171
 
153
172
  update_kwargs = {
154
173
  "FunctionName": config["Configuration"]["FunctionArn"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: newrelic-lambda-cli
3
- Version: 0.9.12
3
+ Version: 0.9.13
4
4
  Summary: A CLI to install the New Relic AWS Lambda integration and layers.
5
5
  Home-page: https://github.com/newrelic/newrelic-lambda-cli
6
6
  Author: New Relic
@@ -6,7 +6,7 @@ README = open(os.path.join(os.path.dirname(__file__), "README.md"), "r").read()
6
6
 
7
7
  setup(
8
8
  name="newrelic-lambda-cli",
9
- version="0.9.12",
9
+ version="0.9.13",
10
10
  python_requires=">=3.3",
11
11
  description="A CLI to install the New Relic AWS Lambda integration and layers.",
12
12
  long_description=README,
@@ -143,7 +143,11 @@ def test_add_new_relic(aws_credentials, mock_function_config):
143
143
  )
144
144
 
145
145
  layer_selection_mock.assert_called_with(
146
- mock_index.return_value, "java11", "x86_64"
146
+ mock_index.return_value,
147
+ "java11",
148
+ "x86_64",
149
+ upgrade=None,
150
+ existing_layer_arn=None,
147
151
  )
148
152
  assert "original_handler" in config["Configuration"]["Handler"]
149
153
 
@@ -417,7 +421,6 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
417
421
 
418
422
  runtime = "nodejs20.x"
419
423
 
420
- # --- Scenario 1: Standard Node.js Handler (ESM disabled) ---
421
424
  print(f"\nTesting Node.js ({runtime}) Standard Handler...")
422
425
  original_std_handler = "original_handler"
423
426
  config_std = mock_function_config(runtime)
@@ -430,11 +433,16 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
430
433
  enable_extension_function_logs=True,
431
434
  )
432
435
 
433
- update_kwargs_std = _add_new_relic(
434
- install_opts_std,
435
- config_std,
436
- nr_license_key=nr_license_key,
437
- )
436
+ with patch("sys.stdout.isatty") as mock_isatty, patch(
437
+ "newrelic_lambda_cli.layers.click.prompt"
438
+ ) as mock_prompt:
439
+ mock_isatty.return_value = True
440
+ mock_prompt.return_value = 0
441
+ update_kwargs_std = _add_new_relic(
442
+ install_opts_std,
443
+ config_std,
444
+ nr_license_key=nr_license_key,
445
+ )
438
446
 
439
447
  assert update_kwargs_std is not False, "Expected update_kwargs, not False"
440
448
  assert (
@@ -479,11 +487,16 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
479
487
  esm=True,
480
488
  )
481
489
 
482
- update_kwargs_esm = _add_new_relic(
483
- install_opts_esm,
484
- config_esm,
485
- nr_license_key=nr_license_key,
486
- )
490
+ with patch("sys.stdout.isatty") as mock_isatty, patch(
491
+ "newrelic_lambda_cli.layers.click.prompt"
492
+ ) as mock_prompt:
493
+ mock_isatty.return_value = True
494
+ mock_prompt.return_value = 0
495
+ update_kwargs_esm = _add_new_relic(
496
+ install_opts_esm,
497
+ config_esm,
498
+ nr_license_key=nr_license_key,
499
+ )
487
500
 
488
501
  assert update_kwargs_esm is not False, "Expected update_kwargs, not False"
489
502
  assert (