Sha256: 57563059764e78e202458c08c5519871cb457dda9243e821b60e95200ce957f5

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

module HammerCLIForeman

  class Settings < HammerCLIForeman::Command

    resource :settings

    class ListCommand < HammerCLIForeman::ListCommand

      output do
        field :id, _('Id'), Fields::Id
        field :name, _('Name')
        field :full_name, _('Full name')
        field :value, _('Value')
        field :description, _('Description')
      end

      def extend_data(data)
        data['value'] = data['value'].to_s
        data
      end

      build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
    end

    class UpdateCommand < HammerCLIForeman::UpdateCommand
      command_name 'set'

      success_message _("Setting [%{name}] updated to [%{value}].")
      failure_message _("Could not update the setting")

      build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
    end

    class InfoCommand < HammerCLIForeman::InfoCommand
      output do
        field :id, _("Id")
        field :name, _("Name")
        field :description, _("Description")
        field :category_name, _("Category")
        field :settings_type, _("Settings type")
        field :value, _("Value")
      end

      build_options expand: { except: %i[organizations locations] }, without: %i[organization_id location_id]
    end


    autoload_subcommands
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hammer_cli_foreman-2.5.2 lib/hammer_cli_foreman/settings.rb
hammer_cli_foreman-2.5.1 lib/hammer_cli_foreman/settings.rb
hammer_cli_foreman-2.5.0 lib/hammer_cli_foreman/settings.rb
hammer_cli_foreman-2.4.0 lib/hammer_cli_foreman/settings.rb