Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
disks = a_devicegraph.disks # A disks object, Array on steroids
disks = disks.with(name: ["/dev/sda", "/dev/sdb"]) # another disks object
primary_parts = disks.partitions.with(type: :primary) # A Partitions object, another Array on steroids
parts = disks.partitions.with(name: ["/dev/sda2", "/dev/sdc3"])
# equivalent line
# parts = a_devicegraph.disks.partitions.with(name: ["/dev/sda2", "/dev/sdc3"])
# Calls to whatever.filesystems returns a Filesystems object which is another Array on steroids
# So the equivalent to previous example (https://gist.github.com/ancorgs/9c628ef0f4fa717a2817) would be
a_device_graph.filesystems.to_a # all file systems in the devicegraph
disks.filesystems.to_a # Filesystems in the chosen disks
primary_parts.filesystems.to_a # fs in primary parts of chosen disks
parts.filesystems.to_a # Filesystems in sda2 and sdc3
# But you don't need to use #to_a immediately (or at all)
disk_query.filesystems.map(&:label)
part_fine_query.filesystems.with(label: "bla").first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.