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

Add, or consistenly use, a method that can parse the file RELEASE #510

Closed
bschmalhofer opened this issue Oct 2, 2020 · 10 comments
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bschmalhofer
Copy link
Contributor

I have encountered at least two locations where the file RELEASE is parsed. IMHO there should a dedicated function for that. A dedicated module is probably overkill. Maybe a function in Kernel::System::Main suffices.

Alternatively: Convert RELEASE to JSON or YAML

@bschmalhofer bschmalhofer added the enhancement New feature or request label Oct 2, 2020
@bschmalhofer bschmalhofer added this to the Wishlist milestone Oct 2, 2020
@bschmalhofer
Copy link
Contributor Author

A similar thing might apply to parsing the file Kernel/Config.pm .

@svenoe
Copy link
Contributor

svenoe commented Oct 26, 2020

I think a method like "Version" in Kernel::System::Main returning program and version is a good idea. Converting to YAML/JSON in principle would be ok, but I guess some people writing external scripts (me^^) would not be happy...

Why or where do you want to parse Kernel/Config.pm?

@bschmalhofer
Copy link
Contributor Author

@svenoe , Kernel/Config.pm is parsed during the migration. This is problematic because this is Perl code that can be formated in is strange ways.

@svenoe
Copy link
Contributor

svenoe commented Oct 27, 2020

But it is probably not done anywhere else, I mean the only reason it is not loaded, is because one OTOBO version has to read out the information of another installation, and I cannot imagine another place where this is necessary. Concerning the parsing itself, it would probably be best, to just eval the complete Load-subroutine (that is basically the "parser") - if you call it, passing a $Dummy (={}) variable, you should be able to just use the DB info directly from that variable, or is it more complicated? (Not so sure...)

@bschmalhofer
Copy link
Contributor Author

Yes, evaling the method Loadwould be the way to go.

@bschmalhofer
Copy link
Contributor Author

It might be useful to include the Git branch and the Git commit in the RELEASE file. Either when creating a distribution package or when creating a Docker image. One use case would be in bin/docker/run_test_suite.sh. The name, or the content, of the result file could then include that information.

@bschmalhofer
Copy link
Contributor Author

So let's go with the method Kernel::System::Main::GetReleaseInfo(). This method parses the file RELEASE and returns the content as a simple hash. The file RELEASE won't be changed.

@bschmalhofer bschmalhofer modified the milestones: Wishlist, OTOBO 10.1 May 28, 2021
@bschmalhofer bschmalhofer self-assigned this May 28, 2021
bschmalhofer added a commit that referenced this issue May 28, 2021
It was implicitly required before as it is used in Kernel::System::CSV.
bschmalhofer added a commit that referenced this issue May 28, 2021
Use the new method in OTOBOFrameworkVersionCheck.
Add tests.
Note that the new method is not used in Kernel/Config/Defaults.pm.
Enhance POD and code comments.
Tidying.
@bschmalhofer
Copy link
Contributor Author

bschmalhofer commented May 28, 2021

TODO:

  • test a migration to OTOBO 10.1.x, as GetReleaseInfo() is used in one of the migration modules

@bschmalhofer
Copy link
Contributor Author

Tests looked fine, even though scripts/test/Selenium/Customer/CustomerTicketAttachment.t had a sporadic error. Testing an actual migration is still TODO.

@bschmalhofer
Copy link
Contributor Author

Finally, a test migration to OTOBO 10.1.1 has been performed. The version check looked fine. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants