Skip to content

Commit

Permalink
Merge pull request #206 from essentialkaos/master
Browse files Browse the repository at this point in the history
Fixed bug with parsing update line on CentOS/RHEL
  • Loading branch information
kotakanbe authored Oct 11, 2016
2 parents f386c3b + 4a07974 commit 3af93b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scan/redhat.go
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ func (o *redhat) parseYumCheckUpdateLines(stdout string) (results models.Package

func (o *redhat) parseYumCheckUpdateLine(line string) (models.PackageInfo, error) {
fields := strings.Fields(line)
if len(fields) != 3 {
if len(fields) < 3 {
return models.PackageInfo{}, fmt.Errorf("Unknown format: %s", line)
}
splitted := strings.Split(fields[0], ".")
Expand Down
13 changes: 13 additions & 0 deletions scan/redhat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ Obsoleting Packages
python-libs.i686 2.6.6-64.el6 rhui-REGION-rhel-server-releases
python-ordereddict.noarch 1.1-3.el6ev installed
bind-utils.x86_64 30:9.3.6-25.P1.el5_11.8 updates
pytalloc.x86_64 2.0.7-2.el6 @CentOS 6.5/6.5
`

r.Packages = []models.PackageInfo{
Expand Down Expand Up @@ -644,6 +645,11 @@ bind-utils.x86_64 30:9.3.6-25.P1.el5_11.8 updates
Version: "1.0",
Release: "1",
},
{
Name: "pytalloc",
Version: "2.0.1",
Release: "0",
},
}
var tests = []struct {
in string
Expand Down Expand Up @@ -687,6 +693,13 @@ bind-utils.x86_64 30:9.3.6-25.P1.el5_11.8 updates
NewVersion: "9.3.6",
NewRelease: "25.P1.el5_11.8",
},
{
Name: "pytalloc",
Version: "2.0.1",
Release: "0",
NewVersion: "2.0.7",
NewRelease: "2.el6",
},
},
},
}
Expand Down

0 comments on commit 3af93b9

Please sign in to comment.