-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add el9toel10 actor to handle symlink -> directory with ruby IRB.
The `/usr/share/ruby/irb` path is a symlink in RHEL 9, but a regular directory in RHEL 10. Simply remove the symlink to then let the RPM mechanism create the correct directory on update. Users should not expect to ever retain anything in this directory.
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
repos/system_upgrade/el9toel10/actors/registerrubyirbadjustment/actor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from leapp.actors import Actor | ||
from leapp.models import DNFWorkaround | ||
from leapp.tags import FactsPhaseTag, IPUWorkflowTag | ||
|
||
|
||
class RegisterRubyIRBAdjustment(Actor): | ||
""" | ||
Registers a workaround which will adjust the Ruby IRB directories during the upgrade. | ||
""" | ||
|
||
name = 'register_ruby_irb_adjustment' | ||
consumes = () | ||
produces = (DNFWorkaround,) | ||
tags = (IPUWorkflowTag, FactsPhaseTag) | ||
|
||
def process(self): | ||
self.produce( | ||
DNFWorkaround( | ||
display_name='IRB directory fix', | ||
script_path=self.get_tool_path('handlerubyirbsymlink'), | ||
) | ||
) |
11 changes: 11 additions & 0 deletions
11
...de/el9toel10/actors/registerrubyirbadjustment/tests/test_register_ruby_irb_adjustments.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os.path | ||
|
||
from leapp.models import DNFWorkaround | ||
|
||
|
||
def test_register_ruby_irb_adjustments(current_actor_context): | ||
current_actor_context.run() | ||
assert len(current_actor_context.consume(DNFWorkaround)) == 1 | ||
assert current_actor_context.consume(DNFWorkaround)[0].display_name == 'IRB directory fix' | ||
assert os.path.basename(current_actor_context.consume(DNFWorkaround)[0].script_path) == 'handlerubyirbsymlink' | ||
assert os.path.exists(current_actor_context.consume(DNFWorkaround)[0].script_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/bash -e | ||
|
||
# just in case of hidden files.. not sure why would someone do that, it's more | ||
# like forgotten cache file possibility, but rather do that.. | ||
shopt -s dotglob | ||
|
||
handle_dir() { | ||
# Check that $1 is a symlink then unlink it so that RPM | ||
# can freely create the directory. | ||
if [ ! -L "$1" ]; then | ||
return | ||
fi | ||
|
||
# There is no configuration or anything that the user should ever customize | ||
# and expect to retain. | ||
unlink "$1" | ||
|
||
return 0 | ||
} | ||
|
||
|
||
handle_dir /usr/share/ruby/irb |