openshift / openshift-ansible-contrib

Additional roles and playbooks for OpenShift installation and management
https://www.openshift.com
Apache License 2.0
283 stars 372 forks source link

Fix JSON output of namespaces in project_export.sh #1079

Closed tongpu closed 5 years ago

tongpu commented 5 years ago

What does this PR do?

When a user with access to multiple projects is used to perform the backup, all projects are being written to the /ns.json files and a subsequent restore fails, because project_import.sh can't detect the correct namespace to restore to.

How should this be manually tested?

Before the change (multiple items in the JSON object):

project_export.sh example
jq '.items | length' example/ns.json
17

After the change (items is not part of the JSON object anymore

project_export.sh example
jq '.items | length' example/ns.json
0
cat example/ns.json
{
  "apiVersion": "v1",
  "kind": "Namespace",
  "metadata": {
    "name": "adfinis"
  },
  "spec": {
    "finalizers": [
      "openshift.io/origin",
      "kubernetes"
    ]
  }
}

Who would you like to review this?

cc: @tomassedovic PTAL

openshift-ci-robot commented 5 years ago

Hi @tongpu. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.