-
Notifications
You must be signed in to change notification settings - Fork 21
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
Create and update Asset tag for the system #483
base: P11_Dev
Are you sure you want to change the base?
Conversation
5d25e1b
to
dd6b211
Compare
@@ -417,6 +417,8 @@ void Worker::setDeviceTreeAndJson() | |||
ec.message()); | |||
} | |||
} | |||
|
|||
m_isFactoryResetDone = true; |
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.
will the above throw cause any issue to this value ? guess not , wanted your confirmation
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.
No, as of now, in case of throw above this place, we exit the service. Hence from our application point of view we have still not processed factory reset flow.
@@ -417,6 +417,8 @@ void Worker::setDeviceTreeAndJson() | |||
ec.message()); | |||
} | |||
} | |||
|
|||
m_isFactoryResetDone = true; |
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.
I think "m_isFactoryResetApplied" suits more
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.
No, Applied has a different meaning.
Done implies that an action has been finished. This variable denotes that when we are reaching this point of code, there has been a factory reset done in the system.
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.
okay
if (auto l_parsedVpdMap = | ||
std::get_if<types::IPZVpdMap>(&i_parsedVpdMap)) | ||
{ | ||
auto l_itrToVsys = (*l_parsedVpdMap).find(constants::recVSYS); |
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.
we can create this variable inside if condition .
As this variable is not being used outside anywhere.
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.
"l_itrToVsys" is being used in the "if" condition itself.
We can't check it before creation.
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.
I meant to create in the if condition itself.
but still its fine as its scope is limited.
src/worker.cpp
Outdated
if (l_itrToSystemPath == objectInterfaceMap.end()) | ||
{ | ||
throw std::runtime_error( | ||
"System Path not found in object map."); |
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.
Can we mention the path here ?
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.
All these throw will be caught at line 1194.
At line 1194 we have to implement a pel. There the path can be added as callout. If I add that again in the trace. It will be duplicated.
dd6b211
to
95fcb6e
Compare
892f784
to
ed55c01
Compare
src/worker.cpp
Outdated
} | ||
else | ||
{ | ||
throw std::runtime_error("Asset tag string is empty."); |
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.
don't we need to still create the Asset tag object and property even if we cannot fill the value ?
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.
Yes we should add, so that it can be updated via GUI.
I have updated the code to handle the empty scenario as well.
The commit creates and Asset tag for the system in case of first time boot or factory reset situation and adds Asset tag inerface under system inevntory path. It also registers callback to detect any change in asset tag value and calls PIM notify to persist the data. Signed-off-by: Sunny Srivastava <[email protected]>
ed55c01
to
efdac64
Compare
@@ -417,6 +417,8 @@ void Worker::setDeviceTreeAndJson() | |||
ec.message()); | |||
} | |||
} | |||
|
|||
m_isFactoryResetDone = true; |
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.
okay
if (auto l_parsedVpdMap = | ||
std::get_if<types::IPZVpdMap>(&i_parsedVpdMap)) | ||
{ | ||
auto l_itrToVsys = (*l_parsedVpdMap).find(constants::recVSYS); |
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.
I meant to create in the if condition itself.
but still its fine as its scope is limited.
The commit creates and Asset tag for the system in case of first time boot or factory reset situation and adds Asset tag inerface under system inevntory path.
It also registers callback to detect any change in asset tag value and calls PIM notify to persist the data.