Skip to content

Commit d6c69c4

Browse files
openshift-merge-robotnjhale
authored andcommittedAug 8, 2019
Merge pull request #65 from ecordell/catalog-cmd
Support `oc` command
2 parents 9e218f9 + 0e62c8b commit d6c69c4

File tree

225 files changed

+16191
-13924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+16191
-13924
lines changed
 

‎.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ bin
1616

1717
# Ignore sqlite
1818
*.db
19+
20+
# Ignore vscode
21+
.vscode
22+
23+
# Igore apprclient meta
24+
pkg/apprclient/openapi/git_push.sh

‎cmd/appregistry-server/main.go

+2-38
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func main() {
3434
rootCmd.Flags().StringP("kubeconfig", "k", "", "absolute path to kubeconfig file")
3535
rootCmd.Flags().StringP("download-folder", "f", "downloaded", "directory where downloaded nested operator bundle(s) will be stored to be processed further")
3636
rootCmd.Flags().StringP("database", "d", "bundles.db", "name of db to output")
37-
rootCmd.Flags().StringSliceP("sources", "s", []string{}, "comma separated list of OperatorSource object(s) {namespace}/{name}")
3837
rootCmd.Flags().StringSliceP("registry", "r", []string{}, "pipe delimited operator source - {base url with cnr prefix}|{quay registry namespace}|{secret namespace/secret name}")
3938
rootCmd.Flags().StringP("packages", "o", "", "comma separated list of package(s) to be downloaded from the specified operator source(s)")
4039
rootCmd.Flags().StringP("port", "p", "50051", "port number to serve on")
@@ -72,7 +71,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
7271
return err
7372
}
7473

75-
sources, legacy, err := handleSourceFlag(cmd)
74+
sources, err := cmd.Flags().GetStringSlice("registry")
7675
if err != nil {
7776
return err
7877
}
@@ -88,7 +87,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
8887

8988
logger := logrus.WithFields(logrus.Fields{"type": "appregistry", "port": port})
9089

91-
loader, err := appregistry.NewLoader(kubeconfig, dbName, downloadPath, logger, legacy)
90+
loader, err := appregistry.NewLoader(kubeconfig, dbName, downloadPath, logger)
9291
if err != nil {
9392
logger.Fatalf("error initializing - %v", err)
9493
}
@@ -115,38 +114,3 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
115114

116115
return nil
117116
}
118-
119-
// Backward compatibility:
120-
// If the old flag 'sources' is specified then we return legacy as true. This
121-
// helps appregistry.NewLoader to instantiate the right 'source' parser.
122-
//
123-
// If 'registry' is used to specify a set of operator sources in remote registry
124-
// then we set legacy to false.
125-
//
126-
// If both are specified then legacy=true takes precedence. Marketplace operator
127-
// is now using the legacy mode.
128-
//
129-
// TODO: Once marketplace operator starts using the new flag 'registry' then we
130-
// can remove this function and and marketplace client bindings.
131-
func handleSourceFlag(cmd *cobra.Command) (specifiers []string, legacy bool, err error) {
132-
// old arg to specify a comma separated OperatorSource CR(s) {namespace}/{name}.
133-
operatorSourceCRNames, err := cmd.Flags().GetStringSlice("sources")
134-
if err != nil {
135-
return
136-
}
137-
138-
if len(operatorSourceCRNames) > 0 {
139-
specifiers = operatorSourceCRNames
140-
legacy = true
141-
return
142-
}
143-
144-
// New arg.
145-
remoteSources, err := cmd.Flags().GetStringSlice("registry")
146-
if err != nil {
147-
return
148-
}
149-
150-
specifiers = remoteSources
151-
return
152-
}

0 commit comments

Comments
 (0)
Please sign in to comment.