Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Sharing Policy not pulled if the scope (project) is different than the configured in maven settings.xml #279

Closed
alekskolev opened this issue May 30, 2024 · 1 comment
Assignees

Comments

@alekskolev
Copy link

alekskolev commented May 30, 2024

Description

When pulling the content sharing policies from vRA there are no files created under policies/content-sharing folder

Steps to Reproduce

  1. Create projects proj1 and proj2
  2. Create blueprint under proj1 shared with all projects
  3. Create templates content source for proj1 (ex. proj1CS)
  4. Create content sharing policy (proj2CSP) with scope proj2 and content source from step 3 (proj1CS)
  5. Add the policy in the content.yaml
policy:
  content-sharing:
    - proj2CSP
  1. Set <vrang.project.name>proj1</vrang.project.name> in maven settings.xml
  2. Execute mvn vra-ng:pull

Preconditions:

Expected behavior:
File proj2CSP.json created under policies/content-sharing

Actual behavior:
File proj2CSP.json is not created (no "Storing contentSharingPolicy 'proj2CSP'" line in the log)

Reproduces how often:
100%

Component/s:
maven/plugins/vra-ng

Affects Build/s:
2.38.1

Environment

vRA8.16.0

Client

  • Build Tools for VMware Aria Version: 2.38.1
  • Visual Studio Code Version: 1.89.1
  • OS Version: Windows 11 Enterprise 23H2

Server

  • vRealize Automation Version: 8.16.0

Failure Logs

Related issues and PRs

Additional Context

When I change the project name in maven setting to proj2 (and empty all else in content.yaml so there is no errors fetching other items) the file is created. After this when you put back the proj1 in maven settings and push vra code - there is additional policy with scope proj1 created (expected but not correct)

Discussed with development team:
In the response from vRA for the policies there is a field projectId. It should be populated in the policy file (as projectName) on pull so it can be looked up on push for the proper projectId (CATALOG_SOURCE_IDENTIFIER is done similarly). If it's missing in the file then the configured on maven settings could be used for backward compatibility
Current API response:

{
   "id": "policy_id",
   "name": "proj2CSP",
   "typeId": "com.vmware.policy.catalog.entitlement",
   "enforcementType": "HARD",
   "orgId": "org_Id",
   "projectId": "proj2_Id",
   "definition": {
      "entitledUsers": [{
            "items": [{
                  "id": "proj1CS_Id",
                  "type": "CATALOG_SOURCE_IDENTIFIER"
               }
            ],
            "userType": "USER",
            "principals": [{
                  "type": "PROJECT",
                  "referenceId": ""
               }
            ]
         }
      ]
   }
}

The documentation should be updated with a detailed description
Should be checked also the case when there are more than one Content Sharing Policy with the same name as currently a file with index is created for each additional one

@akantchev
Copy link
Contributor

Issue resolved with PR: #281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants