Skip to content

Commit d40d086

Browse files
committed
Simplify code
Signed-off-by: maipbui <[email protected]>
1 parent 109303e commit d40d086

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

device/juniper/x86_64-juniper_qfx5200-r0/plugins/qfx5200_eeprom_data.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ def main():
177177

178178
MainEepromFileCmd = ['cat', '/sys/bus/i2c/devices/i2c-0/0-0057/eeprom']
179179
out_file = '/etc/init.d/MainEeprom_qfx5200_ascii'
180-
content = subprocess.run(MainEepromFileCmd, universal_newlines=True, capture_output=True).stdout
181180
with open(out_file, 'w') as file:
182-
file.write(content)
181+
subprocess.run(MainEepromFileCmd, universal_newlines=True, stdout=file)
183182

184183
maineeprom_ascii = '/etc/init.d/MainEeprom_qfx5200_ascii'
185184

device/juniper/x86_64-juniper_qfx5210-r0/plugins/qfx5210_eeprom_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import os
3636
import binascii
37+
import subprocess
3738
from sonic_eeprom import eeprom_tlvinfo
3839

3940

@@ -84,9 +85,8 @@ def main():
8485
CPUeepromFileCmd = ['cat', '/sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom']
8586
# Write the contents of CPU EEPROM to file
8687
out_file = '/etc/init.d/eeprom_qfx5210_ascii'
87-
content = subprocess.run(CPUeepromFileCmd, universal_newlines=True, capture_output=True).stdout
8888
with open(out_file, 'w') as file:
89-
file.write(content)
89+
subprocess.run(CPUeepromFileCmd, universal_newlines=True, stdout=file)
9090

9191
eeprom_ascii = '/etc/init.d/eeprom_qfx5210_ascii'
9292
# Read file contents in Hex format

0 commit comments

Comments
 (0)