train-k8s-container-mitre 2.2.1 → 2.2.2
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.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +20 -0
- data/lib/train-k8s-container/connection.rb +22 -12
- data/lib/train-k8s-container/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b95ee2c59e32274bfbf09aa1762cb927521b5c45faebf3fe476569aa81e2fa0
|
|
4
|
+
data.tar.gz: 1cdf1d2feff07b4e500d846f5a33e7da436b35fa25fe35d260ef690e001eba4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37834018266f1c81c6410e10486331eafeb0d4d7199bfe023a7759d99793b85d9e54dbc50448897e29a80c7ac79d20099c2985a5255fdc03ebde9eb83aedcb6c
|
|
7
|
+
data.tar.gz: f44e54c68706db397464fb2189f23da0f12dbcef0c0436281afa5d0c53ffd73ed295d9fb71bd87acc76fc92f92104eaeca458bf54f2a7f3cac12fc4dec68fabd
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.2.2](https://github.com/mitre/train-k8s-container/compare/v2.2.1...v2.2.2) (2026-05-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* parse URI host as K8s namespace ([99e7bda](https://github.com/mitre/train-k8s-container/commit/99e7bda8e0eb36f77053febddae5d4929a5af72b))
|
|
14
|
+
* parse URI host as K8s namespace ([6a8fb88](https://github.com/mitre/train-k8s-container/commit/6a8fb8821a25ae115136137e166abfc3f9258e2d))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Code Refactoring
|
|
18
|
+
|
|
19
|
+
* **connection:** collapse URI parser branches into case statement ([58206ed](https://github.com/mitre/train-k8s-container/commit/58206ed20e1b11df195ebd0e798f4f69926dc7b3))
|
|
20
|
+
* **connection:** use non-deprecated Train.unpack_target_from_uri ([925c17d](https://github.com/mitre/train-k8s-container/commit/925c17d8ef09391c6badfb1e62d19490904dc50d))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Tests
|
|
24
|
+
|
|
25
|
+
* **connection:** cover #unique_identifier delegation ([893e28b](https://github.com/mitre/train-k8s-container/commit/893e28bcdbf95b883272fd02e1556dcd7d03fa32))
|
|
26
|
+
* **connection:** pin URI parser behavior with characterization tests ([c2c0c34](https://github.com/mitre/train-k8s-container/commit/c2c0c3490c58e25f2cee54d8156c78d74a64d47e))
|
|
27
|
+
|
|
8
28
|
## [2.2.1](https://github.com/mitre/train-k8s-container/compare/v2.2.0...v2.2.1) (2026-01-17)
|
|
9
29
|
|
|
10
30
|
|
|
@@ -6,6 +6,7 @@ require 'train/file/remote/linux'
|
|
|
6
6
|
require 'train/file/remote/windows'
|
|
7
7
|
require_relative 'platform'
|
|
8
8
|
require_relative 'kubernetes_name_validator'
|
|
9
|
+
require_relative 'kubectl_exec_client'
|
|
9
10
|
|
|
10
11
|
module TrainPlugins
|
|
11
12
|
module K8sContainer
|
|
@@ -18,26 +19,35 @@ module TrainPlugins
|
|
|
18
19
|
# @example k8s-container://default/shell-demo/nginx
|
|
19
20
|
|
|
20
21
|
def initialize(options)
|
|
22
|
+
# Defensive: unpack URI when a caller passes :target directly (e.g. programmatic use).
|
|
23
|
+
# InSpec normally pre-unpacks via Train.target_config, so :host/:path are already set
|
|
24
|
+
# and this block is a no-op. Uses unpack_target_from_uri because Train.target_config is
|
|
25
|
+
# flagged for deprecation upstream (see train-core/lib/train.rb). Merge direction
|
|
26
|
+
# matches target_config's original behavior: explicit options win over unpacked creds.
|
|
27
|
+
if options[:target] && options[:host].to_s.empty?
|
|
28
|
+
options = Train.unpack_target_from_uri(options[:target]).merge(options)
|
|
29
|
+
end
|
|
21
30
|
super
|
|
22
31
|
|
|
23
|
-
# Parse URI
|
|
24
|
-
# - k8s-container://pod/container → path="
|
|
25
|
-
# - k8s-container
|
|
32
|
+
# Parse URI components:
|
|
33
|
+
# - k8s-container://namespace/pod/container → host="namespace", path="/pod/container"
|
|
34
|
+
# - k8s-container:///namespace/pod/container → path="/namespace/pod/container"
|
|
35
|
+
# - k8s-container:///pod/container → path="/pod/container" (default namespace)
|
|
26
36
|
path_parts = options[:path]&.split('/')&.reject(&:empty?)
|
|
37
|
+
host = options[:host].to_s.empty? ? nil : options[:host]
|
|
27
38
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@namespace = options[:namespace] ||
|
|
31
|
-
@pod = options[:pod] || path_parts.first
|
|
32
|
-
@container_name = options[:container_name] || path_parts[1]
|
|
33
|
-
elsif path_parts&.length == 3
|
|
34
|
-
# Format: //namespace/pod/container
|
|
35
|
-
@namespace = options[:namespace] || path_parts.first
|
|
39
|
+
case path_parts&.length
|
|
40
|
+
when 3
|
|
41
|
+
@namespace = options[:namespace] || host || path_parts.first
|
|
36
42
|
@pod = options[:pod] || path_parts[1]
|
|
37
43
|
@container_name = options[:container_name] || path_parts[2]
|
|
44
|
+
when 2
|
|
45
|
+
@namespace = options[:namespace] || host || TrainPlugins::K8sContainer::KubectlExecClient::DEFAULT_NAMESPACE
|
|
46
|
+
@pod = options[:pod] || path_parts.first
|
|
47
|
+
@container_name = options[:container_name] || path_parts[1]
|
|
38
48
|
else
|
|
39
49
|
# No valid path - must use explicit options
|
|
40
|
-
@namespace = options[:namespace] || TrainPlugins::K8sContainer::KubectlExecClient::DEFAULT_NAMESPACE
|
|
50
|
+
@namespace = options[:namespace] || host || TrainPlugins::K8sContainer::KubectlExecClient::DEFAULT_NAMESPACE
|
|
41
51
|
@pod = options[:pod]
|
|
42
52
|
@container_name = options[:container_name]
|
|
43
53
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: train-k8s-container-mitre
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MITRE SAF Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|