From 3c4f981fa0dd70a494aef0b0c6c31d63998c553a Mon Sep 17 00:00:00 2001 From: Ross Desmond Date: Mon, 7 Jan 2019 22:21:40 +0000 Subject: [PATCH] Addresses comments from pull-71 * Adds check to allow "/" or no "/" in permissions file * Renames policy definition file to markdown --- examples/{policy_definition.txt => policy_definition.md} | 0 sros2/api/__init__.py | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename examples/{policy_definition.txt => policy_definition.md} (100%) diff --git a/examples/policy_definition.txt b/examples/policy_definition.md similarity index 100% rename from examples/policy_definition.txt rename to examples/policy_definition.md diff --git a/sros2/api/__init__.py b/sros2/api/__init__.py index d9f848b9..77878456 100644 --- a/sros2/api/__init__.py +++ b/sros2/api/__init__.py @@ -389,6 +389,8 @@ def create_permission_file(path, name, domain_id, permissions_dict): topic_dict['/clock'] = {'allow': ['subscribe']} # we have some policies to add ! for topic_name, policy in topic_dict.items(): + # add a "/" if it doesn't exist + formatted_topic_name = "/" + (topic_name.lstrip('/')) tags = [] publish = 'publish' subscribe = 'subscribe' @@ -411,9 +413,8 @@ def create_permission_file(path, name, domain_id, permissions_dict): %s -""" % (tag, 'rt' + topic_name, tag) +""" % (tag, 'rt' + formatted_topic_name, tag) # TODO(mikaelarguedas) remove this hardcoded handling for default parameter topics - service_dict = permissions_dict['services'] default_parameter_topics = [ 'describe_parameters',