Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package terragrunt for openSUSE:Factory 
checked in at 2023-04-30 16:08:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/terragrunt (Old)
 and      /work/SRC/openSUSE:Factory/.terragrunt.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "terragrunt"

Sun Apr 30 16:08:00 2023 rev:40 rq:1083713 version:0.45.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/terragrunt/terragrunt.changes    2023-04-28 
16:24:45.366496247 +0200
+++ /work/SRC/openSUSE:Factory/.terragrunt.new.1533/terragrunt.changes  
2023-04-30 16:08:12.408310324 +0200
@@ -1,0 +2,6 @@
+Sun Apr 30 07:02:03 UTC 2023 - ka...@b1-systems.de
+
+- Update to version 0.45.6:
+  * JSON output prefix update (#2548)
+
+-------------------------------------------------------------------

Old:
----
  terragrunt-0.45.4.obscpio
  terragrunt-0.45.5.obscpio

New:
----
  terragrunt-0.45.6.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ terragrunt.spec ++++++
--- /var/tmp/diff_new_pack.eIwGeN/_old  2023-04-30 16:08:13.356316105 +0200
+++ /var/tmp/diff_new_pack.eIwGeN/_new  2023-04-30 16:08:13.360316130 +0200
@@ -19,7 +19,7 @@
 %define __arch_install_post export NO_BRP_STRIP_DEBUG=true
 
 Name:           terragrunt
-Version:        0.45.5
+Version:        0.45.6
 Release:        0
 Summary:        Thin wrapper for Terraform for working with multiple Terraform 
modules
 License:        MIT

++++++ _service ++++++
--- /var/tmp/diff_new_pack.eIwGeN/_old  2023-04-30 16:08:13.404316399 +0200
+++ /var/tmp/diff_new_pack.eIwGeN/_new  2023-04-30 16:08:13.408316423 +0200
@@ -3,7 +3,7 @@
     <param name="url">https://github.com/gruntwork-io/terragrunt</param>
     <param name="scm">git</param>
     <param name="exclude">.git</param>
-    <param name="revision">v0.45.5</param>
+    <param name="revision">v0.45.6</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.eIwGeN/_old  2023-04-30 16:08:13.432316569 +0200
+++ /var/tmp/diff_new_pack.eIwGeN/_new  2023-04-30 16:08:13.436316594 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/gruntwork-io/terragrunt</param>
-              <param 
name="changesrevision">208e6b23a8d77c1f745cc8c07b600c8b15e57803</param></service></servicedata>
+              <param 
name="changesrevision">d185ed96d24ff59c906c28a019a9b2cdf29f760e</param></service></servicedata>
 (No newline at EOF)
 

++++++ terragrunt-0.45.4.obscpio -> terragrunt-0.45.6.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.45.4/cli/args.go 
new/terragrunt-0.45.6/cli/args.go
--- old/terragrunt-0.45.4/cli/args.go   2023-04-19 21:45:14.000000000 +0200
+++ new/terragrunt-0.45.6/cli/args.go   2023-04-28 23:35:22.000000000 +0200
@@ -156,8 +156,16 @@
                opts.Debug = true
        }
 
+       jsonOutput := false
+       for _, arg := range args {
+               if strings.EqualFold(arg, "-json") {
+                       jsonOutput = true
+                       break
+               }
+       }
+
        includeModulePrefix := parseBooleanArg(args, 
optTerragruntIncludeModulePrefix, os.Getenv("TERRAGRUNT_INCLUDE_MODULE_PREFIX") 
== "true" || os.Getenv("TERRAGRUNT_INCLUDE_MODULE_PREFIX") == "1")
-       if includeModulePrefix {
+       if includeModulePrefix && !jsonOutput {
                opts.IncludeModulePrefix = true
                opts.OutputPrefix = fmt.Sprintf("[%s] ", opts.WorkingDir)
        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.45.4/main.go 
new/terragrunt-0.45.6/main.go
--- old/terragrunt-0.45.4/main.go       2023-04-19 21:45:14.000000000 +0200
+++ new/terragrunt-0.45.6/main.go       2023-04-28 23:35:22.000000000 +0200
@@ -41,6 +41,9 @@
                        exitCode = 1
                        util.GlobalFallbackLogEntry.Errorf("Unable to determine 
underlying exit code, so Terragrunt will exit with error code 1")
                }
+               if explain := shell.ExplainError(err); len(explain) > 0 {
+                       util.GlobalFallbackLogEntry.Errorf("Suggested fixes: 
\n%s", explain)
+               }
                os.Exit(exitCode)
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.45.4/shell/error_explainer.go 
new/terragrunt-0.45.6/shell/error_explainer.go
--- old/terragrunt-0.45.4/shell/error_explainer.go      1970-01-01 
01:00:00.000000000 +0100
+++ new/terragrunt-0.45.6/shell/error_explainer.go      2023-04-28 
23:35:22.000000000 +0200
@@ -0,0 +1,47 @@
+package shell
+
+import (
+       "regexp"
+       "strings"
+
+       "github.com/gruntwork-io/gruntwork-cli/collections"
+
+       "github.com/gruntwork-io/terragrunt/errors"
+       "github.com/hashicorp/go-multierror"
+)
+
+// terraformErrorsMatcher List of errors that we know how to explain to the 
user. The key is a regex that matches the error message, and the value is the 
explanation.
+var terraformErrorsMatcher = map[string]string{
+       "(?s).*Error refreshing state: AccessDenied: Access Denied(?s).*": "You 
don't have access to the S3 bucket where the state is stored. Check your 
credentials and permissions.",
+       "(?s).*Error: Initialization required(?s).*":                      "You 
need to run terragrunt (run-all) init to initialize working directory.",
+       "(?s).*Module source has changed(?s).*":                           "You 
need to run terragrunt (run-all) init install all required modules.",
+}
+
+// ExplainError will try to explain the error to the user, if we know how to 
do so.
+func ExplainError(err error) string {
+       multiErrors, ok := err.(*multierror.Error)
+       if !ok {
+               return ""
+       }
+       explanations := map[string]string{}
+
+       // iterate over each error, unwrap it, and check for error output
+       for _, errorItem := range multiErrors.Errors {
+               originalError := errors.Unwrap(errorItem)
+               if originalError == nil {
+                       continue
+               }
+               processError, ok := originalError.(ProcessExecutionError)
+               if !ok {
+                       continue
+               }
+               errorOutput := processError.Stderr
+               for regex, explanation := range terraformErrorsMatcher {
+                       if match, _ := regexp.MatchString(regex, errorOutput); 
match {
+                               // collect matched explanations
+                               explanations[explanation] = "1"
+                       }
+               }
+       }
+       return strings.Join(collections.Keys(explanations), "\n")
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.45.4/shell/error_explainer_test.go 
new/terragrunt-0.45.6/shell/error_explainer_test.go
--- old/terragrunt-0.45.4/shell/error_explainer_test.go 1970-01-01 
01:00:00.000000000 +0100
+++ new/terragrunt-0.45.6/shell/error_explainer_test.go 2023-04-28 
23:35:22.000000000 +0200
@@ -0,0 +1,45 @@
+package shell
+
+import (
+       "testing"
+
+       "github.com/hashicorp/go-multierror"
+       "github.com/stretchr/testify/assert"
+)
+
+func TestExplainError(t *testing.T) {
+       t.Parallel()
+
+       var testCases = []struct {
+               errorOutput string
+               explanation string
+       }{
+               {
+                       errorOutput: "Error refreshing state: AccessDenied: 
Access Denied",
+                       explanation: "Check your credentials and permissions",
+               },
+               {
+                       errorOutput: "Error: Initialization required",
+                       explanation: "You need to run terragrunt (run-all) init 
to initialize working directory",
+               },
+               {
+                       errorOutput: "Module source has changed",
+                       explanation: "You need to run terragrunt (run-all) init 
install all required modules",
+               },
+       }
+
+       for _, tt := range testCases {
+
+               t.Run(tt.errorOutput, func(t *testing.T) {
+                       err := multierror.Append(&multierror.Error{}, 
ProcessExecutionError{
+                               Err:    nil,
+                               StdOut: "",
+                               Stderr: tt.errorOutput,
+                       })
+                       explanation := ExplainError(err)
+                       assert.Contains(t, explanation, tt.explanation)
+
+               })
+       }
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/terragrunt-0.45.4/test/integration_test.go 
new/terragrunt-0.45.6/test/integration_test.go
--- old/terragrunt-0.45.4/test/integration_test.go      2023-04-19 
21:45:14.000000000 +0200
+++ new/terragrunt-0.45.6/test/integration_test.go      2023-04-28 
23:35:22.000000000 +0200
@@ -5285,7 +5285,25 @@
                t,
                runTerragruntCommand(t, fmt.Sprintf("terragrunt output 
-no-color -json --terragrunt-include-module-prefix --terragrunt-non-interactive 
--terragrunt-working-dir %s", app3Path), &stdout, &stderr),
        )
-       assert.Contains(t, stdout.String(), "\"value\": 42")
+       // validate that output is valid json
+       outputs := map[string]TerraformOutput{}
+       require.NoError(t, json.Unmarshal([]byte(stdout.String()), &outputs))
+       assert.Equal(t, int(outputs["z"].Value.(float64)), 42)
+}
+
+func TestErrorExplaining(t *testing.T) {
+       t.Parallel()
+
+       initTestCase := TEST_FIXTURE_INIT_ERROR
+       cleanupTerraformFolder(t, initTestCase)
+       cleanupTerragruntFolder(t, initTestCase)
+
+       stdout := bytes.Buffer{}
+       stderr := bytes.Buffer{}
+
+       err := runTerragruntCommand(t, fmt.Sprintf("terragrunt init -no-color 
--terragrunt-include-module-prefix --terragrunt-non-interactive 
--terragrunt-working-dir %s", initTestCase), &stdout, &stderr)
+       explanation := shell.ExplainError(err)
+       assert.Contains(t, explanation, "Check your credentials and 
permissions")
 }
 
 func validateBoolOutput(t *testing.T, outputs map[string]TerraformOutput, key 
string, value bool) {

++++++ terragrunt.obsinfo ++++++
--- /var/tmp/diff_new_pack.eIwGeN/_old  2023-04-30 16:08:14.144320913 +0200
+++ /var/tmp/diff_new_pack.eIwGeN/_new  2023-04-30 16:08:14.148320937 +0200
@@ -1,5 +1,5 @@
 name: terragrunt
-version: 0.45.5
-mtime: 1682624285
-commit: 208e6b23a8d77c1f745cc8c07b600c8b15e57803
+version: 0.45.6
+mtime: 1682717722
+commit: d185ed96d24ff59c906c28a019a9b2cdf29f760e
 

++++++ vendor.tar.gz ++++++
/work/SRC/openSUSE:Factory/terragrunt/vendor.tar.gz 
/work/SRC/openSUSE:Factory/.terragrunt.new.1533/vendor.tar.gz differ: char 5, 
line 1

Reply via email to