Skip to content

Commit

Permalink
storage: add client methods to work with config
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Dec 20, 2024
1 parent 1477848 commit 654eabc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions service/lib/agama/dbus/clients/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
require "agama/dbus/clients/with_locale"
require "agama/dbus/clients/with_progress"
require "agama/dbus/clients/with_issues"
require "json"

module Agama
module DBus
Expand Down Expand Up @@ -62,6 +63,22 @@ def finish
dbus_object.Finish
end

# Gets the current storage config.
#
# @return [Hash]
def config
serialized_config = dbus_object.GetConfig
JSON.parse(serialized_config, symbolize_names: true)
end

# Sets the storage config.
#
# @param config [Hash]
def config=(config)
serialized_config = JSON.pretty_generate(config)
dbus_object.SetConfig(serialized_config)
end

private

# @return [::DBus::Object]
Expand Down

0 comments on commit 654eabc

Please sign in to comment.