Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ def _stop_services():
'hostcfgd',
]

# on Mellanox platform pmon is stopped by syncd
if (version_info and version_info.get('asic_type') == 'mellanox'):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parenthesis not required here (lets remove to be more python-way consistent).
Also, in which cases bool(version_info) == False ? Let's teat it as undefined platform error, otherwise we hide the problem and keep pmon in the list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the beginning of the file lets initialize asic_type like this:

try:
    asic_type = version_info['asic_type']
except KeyError, TypeError:
    click.abort('undefined ASIC type')

Any subsequent code that uses asic_type knows that it is initialized correctly

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

services_to_stop.remove('pmon')

for service in services_to_stop:
try:
click.echo("Stopping service {} ...".format(service))
Expand Down Expand Up @@ -349,6 +353,10 @@ def _restart_services():
'hostcfgd',
]

# on Mellanox platform pmon is started by syncd
if (version_info and version_info.get('asic_type') == 'mellanox'):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

services_to_restart.remove('pmon')

for service in services_to_restart:
try:
click.echo("Restarting service {} ...".format(service))
Expand Down