Skip to content

Commit

Permalink
Move AyastProbeClient to Clients::AyastProbe
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Nov 6, 2017
1 parent b3f9120 commit e717784
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 72 deletions.
74 changes: 2 additions & 72 deletions src/clients/ayast_probe.rb
@@ -1,72 +1,2 @@
# encoding: utf-8

# File: clients/ayast_probe.ycp
# Package: Auto-installation
# Author: Uwe Gansert <ug@suse.de>
# Summary: This client is more or less for debugging.
# It dumps interesting autoyast values and is
# not as scaring as reading y2log just for some info
#
# Changes: * initial - just dumps the rule values
# $Id$
module Yast
class AyastProbeClient < Client
def main
Yast.import "UI"
Yast.import "Stage"
Stage.Set("initial")
Yast.import "AutoInstallRules"
Yast.import "Label"
AutoInstallRules.ProbeRules

@attrs =
# "NonLinuxPartitions":AutoInstallRules::NonLinuxPartitions,
# "LinuxPartitions":AutoInstallRules::LinuxPartitions,
# "disksize":AutoInstallRules::disksize
{
"installed_product" => AutoInstallRules.installed_product,
"installed_product_version" => AutoInstallRules.installed_product_version(
),
"hostname" => AutoInstallRules.hostname,
"hostaddress" => AutoInstallRules.hostaddress,
"network" => AutoInstallRules.network,
"domain" => AutoInstallRules.domain,
"arch" => AutoInstallRules.arch,
"karch" => AutoInstallRules.karch,
"product" => AutoInstallRules.product,
"product_vendor" => AutoInstallRules.product_vendor,
"board_vendor" => AutoInstallRules.board_vendor,
"board" => AutoInstallRules.board,
"memsize" => AutoInstallRules.memsize,
"totaldisk" => AutoInstallRules.totaldisk,
"hostid" => AutoInstallRules.hostid,
"mac" => AutoInstallRules.mac,
"linux" => AutoInstallRules.linux,
"others" => AutoInstallRules.others,
"xserver" => AutoInstallRules.xserver
}
@text = "<h3>Keys for rules</h3><table>"
Builtins.foreach(@attrs) do |k, v|
@text = Ops.add(
@text,
Builtins.sformat(
"<tr><td>%1</td><td> = </td><td>%2<br></td></tr>",
k,
v
)
)
end

UI.OpenDialog(
Opt(:defaultsize),
VBox(RichText(@text), PushButton(Opt(:default), Label.OKButton))
)
UI.UserInput
UI.CloseDialog

nil
end
end
end

Yast::AyastProbeClient.new.main
require "autoinstall/clients/ayast_probe"
Y2Autoinstall::Clients::AyastProbe.new.main
84 changes: 84 additions & 0 deletions src/lib/autoinstall/clients/ayast_probe.rb
@@ -0,0 +1,84 @@
# encoding: utf-8

# Copyright (c) [2017] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

module Y2Autoinstall
module Clients
class AyastProbe
include Yast::UIShortcuts

def main
Yast.import "UI"
Yast.import "Stage"
Yast::Stage.Set("initial")
Yast.import "AutoInstallRules"
Yast.import "Label"
Yast::AutoInstallRules.ProbeRules

@attrs =
# "NonLinuxPartitions":Yast::AutoInstallRules::NonLinuxPartitions,
# "LinuxPartitions":Yast::AutoInstallRules::LinuxPartitions,
# "disksize":Yast::AutoInstallRules::disksize
{
"installed_product" => Yast::AutoInstallRules.installed_product,
"installed_product_version" => Yast::AutoInstallRules.installed_product_version(
),
"hostname" => Yast::AutoInstallRules.hostname,
"hostaddress" => Yast::AutoInstallRules.hostaddress,
"network" => Yast::AutoInstallRules.network,
"domain" => Yast::AutoInstallRules.domain,
"arch" => Yast::AutoInstallRules.arch,
"karch" => Yast::AutoInstallRules.karch,
"product" => Yast::AutoInstallRules.product,
"product_vendor" => Yast::AutoInstallRules.product_vendor,
"board_vendor" => Yast::AutoInstallRules.board_vendor,
"board" => Yast::AutoInstallRules.board,
"memsize" => Yast::AutoInstallRules.memsize,
"totaldisk" => Yast::AutoInstallRules.totaldisk,
"hostid" => Yast::AutoInstallRules.hostid,
"mac" => Yast::AutoInstallRules.mac,
"linux" => Yast::AutoInstallRules.linux,
"others" => Yast::AutoInstallRules.others,
"xserver" => Yast::AutoInstallRules.xserver
}
@text = "<h3>Keys for rules</h3><table>"
Yast::Builtins.foreach(@attrs) do |k, v|
@text = Yast::Ops.add(
@text,
Yast::Builtins.sformat(
"<tr><td>%1</td><td> = </td><td>%2<br></td></tr>",
k,
v
)
)
end

Yast::UI.OpenDialog(
Opt(:defaultsize),
VBox(RichText(@text), PushButton(Opt(:default), Yast::Label.OKButton))
)
Yast::UI.UserInput
Yast::UI.CloseDialog

nil
end
end
end
end

0 comments on commit e717784

Please sign in to comment.