History log of /openbmc/entity-manager/scripts/autojson.py (Results 1 – 10 of 10)
Revision Date Author Comments
# ae74f23b 05-Sep-2024 Patrick Williams <patrick@stwcx.xyz>

autojson: handle recursion

In order to allow the configurations directory to have vendor
subdirectories, modify the script slightly for directory traversal
to handle subdirectories.

Tested:

After

autojson: handle recursion

In order to allow the configurations directory to have vendor
subdirectories, modify the script slightly for directory traversal
to handle subdirectories.

Tested:

After performing a `git mv`, the subdirectory files show up in the
`format-code` output.
```
...
formatting file configurations/meta/terminus_2x100g_nic_tsff.json
...
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib8cea8053d558c60e0a89dd6dcddbc4bc0d970fb

show more ...


# 0f3a4d99 04-Dec-2023 Potin Lai <potin.lai@quantatw.com>

Support C-style comments for configuration JSON parsing

1. Add and set ignore_comment to true to all nlohmann::json::parse().
2. Add remove_c_comments() in `validate_configs.py` to remove C-style

Support C-style comments for configuration JSON parsing

1. Add and set ignore_comment to true to all nlohmann::json::parse().
2. Add remove_c_comments() in `validate_configs.py` to remove C-style
comments before loading.
3. Attempt to reformat comments in the `autojson.py` taking liberal
short-cuts which are documented in the script.

Supported comment examples:

- Single-line style comments
```
{
// Single-line style comment (new line)
"Key": "Value" // Single-line comment (end of content)
}
```

- Multi-line style comments
```
{
/* Multi-line style comment */
/*
* Multi-line style comments
*/
}
```

Tested on harma system with manual applied patch below, which contains
a c-style comment in harma-pttv.json file.
Link: https://gerrit.openbmc.org/c/openbmc/entity-manager/+/67469/25

- scripts/autojson.py
Run autojson.py on harma-pttv.json, the output as same as original file.

- scripts/validate_configs.py
Run validate_configs.py passed.

- EntityManager service
EntityManager service loads and probes harma-pttv.json successfully.
```
root@harma:~# busctl introspect xyz.openbmc_project.EntityManager \
> /xyz/openbmc_project/inventory/system/board/Harma_PTTV \
> xyz.openbmc_project.Inventory.Item.Board
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Name property s "Harma PTTV" emits-change
.Probe property s "xyz.openbmc_project.FruDevice({\'BOA... emits-change
.Type property s "Board" emits-change
```

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib235f2aa6a724615dc4c8184577f57abda8e17a6

show more ...


# cad2d1fc 04-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

python: fix flake8 warnings

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If040c21bb65b613d75574d3154daa35c88c43f76


# 478cfd2c 15-Apr-2021 Paul Fertser <fercerpav@gmail.com>

autojson.py: add newline character before the end of file

POSIX standard defines line as something terminating with the newline
character. So the last line of a text file should also have that.

Pop

autojson.py: add newline character before the end of file

POSIX standard defines line as something terminating with the newline
character. So the last line of a text file should also have that.

Popular editors add it automatically so to avoid unnecessary noise in
the diffs between manually edited files and something that went through
autojson.py it should add it as well.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: I1e04b85eb41b8a7d00d506f49f994c6b40eb5fdf

show more ...


# 8dfc466b 19-Apr-2021 Ed Tanous <edtanous@google.com>

Revert "autojson.py: Check the sensor name"

This reverts commit 086f19d287fdc7d7be9c52ad9aee7704e4f339f5.

The recent script change causes errors.
formatting file configurations/1Ux16 Riser.json
Tra

Revert "autojson.py: Check the sensor name"

This reverts commit 086f19d287fdc7d7be9c52ad9aee7704e4f339f5.

The recent script change causes errors.
formatting file configurations/1Ux16 Riser.json
Traceback (most recent call last):
File "/build/openbmcup/build/workspace/sources/entity-manager/scripts/autojson.py", line 30, in <module>
nl = [s['Name'] for s in j['Exposes']]
TypeError: list indices must be integers or slices, not str

Considering the files this fail on have been around for a while, it's
clear they were never tested.

Change-Id: Ibda22e9ce43d1ba8e7a3c02609ef4d135ebb3044

show more ...


# 086f19d2 28-Feb-2021 John Wang <wangzhiqiang.bj@bytedance.com>

autojson.py: Check the sensor name

We may be careless and write down duplicate sensor names
in the json, which will cause the entity-manager to
generate duplicate dbus paths and coredump.

This chan

autojson.py: Check the sensor name

We may be careless and write down duplicate sensor names
in the json, which will cause the entity-manager to
generate duplicate dbus paths and coredump.

This change counts the sensor name and outputs a red alert
message if there are duplicates

Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>
Change-Id: I3363e744d7e0ddf8cb8894e120368a45af4f8de9

show more ...


# ca000e5f 19-Dec-2019 Brad Bishop <bradleyb@fuzziesquirrel.com>

autojson: don't check non-json files

Skip files that don't have a json suffix so other files (like makefiles)
can be placed in the configurations directory.

Change-Id: Ibdb4d29a6a024762d3f90ca410d1

autojson: don't check non-json files

Skip files that don't have a json suffix so other files (like makefiles)
can be placed in the configurations directory.

Change-Id: Ibdb4d29a6a024762d3f90ca410d11815fe641070
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...


# 5ffd8b40 25-Oct-2019 James Feist <james.feist@linux.intel.com>

Add build step to verify json formatting

This will run autojson during the build to verify
that all files are formatted correctly.

Tested: Before this change build failed, after
fixing json file, i

Add build step to verify json formatting

This will run autojson during the build to verify
that all files are formatted correctly.

Tested: Before this change build failed, after
fixing json file, it passed

Change-Id: I119cc898536a972bb7a248143b40d695f880ff2f
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...


# c4e56946 19-Apr-2019 James Feist <james.feist@linux.intel.com>

Sort Exposes Alphabetically By Type

This makes it much easier to find components of
a specific type because they will be grouped together.

Tested: Sensor list was still the same

Change-Id: Iab15be

Sort Exposes Alphabetically By Type

This makes it much easier to find components of
a specific type because they will be grouped together.

Tested: Sensor list was still the same

Change-Id: Iab15be34e003be1aac120864c18a80eaaa9b391c
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...


# 3cb5fece 23-Jan-2018 James Feist <james.feist@linux.intel.com>

Move components from proving-ground

Move all needed components from proving ground to this
repo. Some clean up was done in json files to fix probes
as well as some slight modification to readme.

Ch

Move components from proving-ground

Move all needed components from proving ground to this
repo. Some clean up was done in json files to fix probes
as well as some slight modification to readme.

Change-Id: I05b7f6459704640c4850420a4573d157500d0aff
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...