Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Migrate away from multi-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ajvb committed Apr 8, 2020
1 parent 2d630e2 commit e5419dc
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 211 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ vendor:
$(GO) mod vendor

test:
./test.sh
go test ./...

lint:
golint .
Expand Down
18 changes: 4 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
module go.mozilla.org/userplex

go 1.13
go 1.14

require (
github.com/aws/aws-sdk-go v1.23.13
github.com/pkg/errors v0.8.1
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/testify v1.3.0
github.com/urfave/cli v1.22.1
github.com/urfave/cli/v2 v2.2.0
go.mozilla.org/person-api v0.0.0-20191125182003-e07ecb512bfe
go.mozilla.org/sops/v3 v3.5.0
go.mozilla.org/userplex/modules v0.0.0
go.mozilla.org/userplex/modules/authorizedkeys v0.0.0
go.mozilla.org/userplex/modules/aws v0.0.0
go.mozilla.org/userplex/notifications v0.0.0
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
gopkg.in/yaml.v2 v2.2.7
)

replace go.mozilla.org/userplex/modules/authorizedkeys => ./modules/authorizedkeys

replace go.mozilla.org/userplex/modules/aws => ./modules/aws

replace go.mozilla.org/userplex/modules => ./modules

replace go.mozilla.org/userplex/notifications => ./notifications
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aws/aws-sdk-go v1.23.13 h1:l/NG+mgQFRGG3dsFzEj0jw9JIs/zYdtU6MXhY1WIDmM=
github.com/aws/aws-sdk-go v1.23.13/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/aws/aws-sdk-go v1.25.30 h1:I9qj6zW3mMfsg91e+GMSN/INcaX9tTFvr/l/BAHKaIY=
github.com/aws/aws-sdk-go v1.25.30/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
Expand Down Expand Up @@ -205,6 +206,10 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4=
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a h1:N7VD+PwpJME2ZfQT8+ejxwA4Ow10IkGbU0MGf94ll8k=
go.mozilla.org/gopgagent v0.0.0-20170926210634-4d7ea76ff71a/go.mod h1:YDKUvO0b//78PaaEro6CAPH6NqohCmL2Cwju5XI2HoE=
go.mozilla.org/person-api v0.0.0-20191125182003-e07ecb512bfe h1:SY8AtlmPXNc/tUapjxMqAHxRoMlTp7pLZvwzpdFOv3c=
Expand All @@ -220,6 +225,7 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a h1:R/qVym5WAxsZWQqZCwDY/8sdVKV1m1WgU4/S5IRQAzc=
golang.org/x/crypto v0.0.0-20191108234033-bd318be0434a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down
28 changes: 14 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"go.mozilla.org/userplex/modules/aws"

log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

const Version = "v1.0.1"
Expand All @@ -21,19 +21,19 @@ func main() {
app.Name = "userplex"
app.Usage = "Propagate users from Mozilla's Person API to third party systems."
app.Version = Version
app.Authors = []cli.Author{
app.Authors = []*cli.Author{
{Name: "AJ Bahnken", Email: "ajvb@mozilla.com"},
{Name: "Julien Vehent", Email: "jvehent@mozilla.com"},
}
app.EnableBashCompletion = true
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Usage: "Path to userplex config file",
EnvVar: "USERPLEX_CONFIG_PATH",
&cli.StringFlag{
Name: "config",
Usage: "Path to userplex config file",
EnvVars: []string{"USERPLEX_CONFIG_PATH"},
},
}
app.Commands = []cli.Command{
app.Commands = []*cli.Command{
{
Name: "aws",
Usage: "Operations within AWS",
Expand Down Expand Up @@ -65,8 +65,8 @@ func requiresSubcommand(c *cli.Context) error {
return nil
}

func createModuleSubcommands(module modules.Module) []cli.Command {
return []cli.Command{
func createModuleSubcommands(module modules.Module) []*cli.Command {
return []*cli.Command{
{
Name: "create",
Usage: "Create user",
Expand Down Expand Up @@ -113,7 +113,7 @@ func createModuleSubcommands(module modules.Module) []cli.Command {
if person != nil {
err = m.Delete(person.GetLDAPUsername())
} else {
err = m.Delete(c.Args()[0])
err = m.Delete(c.Args().Get(0))
}
if err != nil {
log.Errorf("Error from module.Delete: %s", err)
Expand Down Expand Up @@ -159,7 +159,7 @@ func createModuleSubcommands(module modules.Module) []cli.Command {
}

func loadConfigForSubcommand(c *cli.Context, module modules.Module) (conf, []modules.Configuration, *person_api.Client) {
cfg, err := loadConf(c.GlobalString("c"))
cfg, err := loadConf(c.String("config"))
if err != nil {
log.Fatalf("Couldn't load config: %s", err)
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func loadConfigForSubcommand(c *cli.Context, module modules.Module) (conf, []mod

func loadAndVerifyContext(c *cli.Context, module modules.Module, exitOnError bool) (*person_api.Person, conf, []modules.Configuration, *person_api.Client) {
cfg, moduleConfigs, personClient := loadConfigForSubcommand(c, module)
username := c.Args()[0]
username := c.Args().Get(0)

p, err := getPerson(personClient, username)
if err != nil {
Expand Down Expand Up @@ -221,7 +221,7 @@ func loadAndVerifyContext(c *cli.Context, module modules.Module, exitOnError boo
}

func getPersonCmd(c *cli.Context) error {
cfg, err := loadConf(c.GlobalString("c"))
cfg, err := loadConf(c.String("config"))
if err != nil {
log.Fatalf("Couldn't load config: %s", err)
}
Expand All @@ -235,7 +235,7 @@ func getPersonCmd(c *cli.Context) error {
if err != nil {
log.Fatalf("Could not create person api client: %s", err)
}
username := c.Args()[0]
username := c.Args().Get(0)

p, err := getPerson(personClient, username)
if err != nil {
Expand Down
14 changes: 0 additions & 14 deletions modules/authorizedkeys/go.mod

This file was deleted.

35 changes: 0 additions & 35 deletions modules/authorizedkeys/go.sum

This file was deleted.

16 changes: 0 additions & 16 deletions modules/aws/go.mod

This file was deleted.

29 changes: 0 additions & 29 deletions modules/aws/go.sum

This file was deleted.

13 changes: 0 additions & 13 deletions modules/go.mod

This file was deleted.

32 changes: 0 additions & 32 deletions modules/go.sum

This file was deleted.

9 changes: 0 additions & 9 deletions notifications/go.mod

This file was deleted.

Loading

0 comments on commit e5419dc

Please sign in to comment.