diff mbox series

[v2,08/12] ssh.Makefile: Define a kdevops_ssh_config variable

Message ID 20250205155252.1317763-9-cel@kernel.org (mailing list archive)
State New
Headers show
Series Replace terraform update_ssh_config module | expand

Commit Message

Chuck Lever Feb. 5, 2025, 3:52 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

Create a global variable that contains the pathname of the config
file that stores ephemeral ssh host entries. That way the scripts
don't have to keep creating this pathname.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 scripts/ssh.Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Luis Chamberlain Feb. 5, 2025, 5:42 p.m. UTC | #1
On Wed, Feb 05, 2025 at 10:52:48AM -0500, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> Create a global variable that contains the pathname of the config
> file that stores ephemeral ssh host entries. That way the scripts
> don't have to keep creating this pathname.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  scripts/ssh.Makefile | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/scripts/ssh.Makefile b/scripts/ssh.Makefile
> index 150001d8bbbd..58ffe1e05d68 100644
> --- a/scripts/ssh.Makefile
> +++ b/scripts/ssh.Makefile
> @@ -7,10 +7,19 @@ ANSIBLE_EXTRA_ARGS += kexalgorithms=$(SSH_KEXALGORITHMS)
>  endif
>  
>  ifeq (y,$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE))
> +
>  SSH_CONFIG_FILE:=$(subst ",,$(CONFIG_KDEVOPS_SSH_CONFIG))
>  ANSIBLE_EXTRA_ARGS += sshconfig=$(CONFIG_KDEVOPS_SSH_CONFIG)
>  ANSIBLE_EXTRA_ARGS += sshdir=$(shell dirname $(SSH_CONFIG_FILE))
> +
> +ifeq (y,$(CONFIG_TOPDIR_PATH_HAS_SHA256SUM))
> +SSH_CONFIG_SUFFIX:=$(CONFIG_TOPDIR_PATH_SHA256SUM)
> +else
> +SSH_CONFIG_SUFFIX:=$(CONFIG_KDEVOPS_HOST_PREFIX)
>  endif
> +ANSIBLE_EXTRA_ARGS += kdevops_ssh_config=$(CONFIG_KDEVOPS_SSH_CONFIG)_kdevops_$(SSH_CONFIG_SUFFIX)

Can we we just define this through Kconfig and use output yaml on the
entry for CONFIG_KDEVOPS_SSH_CONFIG ? Appending variables together
is stitched together on Kconfig via append-makefile-vars.sh.

This may require either cleaning up the usage / definition of
CONFIG_KDEVOPS_SSH_CONFIG and kdevops_ssh_config further so it is
consistent.

  Luis
Chuck Lever Feb. 6, 2025, 2:36 a.m. UTC | #2
On 2/5/25 12:42 PM, Luis Chamberlain wrote:
> On Wed, Feb 05, 2025 at 10:52:48AM -0500, cel@kernel.org wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> Create a global variable that contains the pathname of the config
>> file that stores ephemeral ssh host entries. That way the scripts
>> don't have to keep creating this pathname.
>>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>  scripts/ssh.Makefile | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/scripts/ssh.Makefile b/scripts/ssh.Makefile
>> index 150001d8bbbd..58ffe1e05d68 100644
>> --- a/scripts/ssh.Makefile
>> +++ b/scripts/ssh.Makefile
>> @@ -7,10 +7,19 @@ ANSIBLE_EXTRA_ARGS += kexalgorithms=$(SSH_KEXALGORITHMS)
>>  endif
>>  
>>  ifeq (y,$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE))
>> +
>>  SSH_CONFIG_FILE:=$(subst ",,$(CONFIG_KDEVOPS_SSH_CONFIG))
>>  ANSIBLE_EXTRA_ARGS += sshconfig=$(CONFIG_KDEVOPS_SSH_CONFIG)
>>  ANSIBLE_EXTRA_ARGS += sshdir=$(shell dirname $(SSH_CONFIG_FILE))
>> +
>> +ifeq (y,$(CONFIG_TOPDIR_PATH_HAS_SHA256SUM))
>> +SSH_CONFIG_SUFFIX:=$(CONFIG_TOPDIR_PATH_SHA256SUM)
>> +else
>> +SSH_CONFIG_SUFFIX:=$(CONFIG_KDEVOPS_HOST_PREFIX)
>>  endif
>> +ANSIBLE_EXTRA_ARGS += kdevops_ssh_config=$(CONFIG_KDEVOPS_SSH_CONFIG)_kdevops_$(SSH_CONFIG_SUFFIX)
> 
> Can we we just define this through Kconfig and use output yaml on the
> entry for CONFIG_KDEVOPS_SSH_CONFIG ? Appending variables together
> is stitched together on Kconfig via append-makefile-vars.sh.
> 
> This may require either cleaning up the usage / definition of
> CONFIG_KDEVOPS_SSH_CONFIG and kdevops_ssh_config further so it is
> consistent.

Yeah, this is not the prettiest scripting in the world. I will try to
fix this up as I get through testing the other terraform providers.
diff mbox series

Patch

diff --git a/scripts/ssh.Makefile b/scripts/ssh.Makefile
index 150001d8bbbd..58ffe1e05d68 100644
--- a/scripts/ssh.Makefile
+++ b/scripts/ssh.Makefile
@@ -7,10 +7,19 @@  ANSIBLE_EXTRA_ARGS += kexalgorithms=$(SSH_KEXALGORITHMS)
 endif
 
 ifeq (y,$(CONFIG_KDEVOPS_SSH_CONFIG_UPDATE))
+
 SSH_CONFIG_FILE:=$(subst ",,$(CONFIG_KDEVOPS_SSH_CONFIG))
 ANSIBLE_EXTRA_ARGS += sshconfig=$(CONFIG_KDEVOPS_SSH_CONFIG)
 ANSIBLE_EXTRA_ARGS += sshdir=$(shell dirname $(SSH_CONFIG_FILE))
+
+ifeq (y,$(CONFIG_TOPDIR_PATH_HAS_SHA256SUM))
+SSH_CONFIG_SUFFIX:=$(CONFIG_TOPDIR_PATH_SHA256SUM)
+else
+SSH_CONFIG_SUFFIX:=$(CONFIG_KDEVOPS_HOST_PREFIX)
 endif
+ANSIBLE_EXTRA_ARGS += kdevops_ssh_config=$(CONFIG_KDEVOPS_SSH_CONFIG)_kdevops_$(SSH_CONFIG_SUFFIX)
+
+endif # CONFIG_KDEVOPS_SSH_CONFIG_UPDATE
 
 PHONY += remove-ssh-key
 remove-ssh-key: