Take input from file for write keyword #598
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds code to read keyword’s value from the local file to update keyword’s value. User can provide file path where the value exists using --file option.
Output:
‘’’
Write keyword using object path (both primary and backup path VPD gets updated)
Before update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r {
"/system/chassis/motherboard": {
"BR": "S0"
}
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H {
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"BR": "S0"
}
}
Input file (In ASCII format):
root@p10bmc:/tmp# cat input.txt
A2
Update keyword command:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -w --file input.txt Data updated successfully
After update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r {
"/system/chassis/motherboard": {
"BR": "A2"
}
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H {
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"BR": "A2"
}
}
Write keyword using hardware path (updates only given hardware path):
Input file (In hexadecimal format):
root@p10bmc:/tmp# cat input.txt
0x5330
Update keyword command:
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -w -H --file input.txt Data updated successfully
After update:
root@p10bmc:/tmp# ./vpd-tool -O /system/chassis/motherboard -R VSYS -K BR -r {
"/system/chassis/motherboard": {
"BR": "A2"
}
}
root@p10bmc:/tmp# ./vpd-tool -O /sys/bus/i2c/drivers/at24/8-0050/eeprom -R VSYS -K BR -r -H {
"/sys/bus/i2c/drivers/at24/8-0050/eeprom": {
"BR": "S0"
}
}
‘’’