From 2f997ccd4882c7db592720ef1898d8bb13dbfacb Mon Sep 17 00:00:00 2001 From: amaechiabuah Date: Mon, 30 Mar 2026 16:57:22 +0100 Subject: [PATCH 1/3] fix: reorder ssm_param create args so apply passes body correctly --- CHANGELOG.md | 1 + src/duplo_resource/ssm_param.py | 18 +++++++++--------- src/tests/data/param.yaml | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22d994fd..c4b1950a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed `apply` failing for resources whose API returns HTTP 400 (not 404) for not-found lookups (e.g. RDS) by promoting 400 responses containing "not found" to `DuploNotFound` +- Fixed `ssm_param apply` failing with "name and parameter value are required" by reordering `create` parameters to match the base class contract ## [0.4.3] - 2026-03-18 diff --git a/src/duplo_resource/ssm_param.py b/src/duplo_resource/ssm_param.py index 35517164..018c90c4 100644 --- a/src/duplo_resource/ssm_param.py +++ b/src/duplo_resource/ssm_param.py @@ -14,9 +14,9 @@ def name_from_body(self, body): return body["Name"] @Command() - def create(self, - name: args.NAME=None, + def create(self, body: args.BODY=None, + name: args.NAME=None, paramtype: args.SSM_PARAM_TYPE=None, value: args.CONTENT=None, dryrun: args.DRYRUN=False) -> dict: @@ -25,12 +25,9 @@ def create(self, ```sh duploctl ssm_param create -pval -ptype ``` - + Args: - name: The name of the SSM Parameter to create. - -ptype/--parametertype: The type of parameter to create, must be String, SecureString, or StringList - -pval/--parametervalue: Arbitrary text to set in the parameter. StringList expects comma separated values. - -body: path to a raw json/yaml post body, e.g: + body: path to a raw json/yaml post body, e.g: ``` { "Type": "String", @@ -38,10 +35,13 @@ def create(self, "Name": "MyStringParameter" } ``` + name: The name of the SSM Parameter to create. + -ptype/--parametertype: The type of parameter to create, must be String, SecureString, or StringList + -pval/--parametervalue: Arbitrary text to set in the parameter. StringList expects comma separated values. - Returns: + Returns: resource: The SSM Parameter object. - + Raises: DuploError: If the SSM Parameter already exists. """ diff --git a/src/tests/data/param.yaml b/src/tests/data/param.yaml index e69de29b..2bc861b7 100644 --- a/src/tests/data/param.yaml +++ b/src/tests/data/param.yaml @@ -0,0 +1,3 @@ +Name: duploctl-test +Type: String +Value: testvalue From b899362fc5a2dbb48ac3b178b529762c9f09f844 Mon Sep 17 00:00:00 2001 From: amaechiabuah Date: Fri, 17 Apr 2026 14:07:52 +0100 Subject: [PATCH 2/3] fix: apply passes body as keyword so subclasses with (name, body) signatures work --- CHANGELOG.md | 1 + src/duplo_resource/ssm_param.py | 10 +++++----- src/duplocloud/resource.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02c6aa37..ec258e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed `service update` crashing with `KeyError: 'Template'` when given a flat YAML body without the Template wrapper - Fixed `service update_env` and `update_labels` crashing when `OtherDockerConfig` is empty - Fixed `tenant config` crashing with help text when `--deletevar` is not provided +- Fixed `apply` misrouting the body into the `name` parameter for subclasses whose `create` signature starts with `name` (e.g. `ssm_param`, `secret`, `aws_secret`, `configmap`); the V2 and V3 base `apply` now call `self.create(body=body)` by keyword ## [0.4.3] - 2026-03-18 diff --git a/src/duplo_resource/ssm_param.py b/src/duplo_resource/ssm_param.py index 018c90c4..1bcb34bd 100644 --- a/src/duplo_resource/ssm_param.py +++ b/src/duplo_resource/ssm_param.py @@ -15,8 +15,8 @@ def name_from_body(self, body): @Command() def create(self, - body: args.BODY=None, name: args.NAME=None, + body: args.BODY=None, paramtype: args.SSM_PARAM_TYPE=None, value: args.CONTENT=None, dryrun: args.DRYRUN=False) -> dict: @@ -27,7 +27,10 @@ def create(self, ``` Args: - body: path to a raw json/yaml post body, e.g: + name: The name of the SSM Parameter to create. + -ptype/--parametertype: The type of parameter to create, must be String, SecureString, or StringList + -pval/--parametervalue: Arbitrary text to set in the parameter. StringList expects comma separated values. + -body: path to a raw json/yaml post body, e.g: ``` { "Type": "String", @@ -35,9 +38,6 @@ def create(self, "Name": "MyStringParameter" } ``` - name: The name of the SSM Parameter to create. - -ptype/--parametertype: The type of parameter to create, must be String, SecureString, or StringList - -pval/--parametervalue: Arbitrary text to set in the parameter. StringList expects comma separated values. Returns: resource: The SSM Parameter object. diff --git a/src/duplocloud/resource.py b/src/duplocloud/resource.py index 17f24c3c..ba0068a9 100644 --- a/src/duplocloud/resource.py +++ b/src/duplocloud/resource.py @@ -153,7 +153,7 @@ def apply(self, self.find(name) return self.update(name, body) except DuploNotFound: - return self.create(body) + return self.create(body=body) class DuploResourceV3(DuploResource): @@ -341,6 +341,6 @@ def apply(self, self.find(name) return self.update(name=name, body=body, patches=patches) except DuploNotFound: - return self.create(body) + return self.create(body=body) From 217621da1ea0fef4ea1bba6c8d2d9842c13f08f2 Mon Sep 17 00:00:00 2001 From: amaechiabuah Date: Fri, 17 Apr 2026 14:09:07 +0100 Subject: [PATCH 3/3] docs: remove duplicate changelog entry for ssm_param apply fix --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec258e14..69a2d43e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed `batch_scheduling_policy` resource decorator name colliding with `batch_job` - Fixed `rds delete` showing internal AWS path (`aws/rds/instance/`) instead of only the database name - Fixed `apply` failing for resources whose API returns HTTP 400 (not 404) for not-found lookups (e.g. RDS) by promoting 400 responses containing "not found" to `DuploNotFound` -- Fixed `ssm_param apply` failing with "name and parameter value are required" by reordering `create` parameters to match the base class contract - Fixed `service apply` creating instead of updating when V3 find endpoint returns 200 with null body for non-existent services - Fixed `service update` crashing with `KeyError: 'Template'` when given a flat YAML body without the Template wrapper - Fixed `service update_env` and `update_labels` crashing when `OtherDockerConfig` is empty