Skip to content

Commit

Permalink
chore: add error handling for held packages during rmw installation (a…
Browse files Browse the repository at this point in the history
…utowarefoundation#4781)

* chore: add error handling for held packages during apt installation

Signed-off-by: Naophis <[email protected]>

* feat: Add check for held ROS packages during installation

Signed-off-by: Naophis <[email protected]>

---------

Signed-off-by: Naophis <[email protected]>
  • Loading branch information
Naophis authored and pravinkmr26 committed Jul 15, 2024
1 parent f41bbcd commit bfefae1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ansible/roles/rmw_implementation/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@
register: rmw_implementation__dash_case_rmw_implementation
changed_when: false

- name: Hold check of ros-{{ rosdistro + '-' + rmw_implementation__dash_case_rmw_implementation.stdout }}
ansible.builtin.command: apt-mark showhold
register: held_ros_packages
changed_when: false

- name: Install ros-{{ rosdistro + '-' + rmw_implementation__dash_case_rmw_implementation.stdout }}
become: true
ansible.builtin.apt:
name: ros-{{ rosdistro }}-{{ rmw_implementation__dash_case_rmw_implementation.stdout }}
state: latest
update_cache: true
when: "'ros-' + rosdistro + '-' + rmw_implementation__dash_case_rmw_implementation.stdout not in held_ros_packages.stdout"
register: install_result
failed_when: false

- name: Display warning if ROS 2 RMW package is held
ansible.builtin.debug:
msg: ROS 2 RMW package 'ros-{{ rosdistro + '-' + rmw_implementation__dash_case_rmw_implementation.stdout }}' is apt-mark hold. Skipping installation.
when: not install_result.changed

- name: Add RMW_IMPLEMENTATION to .bashrc
ansible.builtin.lineinfile:
Expand Down

0 comments on commit bfefae1

Please sign in to comment.