| ... | ... |
@@ -284,10 +284,10 @@ Export resources so they can be used elsewhere |
| 284 | 284 |
openshift cli export svc,dc -l name=test |
| 285 | 285 |
|
| 286 | 286 |
// export all services to a template |
| 287 |
- openshift cli export service --all --as-template=test |
|
| 287 |
+ openshift cli export service --as-template=test |
|
| 288 | 288 |
|
| 289 | 289 |
// export to JSON |
| 290 |
- openshift cli export service --all -o json |
|
| 290 |
+ openshift cli export service -o json |
|
| 291 | 291 |
|
| 292 | 292 |
// convert a file on disk to the latest API version (in YAML, the default) |
| 293 | 293 |
openshift cli export -f a_v1beta3_service.json --output-version=v1 --exact |
| ... | ... |
@@ -72,7 +72,7 @@ function cleanup() |
| 72 | 72 |
oc get -n docker builds --output-version=v1beta3 -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l oc build-logs -n docker >"${LOG_DIR}/dockerbuild.log"
|
| 73 | 73 |
oc get -n custom builds --output-version=v1beta3 -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l oc build-logs -n custom >"${LOG_DIR}/custombuild.log"
|
| 74 | 74 |
|
| 75 |
- oc export all --all --all-namespaces --raw -o json > ${LOG_DIR}/export_all.json
|
|
| 75 |
+ oc export all --all-namespaces --raw -o json > ${LOG_DIR}/export_all.json
|
|
| 76 | 76 |
|
| 77 | 77 |
echo "[INFO] Dumping etcd contents to ${ARTIFACT_DIR}/etcd_dump.json"
|
| 78 | 78 |
set_curl_args 0 1 |
| ... | ... |
@@ -41,10 +41,10 @@ to generate the API structure for a template to which you can add parameters and |
| 41 | 41 |
%[1]s export svc,dc -l name=test |
| 42 | 42 |
|
| 43 | 43 |
// export all services to a template |
| 44 |
- %[1]s export service --all --as-template=test |
|
| 44 |
+ %[1]s export service --as-template=test |
|
| 45 | 45 |
|
| 46 | 46 |
// export to JSON |
| 47 |
- %[1]s export service --all -o json |
|
| 47 |
+ %[1]s export service -o json |
|
| 48 | 48 |
|
| 49 | 49 |
// convert a file on disk to the latest API version (in YAML, the default) |
| 50 | 50 |
%[1]s export -f a_v1beta3_service.json --output-version=v1 --exact` |
| ... | ... |
@@ -70,16 +70,17 @@ func NewCmdExport(fullName string, f *clientcmd.Factory, in io.Reader, out io.Wr |
| 70 | 70 |
cmd.Flags().Bool("exact", false, "Preserve fields that may be cluster specific, such as service portalIPs or generated names")
|
| 71 | 71 |
cmd.Flags().Bool("raw", false, "If true, do not alter the resources in any way after they are loaded.")
|
| 72 | 72 |
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on")
|
| 73 |
- cmd.Flags().Bool("all", false, "Select all resources in the namespace of the specified resource types")
|
|
| 74 | 73 |
cmd.Flags().Bool("all-namespaces", false, "If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.")
|
| 75 | 74 |
cmd.Flags().VarP(&filenames, "filename", "f", "Filename, directory, or URL to file to use to edit the resource.") |
| 75 |
+ |
|
| 76 |
+ cmd.Flags().Bool("all", true, "Select all resources in the namespace of the specified resource types")
|
|
| 77 |
+ cmd.Flags().MarkDeprecated("all", "all is ignored because specifying a resource without a name selects all the instances of that resource")
|
|
| 76 | 78 |
cmdutil.AddPrinterFlags(cmd) |
| 77 | 79 |
return cmd |
| 78 | 80 |
} |
| 79 | 81 |
|
| 80 | 82 |
func RunExport(f *clientcmd.Factory, exporter Exporter, in io.Reader, out io.Writer, cmd *cobra.Command, args []string, filenames util.StringList) error {
|
| 81 | 83 |
selector := cmdutil.GetFlagString(cmd, "selector") |
| 82 |
- all := cmdutil.GetFlagBool(cmd, "all") |
|
| 83 | 84 |
allNamespaces := cmdutil.GetFlagBool(cmd, "all-namespaces") |
| 84 | 85 |
exact := cmdutil.GetFlagBool(cmd, "exact") |
| 85 | 86 |
asTemplate := cmdutil.GetFlagString(cmd, "as-template") |
| ... | ... |
@@ -104,7 +105,7 @@ func RunExport(f *clientcmd.Factory, exporter Exporter, in io.Reader, out io.Wri |
| 104 | 104 |
NamespaceParam(cmdNamespace).DefaultNamespace().AllNamespaces(allNamespaces). |
| 105 | 105 |
FilenameParam(explicit, filenames...). |
| 106 | 106 |
SelectorParam(selector). |
| 107 |
- ResourceTypeOrNameArgs(all, args...). |
|
| 107 |
+ ResourceTypeOrNameArgs(true, args...). |
|
| 108 | 108 |
Flatten() |
| 109 | 109 |
|
| 110 | 110 |
one := false |
| ... | ... |
@@ -8,14 +8,17 @@ set -o pipefail |
| 8 | 8 |
|
| 9 | 9 |
oc new-app -f examples/sample-app/application-template-stibuild.json --name=sample |
| 10 | 10 |
|
| 11 |
-oc export all --all --all-namespaces --exact |
|
| 11 |
+oc export all --all-namespaces |
|
| 12 | 12 |
|
| 13 |
-[ "$(oc export svc --all -t '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | wc -l)" -ne 0 ]
|
|
| 14 |
-[ "$(oc export svc --all --as-template=template | grep 'kind: Template')" ] |
|
| 15 |
-[ ! "$(oc export svc --all | grep 'clusterIP')" ] |
|
| 16 |
-[ ! "$(oc export svc --all --exact | grep 'clusterIP: ""')" ] |
|
| 17 |
-[ ! "$(oc export svc --all --raw | grep 'clusterIP: ""')" ] |
|
| 18 |
-[ ! "$(oc export svc --all --raw --exact)" ] |
|
| 13 |
+# make sure the deprecated flag doesn't fail |
|
| 14 |
+oc export all --all |
|
| 15 |
+ |
|
| 16 |
+[ "$(oc export svc -t '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' | wc -l)" -ne 0 ]
|
|
| 17 |
+[ "$(oc export svc --as-template=template | grep 'kind: Template')" ] |
|
| 18 |
+[ ! "$(oc export svc | grep 'clusterIP')" ] |
|
| 19 |
+[ ! "$(oc export svc --exact | grep 'clusterIP: ""')" ] |
|
| 20 |
+[ ! "$(oc export svc --raw | grep 'clusterIP: ""')" ] |
|
| 21 |
+[ ! "$(oc export svc --raw --exact)" ] |
|
| 19 | 22 |
[ ! "$(oc export svc -l a=b)" ] # return error if no items match selector |
| 20 | 23 |
[ "$(oc export svc -l a=b 2>&1 | grep 'no resources found')" ] |
| 21 | 24 |
[ "$(oc export svc -l app=sample)" ] |