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 script to adjust modules afer dep got migrated #729

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

Conversation

bastelfreak
Copy link
Member

the camptocamp/systemd module is now voxpupuli/systemd. I wrote a script
to update the namespace in .fixtures.yml, the namespace and upper
version in metadata.json and to create a pull request afterwards.

Call it like this:

export GITHUB_TOKEN=...
./bin/clean-git-checkouts
./bin/systemd_module_migration.sh

This script can be adjusted for other modules. None of our modules
install the systemd module in spec/spec_helper_acceptance.rb nor
spec/acceptance/*, so I didn't implement this.

bin/systemd_module_migration.sh Outdated Show resolved Hide resolved
bin/systemd_module_migration.sh Outdated Show resolved Hide resolved
bin/systemd_module_migration.sh Outdated Show resolved Hide resolved
@bastelfreak bastelfreak force-pushed the systemd branch 2 times, most recently from be39fd1 to d030979 Compare August 13, 2021 19:29
fi

# fix all modules with systemd in .fixtures.yml
sed --in-place 's#camptocamp/puppet-systemd#voxpupuli/puppet-systemd#' modules/voxpupuli/puppet-*/.fixtures.yml
Copy link
Member

Choose a reason for hiding this comment

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

FreeBSD does not have long options… A more portable solution would be:

Suggested change
sed --in-place 's#camptocamp/puppet-systemd#voxpupuli/puppet-systemd#' modules/voxpupuli/puppet-*/.fixtures.yml
sed -I '' 's#camptocamp/puppet-systemd#voxpupuli/puppet-systemd#' modules/voxpupuli/puppet-*/.fixtures.yml

…but POSIX does not have in-place edit either (no -I / -i) so I am not sure about the best way to handle this if we want it to be portable.

Maybe just set -e at the beginning of the script to exit as soon as the first command fail?

Copy link
Member

Choose a reason for hiding this comment

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

You've got ruby involved with a puppet agent so you could use that :)

ruby -pi -e "gsub(/before/, 'after')" filename

@ekohl
Copy link
Member

ekohl commented Aug 14, 2021

So rather than building these one-off solutions I started ekohl/metadata_json_deps#7. It would rely on the Puppet Forge to have them deprecated with the proper replacement, but it's scalable. I think the next step should be to introduce a "fix" mode in that gem so it can rectify the dependency. It could open the path to dependabot-style checks.

@ekohl
Copy link
Member

ekohl commented Jun 9, 2022

@bastelfreak thoughts on closing this? The check mode is currently there. We also migrated most if not all systemd modules. If we do have a new big change, I think it makes sense we focus our efforts on enhancing the generic replacement tool instead.

the camptocamp/systemd module is now voxpupuli/systemd. I wrote a script
to update the namespace in .fixtures.yml, the namespace and upper
version in metadata.json and to create a pull request afterwards.

Call it like this:
```
export GITHUB_TOKEN=...
./bin/clean-git-checkouts
./bin/systemd_module_migration.sh
```

This script can be adjusted for other modules. None of our modules
install the systemd module in spec/spec_helper_acceptance.rb nor
spec/acceptance/*, so I didn't implement this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants