Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial permissions not working #79

Closed
mikaelarguedas opened this issue Feb 18, 2019 · 5 comments
Closed

Tutorial permissions not working #79

mikaelarguedas opened this issue Feb 18, 2019 · 5 comments
Assignees

Comments

@mikaelarguedas
Copy link
Member

mikaelarguedas commented Feb 18, 2019

Bug report

Required Info:

  • Operating System:
    • Ubuntu Bionic
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • N/A
  • Client library (if applicable):
    • N/A

Steps to reproduce issue

Follow the SROS2_Linux Tutorial until Access control section

or

$ docker run -it --rm ros:crystal
apt update && apt upgrade -y && apt install -y curl ros-crystal-demo-nodes-cpp ros-crystal-demo-nodes-py ros-crystal-sros2 
mkdir ~/sros2_demo && cd ~/sros2_demo
ros2 security create_keystore demo_keys
ros2 security create_key demo_keys talker
ros2 security create_key demo_keys listener
curl -sk https://raw.githubusercontent.com/ros2/sros2/master/examples/sample_policy.yaml -o ./demo_keys/policies.yaml
ros2 security create_permission demo_keys talker demo_keys/policies.yaml

Expected behavior

Generate permission.xml files and be able to use access control

Actual behavior

Fails to create permission files.

Additional information

Error1
Traceback (most recent call last):
  File "/opt/ros/crystal/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.6.3', 'console_scripts', 'ros2')()
  File "/opt/ros/crystal/lib/python3.6/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/command/security.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/verb/create_permission.py", line 44, in main
    success = create_permission(args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 522, in create_permission
    permissions_dict = get_permissions(name, policy_file_path)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 500, in get_permissions
    return graph['nodes'][name]
KeyError: 'nodes'

Reason: the url https://raw.githubusercontent.com/ros2/sros2/master/examples/sample_policy.yaml is broken, the file is now at https://raw.githubusercontent.com/ros2/sros2/sros2/master/examples/sample_policy.yaml

Error2 (using the updated URL)
ros2 security create_permission demo_keys talker demo_keys/policies.yaml
Namespace(NAME='talker', POLICY_FILE_PATH='demo_keys/policies.yaml', ROOT='demo_keys', _command=<sros2.command.security.SecurityCommand object at 0x7f67d0927860>, _verb=<sros2.verb.create_permission.CreatePermissionVerb object at 0x7f67cbccbdd8>, **{' command': 'security', ' verb': 'create_permission'})
key_dir demo_keys/talker
while scanning a simple key
  in "demo_keys/policies.yaml", line 30, column 9
could not find expected ':'
  in "demo_keys/policies.yaml", line 31, column 7

The file is invalid yaml format.
The file is missing whitespaces line 30 and 36

Error3(using valid yaml file)
Traceback (most recent call last):
  File "/opt/ros/crystal/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.6.3', 'console_scripts', 'ros2')()
  File "/opt/ros/crystal/lib/python3.6/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/command/security.py", line 37, in main
    return extension.main(args=args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/verb/create_permission.py", line 44, in main
    success = create_permission(args)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 524, in create_permission
    create_permission_file(permissions_path, name, domain_id, permissions_dict)
  File "/opt/ros/crystal/lib/python3.6/site-packages/sros2/api/__init__.py", line 425, in create_permission_file
    service_dict = permissions_dict['services']
KeyError: 'services'

@ross-desmond @jacobperron Is there another policy file to use for the Linux tutorial ?

I will try the code and tutorial from #72 to see if the issue is resolved with the xml version

Update
I got the tutorial working using #72 + #80

@ross-desmond
Copy link
Contributor

ross-desmond commented Feb 18, 2019 via email

@ross-desmond
Copy link
Contributor

Since we are moving to #72 and #80, a fix in the yaml version may not be necessary, but should one be necessary in the meantime: #81

@jacobperron
Copy link
Member

Since we are moving to #72 and #80, a fix in the yaml version may not be necessary, but should one be necessary in the meantime: #81

Since #72 is a significant change to the policy format, I think it's probably better to merge #81 first, and backport it as a patch for Crystal so the tutorial is not broken.

@mjcarroll FYI

@mjcarroll mjcarroll self-assigned this Feb 28, 2019
@mjcarroll mjcarroll added the in progress Actively being worked on (Kanban column) label Feb 28, 2019
@mjcarroll
Copy link
Member

mjcarroll commented Mar 19, 2019

Update
I got the tutorial working using #72 + #80

@mikaelarguedas Is this resolved now?

@mikaelarguedas
Copy link
Member Author

mikaelarguedas Is this resolved now?

Yes, #99 was the last blocker 👍

@mikaelarguedas mikaelarguedas removed the in progress Actively being worked on (Kanban column) label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants