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

[action] [PR:145] Fix modify_single_file generate empty file issue (#145) #151

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

mssonicbld
Copy link

Fix hostcfgd modify_single_file method generates empty file issue

Why I did it

Fix hostcfgd modify_single_file method generates empty file issue: sonic-net/sonic-buildimage#19748

In the original code, there are 2 'mv' commands to backup and copy new file, if hostcfgd crash between those 2 commands, the original file will be removed, then when hostcfgd restart later, it will generate a empty file.

The issue can be fix by use cp command.

Work item tracking
  • Microsoft ADO: 29064569

How I did it

Replace 'mv' command to 'cp' command

How to verify it

Manually verified.
Pass all test case.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

will updated with this PR image later.

  • [] SONiC.master-16482.360728-2c8b4066f

Description for the changelog

Fix hostcfgd modify_single_file method generates empty file issue

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Fix hostcfgd modify_single_file method generates empty file issue

#### Why I did it
Fix hostcfgd modify_single_file method generates empty file issue: sonic-net/sonic-buildimage#19748

In the original code, there are 2 'mv' commands to backup and copy new file, if hostcfgd crash between those 2 commands, the original file will be removed, then when hostcfgd restart later, it will generate a empty file.

The issue can be fix by use cp command.

##### Work item tracking
- Microsoft ADO: 29064569

#### How I did it
Replace 'mv' command to 'cp' command

#### How to verify it
Manually verified.
Pass all test case.

<!--
If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012.
-->

#### Which release branch to backport (provide reason below if selected)

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211
- [ ] 202305

#### Tested branch (Please provide the tested image version)

<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

will updated with this PR image later.
- [] SONiC.master-16482.360728-2c8b4066f

#### Description for the changelog
Fix hostcfgd modify_single_file method generates empty file issue

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->

#### A picture of a cute animal (not mandatory but encouraged)
@mssonicbld
Copy link
Author

Original PR: #145

@mssonicbld mssonicbld merged commit 40dda80 into sonic-net:202405 Aug 24, 2024
5 checks passed
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.

2 participants