[Mellanox] Fix issue: watchdogutil command does not work (#16091) - Why I did it watchdogutil uses platform API watchdog instance to control/query watchdog status. In Nvidia watchdog status, it caches "armed" status in a object member "WatchdogImplBase.armed". This is not working for CLI infrastructure because each CLI will create a new watchdog instance, the status cached in previous instance will totally lose. Consider following commands: admin@sonic:~$ sudo watchdogutil arm -s 100 =====> watchdog instance1, armed=True Watchdog armed for 100 seconds admin@sonic:~$ sudo watchdogutil status ======> watchdog instance2, armed=False Status: Unarmed admin@sonic:~$ sudo watchdogutil disarm =======> watchdog instance3, armed=False Failed to disarm Watchdog - How I did it Use sysfs to query watchdog status - How to verify it Manual test Unit test Conflicts: platform/mellanox/mlnx-platform-api/sonic_platform/watchdog.py platform/mellanox/mlnx-platform-api/tests/test_watchdog.py #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PostCherryPick | |
on: | |
pull_request_target: | |
types: | |
- closed | |
branches: | |
- '20*' | |
jobs: | |
post_cherry_pick: | |
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'automerge') && github.event.pull_request.head.user.login == 'mssonicbld' && startsWith(github.event.pull_request.title, '[action]') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Debug | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo $GITHUB_CONTEXT | jq | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Main | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
TOKEN: ${{ secrets.TOKEN }} | |
run: | | |
set -e | |
pr_url=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request._links.html.href") | |
pr_id=$(echo $GITHUB_CONTEXT | jq -r ".event.number") | |
base_ref=$(echo $GITHUB_CONTEXT | jq -r ".base_ref") | |
echo ${TOKEN} | gh auth login --with-token | |
title=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.title") | |
origin_pr_id=$(echo $title | grep -Eo "\[action\] \[PR:[0-9]*\]" | grep -Eo "[0-9]*") | |
origin_pr_url=$(echo $pr_url | sed "s/$pr_id/$origin_pr_id/") | |
echo ============================= | |
echo pr_url: $pr_url | |
echo pr_id: $pr_id | |
echo base_ref: $base_ref | |
echo title: $title | |
echo origin_pr_id: $origin_pr_id | |
echo origin_pr_url: $origin_pr_url | |
echo ============================= | |
# Add label | |
if [[ "$origin_pr_id" == "" ]];then | |
echo "original PR didn't found." | |
exit 1 | |
fi | |
gh pr edit $origin_pr_url --add-label "Included in ${base_ref} Branch" | |
gh pr edit $origin_pr_url --remove-label "Created PR to ${base_ref} Branch,Approved for ${base_ref} Branch" |