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

Create and update Asset tag for the system #483

Open
wants to merge 1 commit into
base: P11_Dev
Choose a base branch
from

Conversation

SunnySrivastava1984
Copy link
Collaborator

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.

include/manager.hpp Outdated Show resolved Hide resolved
include/manager.hpp Outdated Show resolved Hide resolved
include/worker.hpp Outdated Show resolved Hide resolved
src/manager.cpp Show resolved Hide resolved
@@ -417,6 +417,8 @@ void Worker::setDeviceTreeAndJson()
ec.message());
}
}

m_isFactoryResetDone = true;
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

src/worker.cpp Outdated Show resolved Hide resolved
src/worker.cpp Outdated Show resolved Hide resolved
include/worker.hpp Outdated Show resolved Hide resolved
@@ -417,6 +417,8 @@ void Worker::setDeviceTreeAndJson()
ec.message());
}
}

m_isFactoryResetDone = true;

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

Copy link
Collaborator Author

@SunnySrivastava1984 SunnySrivastava1984 Nov 13, 2024

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.

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);

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.

Copy link
Collaborator Author

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.

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.");

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 ?

Copy link
Collaborator Author

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.

include/manager.hpp Outdated Show resolved Hide resolved
include/manager.hpp Outdated Show resolved Hide resolved
src/worker.cpp Outdated Show resolved Hide resolved
src/worker.cpp Show resolved Hide resolved
src/worker.cpp Outdated
}
else
{
throw std::runtime_error("Asset tag string is empty.");
Copy link
Collaborator

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 ?

Copy link
Collaborator Author

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.

src/worker.cpp Show resolved Hide resolved
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]>
@@ -417,6 +417,8 @@ void Worker::setDeviceTreeAndJson()
ec.message());
}
}

m_isFactoryResetDone = true;

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);

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.

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.

4 participants