Skip to content

Commit

Permalink
Fix typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemeyer committed Aug 7, 2016
1 parent ee25c15 commit de10702
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions osutil/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ import (
var userLookup = user.Lookup

func AddExtraSudoUser(name string, sshKeys []string, gecos string) error {
// we check the (user)name ourselfs, adduser is a bit too
// we check the (user)name ourselves, adduser is a bit too
// strict (i.e. no `.`) - this regexp is in sync with that SSO
// allows as valid usernames
validNames := regexp.MustCompile(`^[a-z0-9][-a-z0-9+.-_]*$`)
if !validNames.MatchString(name) {
return fmt.Errorf("cannot add user %q: name contains invalid charackters", name)
return fmt.Errorf("cannot add user %q: name contains invalid characters", name)
}

cmd := exec.Command("adduser",
Expand Down
2 changes: 1 addition & 1 deletion osutil/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ func (s *createUserSuite) TestAddExtraSudoUser(c *check.C) {

func (s *createUserSuite) TestAddExtraSudoUserInvalid(c *check.C) {
err := osutil.AddExtraSudoUser("k!", nil, "my gecos")
c.Assert(err, check.ErrorMatches, `cannot add user "k!": name contains invalid charackters`)
c.Assert(err, check.ErrorMatches, `cannot add user "k!": name contains invalid characters`)
}

0 comments on commit de10702

Please sign in to comment.