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

Migrate the kickstart script commands #5739

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adamkankovsky
Copy link
Contributor

@adamkankovsky adamkankovsky commented Jul 3, 2024

Working with: #5775
Thanks @rvykydal.

@pep8speaks
Copy link

pep8speaks commented Jul 3, 2024

Hello @adamkankovsky! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-10-02 14:03:14 UTC

@adamkankovsky adamkankovsky marked this pull request as draft July 3, 2024 06:22
@github-actions github-actions bot added the f41 label Jul 3, 2024
Copy link
Member

@jkonecny12 jkonecny12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise looks good to me so far.

scriptsdir = $(pkgpyexecdir)/modules/runtime/scripts
dist_scripts_DATA = $(wildcard $(srcdir)/*.py)

MAINTAINERCLEANFILES = Makefile.in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MAINTAINERCLEANFILES = Makefile.in
MAINTAINERCLEANFILES = Makefile.in

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add missing newline at the end of the file.

# along with this program. If not, see <http://www.gnu.org/licenses/>.

pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
scriptsdir = $(pkgpyexecdir)/modules/runtime/scripts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling that his will not work correctly. There is already scriptsdir variable (scripts/Makefile.am) and I have a feeling these are global. I'm not 100% sure how ti behaves so please make sure that your commit won't break automake and both directories are processed correctly by automake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far everything works as it should and there is no problem with the module

@rvykydal
Copy link
Contributor

rvykydal commented Jul 18, 2024

I'll just add link to my WIP before @adamkankovsky took over: #5775, may be useful for reference. (I used Katerina's WIP in the same way).
In my notes in 9d3fb85 I say %pre is most challenging, so maybe it is good to work on it first, like Adam does.

@adamkankovsky adamkankovsky marked this pull request as ready for review July 23, 2024 13:15
@adamkankovsky adamkankovsky changed the title Migrate the %pre script Migrate the kickstart script commands Jul 24, 2024
@adamkankovsky
Copy link
Contributor Author

/kickstart-test --testtype smoke

@adamkankovsky
Copy link
Contributor Author

/kickstart-test --testtype smoke

Copy link
Member

@jkonecny12 jkonecny12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great otherwise.
Also please take a look on coverage. I'm surprised that for such a change we don't have any new tests.

execution.
Output is logged by the program logger, the path specified by --log
or to /tmp/ks-script-\\*.log
# TODORV return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is leftover.

@@ -0,0 +1,80 @@
#
# Commond utilities for working with scripts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commond is typo?

Comment on lines +94 to +95
self.scripts = []

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because sections for scripts don't have a data parser like packages does, and sections themselves don't have an action to create an array for scitps. Therefore it is necessary to create it manually. It looks quite strange, but I spent a lot of time on this parsing and unfortunately I didn't come up with anything better using pykickstart

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add comment explaining this?

for script in self._scripts:
if script.type == self._script_type:
if script.type == KS_SCRIPT_POST:
script.run(conf.target.system_root)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this correctly then you are saying that post script is always run in chroot. That is not correct it depends on --nochroot parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only the path which is used if --chroot is set. Default is always "/".

__all__ = ["ScriptsModule"]


class RunScriptsTask(Task):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please separate this class into another file.

@adamkankovsky
Copy link
Contributor Author

/kickstart-test --testtype smoke

@adamkankovsky
Copy link
Contributor Author

/kickstart-test --kstest-pr 1302 --skip-testtypes whatever

Copy link
Member

@jkonecny12 jkonecny12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better. However, I don't almost any tests.

You are adding a new Task and a new module and none of these are covered by tests. Please take a look on test coverage to see what is missing.

pyanaconda/modules/runtime/scripts/runtime.py Outdated Show resolved Hide resolved
Copy link
Member

@jkonecny12 jkonecny12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants