From 6011976027d00f5f1b2b68d9705e067814469399 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sun, 29 Dec 2024 20:49:41 -0500 Subject: [PATCH 1/2] Fix data type for 'host' to allow for wildcards --- REFERENCE.md | 2 +- spec/type_aliases/ssh_config_spec.rb | 38 +++++++++------------------- types/ssh_config.pp | 2 +- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 99e1a694..04503977 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -2671,7 +2671,7 @@ Alias of ```puppet Struct[{ - Optional['Host'] => Stdlib::Host, + Optional['Host'] => String[1], Optional['Match'] => String[1], Optional['AddKeysToAgent'] => Enum['yes', 'no', 'ask', 'confirm'], Optional['AddressFamily'] => Enum['any', 'inet', 'inet6'], diff --git a/spec/type_aliases/ssh_config_spec.rb b/spec/type_aliases/ssh_config_spec.rb index c578802b..1754e9b3 100644 --- a/spec/type_aliases/ssh_config_spec.rb +++ b/spec/type_aliases/ssh_config_spec.rb @@ -276,13 +276,18 @@ context 'String[1]' do [ - 'Match', 'BindAddress', 'BindInterface', 'CanonicalDomains', 'CanonicalizePermittedCNAMEs', 'CASignatureAlgorithms', - 'CertificateFile', 'Ciphers', 'ControlPath', 'ControlPersist', 'DynamicForward', 'EscapeChar', 'GlobalKnownHostsFile', - 'HostbasedAcceptedAlgorithms', 'HostKeyAlgorithms', 'HostKeyAlias', 'Hostname', 'IdentityAgent', 'IdentityFile', - 'IgnoreUnknown', 'Include', 'IPQoS', 'KbdInteractiveDevices', 'KexAlgorithms', 'KnownHostsCommand', 'LocalCommand', - 'LocalForward', 'LogVerbose', 'MACs', 'PermitRemoteOpen', 'PKCS11Provider', 'PreferredAuthentications', 'ProxyCommand', - 'ProxyJump', 'PubkeyAcceptedAlgorithms', 'RekeyLimit', 'RemoteCommand', 'RemoteForward', 'RevokedHostKeys', - 'SecurityKeyProvider', 'SendEnv', 'SetEnv', 'TunnelDevice', 'User', 'UserKnownHostsFile', 'XAuthLocation' + 'Match', 'BindAddress', 'BindInterface', 'CanonicalDomains', + 'CanonicalizePermittedCNAMEs', 'CASignatureAlgorithms', + 'CertificateFile', 'Ciphers', 'ControlPath', 'ControlPersist', + 'DynamicForward', 'EscapeChar', 'GlobalKnownHostsFile', 'Host', + 'HostbasedAcceptedAlgorithms', 'HostKeyAlgorithms', 'HostKeyAlias', + 'Hostname', 'IdentityAgent', 'IdentityFile', 'IgnoreUnknown', 'Include', + 'IPQoS', 'KbdInteractiveDevices', 'KexAlgorithms', 'KnownHostsCommand', + 'LocalCommand', 'LocalForward', 'LogVerbose', 'MACs', 'PermitRemoteOpen', + 'PKCS11Provider', 'PreferredAuthentications', 'ProxyCommand', + 'ProxyJump', 'PubkeyAcceptedAlgorithms', 'RekeyLimit', 'RemoteCommand', + 'RemoteForward', 'RevokedHostKeys', 'SecurityKeyProvider', 'SendEnv', + 'SetEnv', 'TunnelDevice', 'User', 'UserKnownHostsFile', 'XAuthLocation' ].each do |directive| describe directive.inspect do [ @@ -337,25 +342,6 @@ end end - context 'Stdlib::Host' do - [ - 'Host', - ].each do |directive| - describe directive.inspect do - [ - 'string', 'host.domain.tld', '242.242.242.242', '242', nil, :keyword # FIXME: unsure why nil and :keyword are actually supported - ].each do |valid| - it { is_expected.to allow_value(directive => valid) } - end - [ - '_invalid.domain.tld', 'ネット', ['array'], { 'ha' => 'sh' }, [], '', 242, 0x242, true, false, [nil], [nil, nil] - ].each do |invalid| - it { is_expected.not_to allow_value(directive => invalid) } - end - end - end - end - context 'Stdlib::Port' do [ 'Port', diff --git a/types/ssh_config.pp b/types/ssh_config.pp index 1ab466d9..b359b7ee 100644 --- a/types/ssh_config.pp +++ b/types/ssh_config.pp @@ -2,7 +2,7 @@ # type Ssh::Ssh_Config = Struct[ { - Optional['Host'] => Stdlib::Host, + Optional['Host'] => String[1], Optional['Match'] => String[1], Optional['AddKeysToAgent'] => Enum['yes', 'no', 'ask', 'confirm'], Optional['AddressFamily'] => Enum['any', 'inet', 'inet6'], From 59378ea94a5a91458e55e2342e68aaf1b43d4c47 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Sun, 29 Dec 2024 21:00:27 -0500 Subject: [PATCH 2/2] Remove trailing whitespace --- .devcontainer/README.md | 4 ++-- .github/workflows/ci.yaml | 2 +- manifests/config_file_client.pp | 2 +- manifests/config_file_server.pp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index a7193616..9839fb0a 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,11 +1,11 @@ # devcontainer -For format details, see https://aka.ms/devcontainer.json. +For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet - + ``` json { "name": "Puppet Development Kit (Community)", diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 704bfd97..8cad4118 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -68,7 +68,7 @@ jobs: env: BUNDLE_WITHOUT: development:release BEAKER_debug: true - name: + name: steps: - name: Enable IPv6 on docker run: | diff --git a/manifests/config_file_client.pp b/manifests/config_file_client.pp index a42862a4..be276ea2 100644 --- a/manifests/config_file_client.pp +++ b/manifests/config_file_client.pp @@ -1,4 +1,4 @@ -# @summary Create config files to be used +# @summary Create config files to be used # # Manage an entry in ~/.ssh/config for a particular user. Lines model the # lines in each Host block. diff --git a/manifests/config_file_server.pp b/manifests/config_file_server.pp index cca375e7..d5ee3eac 100644 --- a/manifests/config_file_server.pp +++ b/manifests/config_file_server.pp @@ -1,4 +1,4 @@ -# @summary Create config files to be used +# @summary Create config files to be used # # Manage an entry in ~/.ssh/config for a particular user. Lines model the # lines in each Host block.