Skip to content

Conversation

@stanislav-skkolev-spec
Copy link

@stanislav-skkolev-spec stanislav-skkolev-spec commented Oct 23, 2025

Description

Fix for failing to push policies for vROps. Implemented functionallity of each policy .xml to check for missing alerts, symptoms and recommendations on the target server.

Checklist

  • [ x] I have added relevant error handling and logging messages to help troubleshooting
  • I have added tests that prove my fix is effective or that my feature works
  • [ x] I have added necessary documentation, relevant usage information (if applicable)
  • [ x] I have updated the PR title with affected component, related issue number and a short summary of the changes introduced
  • I have added labels for implementation kind (kind/) and version type (version/)
  • [ x] I have tested against live environment, if applicable
  • I have synced any structure and/or content vRA-NG improvements with vra-ng and ts-vra-ng archetypes (if applicable)
  • I have my changes rebased and squashed to the minimal number of relevant commits. Notice: don't squash all commits
  • I have added a descriptive commit message with a short title, including a Fixed #XXX - or Closed #XXX - prefix to auto-close the issue

Testing

Tested with complex policies on both local and client environment.

Release Notes

Fixes #898

@stanislav-skkolev-spec stanislav-skkolev-spec requested a review from a team as a code owner October 23, 2025 09:11
@github-actions github-actions bot added the kind/bug Something isn't working label Oct 23, 2025
@VenelinBakalov VenelinBakalov changed the title Fix/898 push vrops policies (#898) push vrops policies Oct 23, 2025
@VenelinBakalov VenelinBakalov changed the title (#898) push vrops policies [artifact-manager] (#898) push vrops policies Oct 23, 2025
@VenelinBakalov VenelinBakalov changed the title [artifact-manager] (#898) push vrops policies [artifact-manager] (#898) Fix push of vROps policies Oct 23, 2025
Element policyElement = policyElements.get(i);
String policyName = policyElement.getAttribute("name");
HashMap<String, String> childMap = new HashMap<>();
Optional<Policy> currentPolicy = allPolicies.stream().filter(pol -> pol.getName().equals(policyElement.getAttribute("name"))).findAny();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What amount of policies do we expect here? I am wondering if it makes sense to convert this to a map and use the name or id for key so we can reduce the filtering operations in case we expect a big list.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What amount of policies do we expect here? I am wondering if it makes sense to convert this to a map and use the name or id for key so we can reduce the filtering operations in case we expect a big list.

From what I have saw they are not that many.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map also would make sure no duplicate policy ids are present in the zip.

*/
private void importPolicies(final Package vropsPackage, final File tmpDir) {

List<AlertDefinition> alertDefinitions = restClient.getAlltDefinitionsOfType(VropsPackageMemberType.ALERT_DEFINITION)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor thing but there is a "t" beteween All and Definitions in this functions and the ones belows

ZipOutputStream zos = new ZipOutputStream(fos);
FileInputStream fis = new FileInputStream(file.getPath())) {

ZipEntry zipEntry = new ZipEntry(new File(file.getPath()).getName());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While do we need to create a new File() here from the file input?

fixed some cosmetic errors
@VenelinBakalov VenelinBakalov added lang/java Related to Java Code area/artifact-manager Relates to the `artifact-manager` maven module version/patch The change is a non-breaking bugfix labels Oct 24, 2025
Copy link
Collaborator

@VenelinBakalov VenelinBakalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending discussion after further discoveries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/artifact-manager Relates to the `artifact-manager` maven module kind/bug Something isn't working lang/java Related to Java Code version/patch The change is a non-breaking bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to push vROps policies which are pulled from another vROps server

5 participants