Skip to content

Instantly share code, notes, and snippets.

@ancorgs
Last active March 7, 2016 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ancorgs/c371a33177c6cf8d6d8e to your computer and use it in GitHub Desktop.
Save ancorgs/c371a33177c6cf8d6d8e to your computer and use it in GitHub Desktop.
Devicegraphs global catalog
# The first line is the one that makes me feel that the global catalog and the problem
# of everybody happily accessing StorageManager.instance are back
# It fakes the hardware probing (Why if I only want to work with YAML files?)
# It initializes StorageManager.instance, which is not named explicitily (...is not needed
# because "everybody know about it")
# It registers a graph in the global name-indexed catalog (named "fake")
fake_probing = Yast::Storage::FakeProbing.new
# Returns that devicegraph called "fake"
graph1 = fake_probing.devicegraph
Yast::Storage::FakeDeviceFactory.load_yaml_file(graph1,input_file1)
# The way to instantiate the second empty devicegraph is different from graph1...
# Or should I also register it in the global catalog? How? With which name?
graph2 = Storage::Devicegraph.new
Yast::Storage::FakeDeviceFactory.load_yaml_file(graph2,input_file2)
# An operation with 2 devicegraphs returning a third one, I guess (just my guess)
# that to be consistent, it should work on a given (empty) devicegraph
# Same questions than before about creating it and the catalog
union = Storage::Devicegraph.new
calculator = GraphUnionCalculator.new(graph1, graph2)
calculator.calculate_union(union)
Yast::Storage::YamlWriter.write(union, output_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment