• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yast / yast-autoinstallation / 13494013411

24 Feb 2025 08:44AM UTC coverage: 69.018% (+0.03%) from 68.993%
13494013411

push

github

web-flow
Merge pull request #881 from yast/merge_SLE-15-SP7

Added pervasive encryption fields (master)

6429 of 9315 relevant lines covered (69.02%)

10.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.82
/src/include/autoinstall/common.rb
1
# File:  include/common.ycp
2
# Package:  Auto-installation/Partition
3
# Summary:     common helper functions
4
# Author:  Sven Schober (sschober@suse.de)
5
#
6
# $Id: common.ycp 2805 2008-05-27 15:12:42Z sschober $
7
module Yast
1✔
8
  module AutoinstallCommonInclude
1✔
9
    def initialize_autoinstall_common(_include_target)
1✔
10
      textdomain "autoinst"
1✔
11

12
      Yast.import "AutoinstStorage"
1✔
13

14
      @currentDialog = {}
1✔
15
      # because i don't know how to pass arguments to eval()
16
      # i use this global map as a stack
17
      @stack = {}
1✔
18

19
      @currentEvent = {}
1✔
20
      @replacement_point = :rp
1✔
21

22
      # Global dialogs map. See StorageDialog() for more detailed
23
      # description of the general architecture.
24
      @dialogs = {}
1✔
25
    end
26

27
    def addDialog(name, dialog)
1✔
28
      dialog = deep_copy(dialog)
×
29
      @dialogs = Builtins.add(@dialogs, name, dialog)
×
30

31
      nil
×
32
    end
33

34
    def symbol2string(s)
1✔
35
      return "" if nil == s
×
36

37
      Builtins.substring(Builtins.tostring(s), 1)
×
38
    end
39

40
    def string2symbol(s)
1✔
41
      Builtins.symbolof(Builtins.toterm(s))
×
42
    end
43

44
    def toItemList(sList)
1✔
45
      sList = deep_copy(sList)
×
46
      Builtins.maplist(sList) { |s| Item(Id(string2symbol(s)), s) }
×
47
    end
48

49
    def updateCurrentDialog(dialogType)
1✔
50
      @currentDialog = Ops.get(@dialogs, dialogType, {})
×
51
      deep_copy(@currentDialog)
×
52
    end
53

54
    def getDialog(dialogType)
1✔
55
      Ops.get(@dialogs, dialogType, {})
×
56
    end
57

58
    def prepareStack
1✔
59
      # TODO: implement.
60
      Builtins.y2milestone("prepareStack(): NOT IMPLEMENTED")
×
61

62
      nil
×
63
    end
64

65
    def callDialogFunction(dialog, function)
1✔
66
      dialog = deep_copy(dialog)
×
67
      functionTerm = Ops.get(dialog, function)
×
68
      if nil == functionTerm
×
69
        Builtins.y2milestone(
×
70
          "Function not found: '%1'->'%2'.",
71
          Ops.get_string(dialog, :type, "Unknown"),
72
          function
73
        )
74
      else
75
        Builtins.y2milestone(
×
76
          "calling function: '%1'->'%2'.",
77
          Ops.get_string(dialog, :type, "Unknown"),
78
          functionTerm
79
        )
80
        # prepareStack();
81
        Builtins.eval(functionTerm)
×
82
      end
83

84
      nil
×
85
    end
86

87
    # Called by event handles to indicate the current event has been
88
    # handled
89
    def eventHandled
1✔
90
      @currentEvent = {}
×
91

92
      nil
×
93
    end
94

95
    # extracts type from tree item id strings:
96
    # "part_2_0" -> "part"
97
    def getTypePrefix(item)
1✔
98
      if nil != item && "" != item
×
99
        return Builtins.substring(item, 0, Builtins.findfirstof(item, "_"))
×
100
      end
101

102
      item
×
103
    end
104

105
    # strips off type prefixes from tree item id strings:
106
    # "part_2_0" -> "2_0"
107
    def stripTypePrefix(item)
1✔
108
      if nil != item && "" != item
×
109
        return Builtins.substring(
×
110
          item,
111
          Ops.add(Builtins.findfirstof(item, "_"), 1)
112
        )
113
      end
114
      item
×
115
    end
116

117
    # TODO: might be optimized by not using a regex here
118
    def removePrefix(s, prefix)
1✔
119
      result = Builtins.regexpsub(s, Ops.add(prefix, "(.*)"), "\\1")
×
120
      return s if nil == result
×
121

122
      result
×
123
    end
124

125
    # seems a bit over eager to supply this, but for consistencies
126
    # sake...
127
    def addPrefix(s, prefix)
1✔
128
      Ops.add(prefix, s)
×
129
    end
130
  end
131
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc