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

CFE-3813: Track changes done by cfbs commands in Git #103

Merged
merged 8 commits into from
Mar 25, 2022

Conversation

vpodzime
Copy link
Contributor

No description provided.

@vpodzime vpodzime requested review from olehermanse and larsewi March 21, 2022 13:03
There shouldn't be multiple instances of the class manipulating
with the same file. Plus we can use the single instance to store
runtime configration options (no_interactive, dry_run?,...).

Ticket: CFE-3813
Changelog: None
Instead of passing it to some of them and not having it
implemented for others.

Also remove the index_path argument from places where it is not
used.

Ticket: CFE-3813
Changelog: None
It's part of the configuration for the particular 'cfbs' run. And
we can potentially make it part of the cfbs.json config in the
future.

Ticket: CFE-3813
Changelog: None
Instead of always checking the non_interactive flag, checking if
the user entered valid input, setting the default on empty
input,...

Ticket: CFE-3813
Changelog: None
Instead of just writing the defaults to the config and asking
them to edit it.

Ticket: CFE-3813
Changelog: None
Some helper code to deal with the tricky bits of initializing git
and making commits.

Ticket: CFE-3813
Changelog: None
@vpodzime vpodzime force-pushed the master-git branch 5 times, most recently from 13f5b28 to 0de77da Compare March 21, 2022 15:00
It's always a good idea to track changes in policy and related
files. So unless user explicitly disagrees, 'cfbs' commands now
record changes in a Git repository.

Also, 'clean' and 'update' commands were modified to have
different return/exit codes when they make some and no changes.

Ticket: CFE-3813
Changelog: cfbs commands now track changes they make in a Git repository
Copy link
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

Looks very good in general, thanks for working on this! 🚀 I am sure I will find some things we might want to change with the usability / prompts, but we can take that as we start using it :)

Comment on lines 233 to 240
user_name = git_get_config("user.name")
user_email = git_get_config("user.email")
user_name = prompt_user("Please enter user name to use for git commits",
default=user_name or "cfbs")

node_name = os.uname().nodename
user_email = prompt_user("Please enter user email to use for git commits",
default=user_email or ("cfbs@%s" % node_name))
Copy link
Member

Choose a reason for hiding this comment

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

This is really nice 👍

@olehermanse olehermanse merged commit df81228 into cfengine:master Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants