-
Notifications
You must be signed in to change notification settings - Fork 3
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
[CLOYSTER-165] Generate answer file based on TUI data #91
base: master
Are you sure you want to change the base?
Conversation
|
||
void AnswerFile::dumpNodes(inifile& ini) | ||
{ | ||
size_t counter = 1; |
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.
What if the cluster does not have any nodes? It's a workstation.
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.
Then, how the answer file would be?
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.
The node group is optional, or it should be, so you'll automatically figure out if it has nodes or not.
void AnswerFile::loadNetwork(const std::string& networkSection, | ||
NetworkType& network, bool optionalNameservers) | ||
AFNetwork& network, bool optionalNameservers) |
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 really dislike this AFNetwork type. What this means?
I'm aware that isn't this PR fault, but this type does not makes sense.
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.
The question is: why was this function generic?
the AFNetwork type, from what I saw, stores network parameters
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.
Probably bad implementation. It should fill the Cluster object without temporary storages.
include/cloysterhpc/answerfile.h
Outdated
* Do the inverse of `loadOptions`, i.e, move the stored settings | ||
* into the answerfile. | ||
*/ | ||
void dumpOptions(inifile& ini); |
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.
const inifile&
?
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.
You're right. I vacillated here
include/cloysterhpc/answerfile.h
Outdated
@@ -188,13 +194,17 @@ class AnswerFile { | |||
*/ | |||
void loadExternalNetwork(); | |||
|
|||
void dumpExternalNetwork(inifile& ini); |
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.
inifile
is passed too many times. It should be a member.
|
||
void AnswerFile::dumpPostfix(inifile& ini) | ||
{ | ||
if (!postfix.enabled) { |
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.
The source of this seems strange. Is it a bool on mail class? If yes that's a bug. The class should be std::optional
.
case Postfix::Profile::Relay: | ||
ini.setValue("postfix.relay", "server", postfix.smtp->server); | ||
ini.setValue( | ||
"postfix.relay", "port", std::to_string(postfix.smtp->port)); |
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.
int
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.
unsigned
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.
std::uint16_t
src/answerfile.cpp
Outdated
dumpExternalNetwork(ini); | ||
dumpManagementNetwork(ini); | ||
dumpApplicationNetwork(ini); | ||
dumpInformation(ini); | ||
dumpTimeSettings(ini); | ||
dumpHostnameSettings(ini); | ||
dumpSystemSettings(ini); |
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.
You see, it should be a member.
Arthur, plz give an precise description of the feature in the PR description (: |
I don't understand why Github shows changes from PR's that were already merged. I could not read the code anymore because everything is mixed. Is that how this works? |
6e3138f
to
89de020
Compare
conanfile.txt
Outdated
[requires] | ||
cli11/[>=2.4.0 <2.5.0] | ||
spdlog/[>=1.14.0 <1.15.0] | ||
fmt/[>=10.0.0 <12.0.0] | ||
boost/[>=1.83.0 <1.84.0] | ||
magic_enum/[>=0.9.0 <0.10.0] | ||
gsl-lite/[>=0.41.0 <0.42.0] | ||
doctest/[>=2.4.0 <2.5.0] | ||
cryptopp/[>=8.9.0 <8.10.0] | ||
sdbus-cpp/[>=2.0.0 <2.1.0] | ||
|
||
[layout] | ||
cmake_layout |
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 guess this file need to be deleted in favor of connanfile.py
, right?
@viniciusferrao
struct AFNode { | ||
std::optional<std::string> prefix; | ||
std::optional<std::string> padding; | ||
std::optional<address> start_ip = address(); | ||
std::optional<std::string> hostname; | ||
std::optional<std::string> root_password; | ||
std::optional<std::string> mac_address; | ||
std::optional<std::string> sockets; | ||
std::optional<std::string> cores_per_socket; | ||
std::optional<std::string> threads_per_core; | ||
std::optional<std::string> bmc_address; | ||
std::optional<std::string> bmc_username; | ||
std::optional<std::string> bmc_password; | ||
std::optional<std::string> bmc_serialport; | ||
std::optional<std::string> bmc_serialspeed; | ||
}; |
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.
Is prefix
and padding
sensical for a single node? Remove it if it doesn't please.
Also, I guess it is ip
instead of start_ip
?
And some fields like sockets and core_pre_socket should be positive integers, instead of strings, @viniciusferrao uint16_t
again?
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.
Prefix is the node prefix, like: n
or node
. The padding is the number of digits a sequence should have, example, a padding of 1 will produce n01
, 2 will be node001
. None will be just n1
, or node1
.
Finally the start_ip
is considering a formation of nodes, that will be filled in sequence.
So yes, it seems misplaced, because it looks like it should be calculated and not hardcoded.
Regarding the other fields, yes, they must have strong typing. However I'm not sure how SimpleIni
handles this. I very much dislike everything being std::string
.
How can I run the TUI and get the anwerfile without running the remaining of the installation? |
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 it also possible to write answerfile in extension instead of AF
? Maybe answer_file
?
Let's try to merge this as soon as possible so we can move on to glibmm
.
The only thing missing is to generate the answerfile and stop (do not continue the installation), the remaining of the code LGTM |
That can be (not should) on |
a47101a
to
0be1187
Compare
Signed-off-by: Vinícius Ferrão <[email protected]> Fixed more outrageous bugs. The program is now able to at least boot a compute node again Signed-off-by: Vinícius Ferrão <[email protected]> Disable cosmetic warnings Pin spdlog version Run clang-format Handle copy to temporary file error Fix message in CMakeLists.txt Handle error in answerfile minor version Fix routing error disabling the VM network Enable Managed network again Fix answerfile version handling Fix copyFile implementation Fix typos, change variables names and fix throw. * Fix typos in the documentation. * Fix typos on LOG messages. * Change variable names to be more accurate with the context. * Rethrow should also follow the golden rule of: throw by value and catch by reference. Signed-off-by: Vinícius Ferrão <[email protected]> Clearning more warnings Fix the last warnings Remove std::exit call, and raise an exception instead Run clang-format Added version ranges to conanfile.txt This change will keep the project more reliable while still getting updates from upstream on minor versions. Signed-off-by: Vinícius Ferrão <[email protected]> Last try to fix clang-format Signed-off-by: Vinícius Ferrão <[email protected]>
This parameter was unneeded, we can use the member m_ini parameter
0be1187
to
58ba2db
Compare
src/main.cpp
Outdated
LOG_TRACE("Starting execution engine"); | ||
model->dumpData("answerfile.result.ini"); | ||
|
||
return EXIT_SUCCESS; |
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.
This will stop the execution unconditionally, remove it. To generate the file without executing it we can already use dry run
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.
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'm getting a permission error when executing it, we should add a command line option to where the answerfile should be generated, --dump-answerfile=<PATH>
and use answerfile-<DATE>.conf
as default, where <DATE>
is the current date. This will prevent anwerfiles to be rewritten.
I'm having weird messages at the background of the TUI, I guess this is a bug?
, maybe this is because of the -l6?
Confirming, yes it is because of the -l6
, it's okay I guess. @viniciusferrao What do you think? Is -l6
supposed to be used by the end user?
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'm getting a permission error when executing it, we should add a command line option to where the answerfile should be generated,
--dump-answerfile=<PATH>
and useanswerfile-<DATE>.conf
as default, where<DATE>
is the current date. This will prevent anwerfiles to be rewritten.I'm having weird messages at the background of the TUI, I guess this is a bug? , maybe this is because of the
-l6?
Confirming, yes it is because of the
-l6
, it's okay I guess. @viniciusferrao What do you think? Is-l6
supposed to be used by the end user?
This is and isn't a bug at the same time. If you see other applications, when there's warnings or errors it overwrites the newt library, which is expected.
But what is happening here is that the log should be preferrabily written to a file instead of stdout
. If you call the TUI it's obvious that the output should be on a file.
If running in unattended mode it should be on stdout. That's the problem here.
The view
isn't implemented correctly. However even after fixing this will still occour, however much less, and many times it will not even happen. Errors should be thrown using the TUI composing.
For now I would leave it as is.
One is for the lack of one, the other is code after one
@@ -42,6 +42,8 @@ class NetworkCreator { | |||
bool checkIfInterfaceRegistered(std::string_view interface); | |||
|
|||
void saveNetworksToModel(Cluster& model); | |||
|
|||
size_t getSelectedInterfaces(); |
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.
std::size_t
.
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.
It's the same thing, no?
@viniciusferrao If we run with I think we should add an Here is a behavioral specification suggestion:
|
@dhilst OK, we will solve this in a future PR |
Quality Gate passedIssues Measures |
Dump the data from the cluster, filled by the TUI, into an answer file.
Useful for debugging