-
Notifications
You must be signed in to change notification settings - Fork 93
corosync config parser minor changes #1415
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
corosync config parser minor changes #1415
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1415 +/- ##
==========================================
+ Coverage 53.63% 53.74% +0.10%
==========================================
Files 80 80
Lines 24081 24058 -23
==========================================
+ Hits 12917 12931 +14
+ Misses 11164 11127 -37 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please add new unit test cases for comments.
- Please add some comments to the data in test case
TestParseSerialize
.
crmsh/corosync_config_format.py
Outdated
fake_secion_name = f'{COMMENT_PREFIX}_{lineno}' | ||
self.on_key_value(fake_secion_name, tokens[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fake_secion_name = f'{COMMENT_PREFIX}_{lineno}' | |
self.on_key_value(fake_secion_name, tokens[2]) | |
fake_key = f'{COMMENT_PREFIX}_{lineno}' | |
self.on_key_value(fake_key, tokens[2]) |
crmsh/corosync_config_format.py
Outdated
self.on_value(value) | ||
self._ofile.write('\n') | ||
if key.startswith(COMMENT_PREFIX): | ||
self._ofile.write(f'# {value}\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self._ofile.write(f'# {value}\n') | |
self.__write_indent(len(self._path_stack)) | |
self._ofile.write('# ') | |
self._ofile.write(value) | |
self._ofile.write('\n') |
- Writing to buffered io directly tends to provide better performance.
- Indentation is needed
crmsh/corosync_config_format.py
Outdated
@@ -8,12 +8,13 @@ | |||
|
|||
|
|||
logger = logging.getLogger(__name__) | |||
COMMENT_PREFIX = '__comment' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMMENT_PREFIX = '__comment' | |
COMMENT_PREFIX = '#comment' |
Using #
will make sure it does not conflict with anything.
fd2d806
to
258d56e
Compare
Changed |
Add these two lines to the header