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

[thermalctld] [psud] [chassisd] Fix crash with undefined environment variable #120

Merged
merged 2 commits into from
Nov 17, 2020

Conversation

bratashX
Copy link
Contributor

@bratashX bratashX commented Nov 16, 2020

When PSUD_UNIT_TESTING and THERMALCTLD_UNIT_TESTING variables don`t set we have the next problems:

 psud Traceback (most recent call last):
 psud File "/usr/local/bin/psud", line 21, in <module>
 psud if os.environ["PSUD_UNIT_TESTING"] == "1":
 psud File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
 psud raise KeyError(key)
 psud KeyError: 'PSUD_UNIT_TESTING'
 thermalctld Traceback (most recent call last):
 thermalctld File "/usr/local/bin/thermalctld", line 19, in <module>
 thermalctld if os.environ["THERMALCTLD_UNIT_TESTING"] == "1":
 thermalctld File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
 thermalctld raise KeyError(key)
 thermalctld KeyError: 'THERMALCTLD_UNIT_TESTING'

Also fixed the same issue in chassisd.

Signed-off-by: Petro Bratash [email protected]

Signed-off-by: Petro Bratash <[email protected]>
Signed-off-by: Petro Bratash <[email protected]>
@bratashX
Copy link
Contributor Author

@akokhan, please review

@bratashX bratashX changed the title [thermalctld] [psud] Fix crash with undefined environment variable [thermalctld] [psud] [chassisd] Fix crash with undefined environment variable Nov 16, 2020
@jleveque jleveque merged commit f63ec30 into sonic-net:master Nov 17, 2020
@bratashX
Copy link
Contributor Author

@jleveque CI failure when update submodule: sonic-net/sonic-buildimage#5945
Could you please say how to run this unit-tests manually?


=================================== FAILURES ===================================
______________________ test_updater_thermal_check_min_max ______________________

    def test_updater_thermal_check_min_max():
        chassis = MockChassis()
    
        thermal = MockThermal()
        chassis.get_all_thermals().append(thermal)
    
        chassis.set_modular_chassis(True)
        chassis.set_my_slot(1)
        temperature_updater = TemperatureUpdater(SYSLOG_IDENTIFIER, chassis)
    
        temperature_updater.update()
        slot_dict = temperature_updater.chassis_table.get('Thermal 1')
>       assert slot_dict['minimum_temperature'] == str(thermal.get_minimum_recorded())
E       TypeError: 'NoneType' object has no attribute '__getitem__'

tests/test_thermalctld.py:341: TypeError
===================== 1 failed, 16 passed in 0.36 seconds ====================

@jleveque
Copy link
Contributor

@bratashX: You should be able to follow the instructions for sonic-utilities, but reference the thermalctld package instead: https://github.com/Azure/sonic-utilities/blob/master/README.md#setting-up-a-buildtest-environment.

@bratashX
Copy link
Contributor Author

@bratashX: You should be able to follow the instructions for sonic-utilities, but reference the thermalctld package instead: https://github.com/Azure/sonic-utilities/blob/master/README.md#setting-up-a-buildtest-environment.

@jleveque, thanks

jleveque pushed a commit that referenced this pull request Nov 19, 2020
…variable (#120)

When  `PSUD_UNIT_TESTING` and  `THERMALCTLD_UNIT_TESTING` variables don`t set we have the next problems:
```
 psud Traceback (most recent call last):
 psud File "/usr/local/bin/psud", line 21, in <module>
 psud if os.environ["PSUD_UNIT_TESTING"] == "1":
 psud File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
 psud raise KeyError(key)
 psud KeyError: 'PSUD_UNIT_TESTING'
```

```
 thermalctld Traceback (most recent call last):
 thermalctld File "/usr/local/bin/thermalctld", line 19, in <module>
 thermalctld if os.environ["THERMALCTLD_UNIT_TESTING"] == "1":
 thermalctld File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__
 thermalctld raise KeyError(key)
 thermalctld KeyError: 'THERMALCTLD_UNIT_TESTING'
```

Also fixed the same issue in `chassisd`.

Signed-off-by: Petro Bratash <[email protected]>
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
Update dependencies in setup.py to align with current needs. This allows for implicit installation of dependencies at build and run time, and prevents the need to explicitly install these packages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants