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

[WIP] Added snapshot Class with strategy pattern. #40

Closed
wants to merge 16 commits into from

Conversation

teclator
Copy link
Contributor

@teclator teclator commented Dec 3, 2015

I want to discuss the idea before do more work that could go directly to the trash :P. It's just a preview so please don't be picky about details in the code.

Cleaning up yast-snapper, i missed a more oriented way of use snapshots, so i was planing to add a Snapshot class and rewrite Snapper to work with Snapshot objects instead of hashes.

I asked my doubts in the channel and Imobach told me that in yast-yast2 already exist a similar class. This class is currently used for installation proposes and when DBus is still not available so Ancorgs suggested the use of this class but rewriting it to use the Strategy pattern, so we could have to strategies one for CLI and other for DBus

So what i really do was write a class that could be merged in FsSnapshot that use by default the SnapshotDBus strategy.

So the plan would be remove SnapperDbus and rewrite Snapper to maintain the actual published methods but calling FsSnapshot directly but being only responsable of the dialog logic.

- Unified SnapperDbus and Snapper test in one file
- Added tests for Snapper.ReadConfigs
- Added tests for SnapperDialogsInclude#snapshot_modified
- Spliting some big methods trying to isolate its behavior to be easier
  for read, understood and rewrite.
# ------------------------------------------------------------------------------

require "yast"
require_relative "snapshot_dbus"
Copy link
Member

Choose a reason for hiding this comment

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

It breaks e.g. y2update ability, better is to use require "snapper/snapshot_dbus"

) { |key, value| ret = ret || Ops.get(orig, key) != value }
ret
def snapshot_modified(orig, args)
args.any? { |k, v| orig.send(k) != v }
Copy link
Member

Choose a reason for hiding this comment

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

I personally prefer using public_send as it do not discard encapsulation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

taking note

@jreidinger
Copy link
Member

in general nice to have some tests there ( maybe enabling coveralls shows how is status here ). Idea in general looks good, just please test code enough, so we are sure that nothing is broken.

@lslezak
Copy link
Member

lslezak commented Apr 3, 2017

This looks as a big refactoring PR which will still need a lot of time. @teclator create a Trello card so this can be properly planned in some next SPRINT.

@teclator
Copy link
Contributor Author

teclator commented Apr 3, 2017

@lslezak I will do

@teclator
Copy link
Contributor Author

teclator commented Apr 4, 2017

It needs some love... and changes according to last snapper updates which probably makes the addition of different strategies not so useful.

More details in this trello card: https://trello.com/c/Y4EcAhOn/1365-yast2-snapper-finish-cleanup

@teclator teclator closed this Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants