Skip to content

Commit

Permalink
fix(package): removes parameter value validation
Browse files Browse the repository at this point in the history
We had removed parameter value validation in the backend. However, the
SDK still checked for empty value. This prohibits users to set empty
values in environment variables. This commit, removes the validation.

https://www.wrike.com/open.htm?id=1374797669
  • Loading branch information
pallabpain committed Jun 4, 2024
1 parent c16d229 commit df2f0dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions rapyuta_io/clients/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,10 @@ def add_parameter(self, component_name, key, value):
raise InvalidParameterException("component_name must be a non-empty string")
if not key or not isinstance(key, six.string_types):
raise InvalidParameterException("key must be a non-empty string")
if not value or not isinstance(value, six.string_types):
raise InvalidParameterException("value must be a non-empty string")

component_id = self.plan.get_component_id(component_name)
self.parameters[component_id][key] = value

return self

def set_component_alias(self, component_name, alias="", set_ros_namespace=False):
Expand Down
12 changes: 0 additions & 12 deletions tests/package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,18 +418,6 @@ def test_package_provision_api_error(self, mock_request):
pkg.provision('test_package_name', provision_config)
self.assertEqual(mock_request.call_count, 2)

@patch('requests.request')
def test_package_provision_component_parameter_invalid_value_failure(self, mock_request):
get_package = Mock()
get_package.text = PACKAGE_OK_NO_VALIDATE
get_package.status_code = requests.codes.OK
mock_request.side_effect = [get_package]
client = get_client()
pkg = client.get_package('my_package')
provision_config = pkg.get_provision_configuration('test-plan')
with self.assertRaises(InvalidParameterException):
provision_config.add_parameter('ros-talker', 'invalid-value', 123)

@patch('requests.request')
def test_package_provision_component_parameter_empty_component_name_failure(self, mock_request):
get_package = Mock()
Expand Down

0 comments on commit df2f0dc

Please sign in to comment.