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

modify syncd init script for supporting yml #1411

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

geans-pin
Copy link
Contributor

No description provided.

Copy link

linux-foundation-easycla bot commented Aug 8, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

if [ ! -z "$line" ];then
if [ "${line::1}" == '#' ];then
echo $line >> $to_file
elif [ "$line" == "[Overwrite Section]" ];then

Choose a reason for hiding this comment

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

If there is an extra space at end, no match will happen, right? How to consider this scenario?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the script will skip empty lines

echo "Merge properties with override $override"
else
sedline=${line%=*}
if grep -q $sedline $to_file ;then

Choose a reason for hiding this comment

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

@geans-pin If there is "a=1" in overwrite section and "aa=1" in to_file, the sedline is a, but grep -q $sedline $to_file, still return true for this case, right? Will aa=1 be overwritten by a=1?

Copy link
Contributor Author

@geans-pin geans-pin Sep 19, 2024

Choose a reason for hiding this comment

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

In the config property, we grep for the property name. It's unlikely to have the a and aa case.
The property name will be coming along with a meaningful naming prefix.

if [ ! -z "$PLT_CONFIG_YML" ] && [ -f $PLATFORM_DIR/common_config_support ]; then
cp -f $HWSKU_DIR/*.config.yml /tmp
cp -f /etc/sai.d/sai.profile /tmp
CONFIG_YML=$(find /tmp -name '*.yml')

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use the file name .yml suffix to identify the file format. Can you change the sai.profile and *.config.bcm to *.yml as following BRCM SDK rule ?

if [ ! -z "$line" ];then
if [ "${line::1}" == '#' ];then
echo " $line" >> $to_file
elif [ "$line" == "[Overwrite Section]"];then

Choose a reason for hiding this comment

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

@geans-pin Overwrite section should be after [Normal Section], if we move overwrite section before [Normal Section], the logic here will not work and will overwrite all properties, is it right? Do we have a comment to remind this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good catch. Let's have a comment in the script and HLD

@kcudnik
Copy link
Collaborator

kcudnik commented Oct 2, 2024

what is motivation here? please provide extended descrption for this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants