Skip to content

Commit

Permalink
Merge pull request #242 from yast/review_160817_improved_logging
Browse files Browse the repository at this point in the history
improved logging
  • Loading branch information
schubi2 committed Aug 17, 2016
2 parents 8a411c9 + 39cc539 commit 766ad92
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
7 changes: 7 additions & 0 deletions package/autoyast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Aug 17 09:56:28 CEST 2016 - schubi@suse.de

- Improved logging for broken script descriptions.
Still a part of bnc#986049.
- 3.1.147

-------------------------------------------------------------------
Mon Aug 12 10:48:18 CEST 2016 - schubi@suse.de

Expand Down
2 changes: 1 addition & 1 deletion package/autoyast2.spec
Expand Up @@ -17,7 +17,7 @@


Name: autoyast2
Version: 3.1.146
Version: 3.1.147
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
24 changes: 19 additions & 5 deletions src/modules/AutoinstScripts.rb
Expand Up @@ -10,6 +10,9 @@

module Yast
class AutoinstScriptsClass < Module

include Yast::Logger

def main
Yast.import "UI"
textdomain "autoinst"
Expand Down Expand Up @@ -62,6 +65,17 @@ def GetModified
@modified
end

# Checking if the script has the right format
# @param [Hash] scripts section of the AutoYast configuration
# @param [String] kind of script (pre, post,..)
# @return [Array<String>] of scripts
def valid_scripts_for(tree, key)
tree.fetch(key, []).select do |h|
next true if h.is_a?(Hash)
log.warn "Cannot evaluate #{key}: #{h.inspect}"
false
end
end

# merge all types of scripts into one single list
# @param -
Expand Down Expand Up @@ -305,11 +319,11 @@ def Import(s)
s = deep_copy(s)
Builtins.y2debug("Calling AutoinstScripts::Import()")
# take only hash entries (bnc#986049)
@pre = s.fetch("pre-scripts", []).select { |h| h.is_a?(Hash) }
@init = s.fetch("init-scripts", []).select { |h| h.is_a?(Hash) }
@post = s.fetch("post-scripts", []).select { |h| h.is_a?(Hash) }
@chroot = s.fetch("chroot-scripts", []).select { |h| h.is_a?(Hash) }
@postpart = s.fetch("postpartitioning-scripts", []).select { |h| h.is_a?(Hash) }
@pre = valid_scripts_for(s, "pre-scripts")
@init = valid_scripts_for(s, "init-scripts")
@post = valid_scripts_for(s, "post-scripts")
@chroot = valid_scripts_for(s, "chroot-scripts")
@postpart = valid_scripts_for(s, "postpartitioning-scripts")

@pre = Resolve_location(@pre)
@init = Resolve_location(@init)
Expand Down

0 comments on commit 766ad92

Please sign in to comment.