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

OCPBUGS-28575: Fix issue with PS type mismatch #2051

Merged
merged 1 commit into from Jan 31, 2024

Conversation

sebsoto
Copy link
Contributor

@sebsoto sebsoto commented Jan 30, 2024

This commit fixes an issue which would be seen when the cni config file was created with no content. When using the -replace operator with $null, an empty object array was returned. This caused comparison issues with the expected config as it was comparing an array with a string.

This commit fixes an issue which would be seen when the cni config file
was created with no content. When using the -replace operator with
$null, an empty object array was returned. This caused comparison issues
with the expected config as it was comparing an array with a string.
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jan 30, 2024
@openshift-ci-robot
Copy link

@sebsoto: This pull request references Jira Issue OCPBUGS-28575, which is invalid:

  • expected the bug to target the "4.16.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

This commit fixes an issue which would be seen when the cni config file was created with no content. When using the -replace operator with $null, an empty object array was returned. This caused comparison issues with the expected config as it was comparing an array with a string.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 30, 2024
Copy link
Contributor

openshift-ci bot commented Jan 30, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@sebsoto
Copy link
Contributor Author

sebsoto commented Jan 30, 2024

/approve cancel

Copy link
Contributor

@jrvaldes jrvaldes left a comment

Choose a reason for hiding this comment

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

Left few questions, otherwise LGTM

@@ -140,7 +140,10 @@ $cni_template=$cni_template.Replace("provider_address",$provider_address)
# Compare CNI config with existing file, and replace if necessary
$existing_config=""
if(Test-Path -Path CNI_CONFIG_PATH) {
` + " $existing_config=((Get-Content -Path \"CNI_CONFIG_PATH\" -Raw) -Replace \"`r\",\"\")" + `
$config_file_content=(Get-Content -Path CNI_CONFIG_PATH -Raw)
if($config_file_content -ne $null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should it also check for non empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you're asking if it should check if the file is empty, thats what this is doing
$config_file_content will be $null if /k/cni/config/cni.conf is empty

@@ -140,7 +140,10 @@ $cni_template=$cni_template.Replace("provider_address",$provider_address)
# Compare CNI config with existing file, and replace if necessary
$existing_config=""
if(Test-Path -Path CNI_CONFIG_PATH) {
` + " $existing_config=((Get-Content -Path \"CNI_CONFIG_PATH\" -Raw) -Replace \"`r\",\"\")" + `
$config_file_content=(Get-Content -Path CNI_CONFIG_PATH -Raw)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't an existing file without content throw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is not the case

PS C:\Users\Administrator> rm /k/cni/config/cni.conf; New-Item /k/cni/config/cni.conf -type file


    Directory: C:\k\cni\config


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        1/30/2024   5:23 PM              0 cni.conf


PS C:\Users\Administrator> cat /k/cni/config/cni.conf
PS C:\Users\Administrator> $foo=(cat /k/cni/config/cni.conf)
PS C:\Users\Administrator> $foo
PS C:\Users\Administrator> $foo.gettype()
You cannot call a method on a null-valued expression. 
At line:1 char:1
+ $foo.gettype()
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

@jrvaldes
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2024
Copy link
Contributor

@saifshaikh48 saifshaikh48 left a comment

Choose a reason for hiding this comment

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

/lgtm

@sebsoto sebsoto marked this pull request as ready for review January 30, 2024 17:32
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 30, 2024
@sebsoto
Copy link
Contributor Author

sebsoto commented Jan 30, 2024

/jira-refresh

@sebsoto
Copy link
Contributor Author

sebsoto commented Jan 30, 2024

/cherry-pick release-4.15

@openshift-cherrypick-robot

@sebsoto: once the present PR merges, I will cherry-pick it on top of release-4.15 in a new PR and assign it to you.

In response to this:

/cherry-pick release-4.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mansikulkarni96
Copy link
Member

/approve
Thanks for fixing this issue!

Copy link
Contributor

openshift-ci bot commented Jan 30, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mansikulkarni96

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 30, 2024
@sebsoto
Copy link
Contributor Author

sebsoto commented Jan 30, 2024

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jan 30, 2024
@openshift-ci-robot
Copy link

@sebsoto: This pull request references Jira Issue OCPBUGS-28575, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @rrasouli

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jan 30, 2024
@openshift-ci openshift-ci bot requested a review from rrasouli January 30, 2024 17:48
@sebsoto
Copy link
Contributor Author

sebsoto commented Jan 30, 2024

/test remaining-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD c06b57f and 2 for PR HEAD f74a819 in total

@mtnbikenc
Copy link
Member

One or more of Snyk's services may be temporarily unavailable.

/test security

Copy link
Contributor

openshift-ci bot commented Jan 31, 2024

@sebsoto: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 42ecf27 into openshift:master Jan 31, 2024
17 checks passed
@openshift-ci-robot
Copy link

@sebsoto: Jira Issue OCPBUGS-28575: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-28575 has been moved to the MODIFIED state.

In response to this:

This commit fixes an issue which would be seen when the cni config file was created with no content. When using the -replace operator with $null, an empty object array was returned. This caused comparison issues with the expected config as it was comparing an array with a string.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-cherrypick-robot

@sebsoto: new pull request created: #2052

In response to this:

/cherry-pick release-4.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants