You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/10/06 21:03:12 UTC

[GitHub] [cloudstack] GabrielBrascher opened a new pull request #4387: Fix JsonSyntaxException when creating API command response #4355

GabrielBrascher opened a new pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387


   ## Description
   <!--- Describe your changes in detail -->
   Added missing `\"` (from `"*****"` to `"*****\""`) at _obfuscatePassword method from AsyncJobManagerImpl.java#L485_
   https://github.com/apache/cloudstack/blob/0f3f2a09370a18301db28ec3d28efe746b6437c9/framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java#L485
   
   The lack of `"` caused a JsonSyntaxException exception when the host response had a password (e.g. if the host has out of band enabled e.g. IPMI or Redfish).
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   Fixes: #4355
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   <!-- ## Screenshots (if appropriate):  -->
   
   ## How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   - JUnit test
   - manual tests
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland edited a comment on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland edited a comment on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-706027812


   didn't work @GabrielBrascher 
   ```
   ======================================================================
   ERROR: Tests degraded HA state when agent is stopped/killed
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 355, in test_hostha_kvm_host_degraded
       self.assertIssueCommandState('ON', 'On')
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 493, in assertIssueCommandState
       self.issuePowerActionCmd(command)
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 539, in issuePowerActionCmd
       raise e
   Exception: Job failed: {jobprocstatus : 0, created : u'2020-10-08T02:10:21+0000', completed : u'2020-10-08T02:10:21+0000', cmd : u'org.apache.cloudstack.api.command.admin.outofbandmanagement.IssueOutOfBandManagementPowerActionCmd', userid : u'a8138930-08c3-11eb-8574-1e00ca0138c9', jobstatus : 2, jobid : u'f8439839-f821-4bd6-b7a3-820345992038', jobresultcode : 530, jobresulttype : u'object', jobresult : {errorcode : 530, errortext : u'com.google.gson.stream.MalformedJsonException: Unterminated object near "password":"p*****"","action":"ON","desc'}, accountid : u'a812be97-08c3-11eb-8574-1e00ca0138c9'}
   ```
   note that in this case the replacement yield a double double quote, which is one in excess.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#discussion_r504562129



##########
File path: framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
##########
@@ -475,14 +475,14 @@ public AsyncJob queryJob(final long jobId, final boolean updatePollTime) {
         return job;
     }
 
-    private String obfuscatePassword(String result, boolean hidePassword) {
+    public String obfuscatePassword(String result, boolean hidePassword) {
         if (hidePassword) {
             String pattern = "\"password\":";
             if (result != null) {
                 if (result.contains(pattern)) {
                     String[] resp = result.split(pattern);
                     String psswd = resp[1].toString().split(",")[0];
-                    result = resp[0] + pattern + psswd.replace(psswd.substring(2, psswd.length() - 1), "*****") + "," + resp[1].split(",", 2)[1];
+                    result = resp[0] + pattern + psswd.replace(psswd.substring(2, psswd.length() - 1), "*****\"") + "," + resp[1].split(",", 2)[1];

Review comment:
       Why not complete replace with the `****`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708659293


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-704608824


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708659633


   @GabrielBrascher a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-709245708


   @blueorangutan test


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-706027812


   did work @GabrielBrascher 
   ```
   ======================================================================
   ERROR: Tests degraded HA state when agent is stopped/killed
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 355, in test_hostha_kvm_host_degraded
       self.assertIssueCommandState('ON', 'On')
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 493, in assertIssueCommandState
       self.issuePowerActionCmd(command)
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 539, in issuePowerActionCmd
       raise e
   Exception: Job failed: {jobprocstatus : 0, created : u'2020-10-08T02:10:21+0000', completed : u'2020-10-08T02:10:21+0000', cmd : u'org.apache.cloudstack.api.command.admin.outofbandmanagement.IssueOutOfBandManagementPowerActionCmd', userid : u'a8138930-08c3-11eb-8574-1e00ca0138c9', jobstatus : 2, jobid : u'f8439839-f821-4bd6-b7a3-820345992038', jobresultcode : 530, jobresulttype : u'object', jobresult : {errorcode : 530, errortext : u'com.google.gson.stream.MalformedJsonException: Unterminated object near "password":"p*****"","action":"ON","desc'}, accountid : u'a812be97-08c3-11eb-8574-1e00ca0138c9'}
   ```
   note that in this case the replacement yield a double double quote, which is one in excess.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-705084064


   @DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-709247237


   @DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-709634837


   <b>Trillian test result (tid-2969)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 37791 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4387-t2969-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
   Smoke tests completed. 85 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd merged pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708435261


   @DaanHoogland I proposed removing the password because I don't see much of use in having it on the response, it seems that does not aggregate relevant information.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708463744


   @DaanHoogland fair enough, I am going to re-check these flows to propose a fix keeping the response as it is operating on a consistent password.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland edited a comment on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland edited a comment on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-706027812






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708230392


   @GabrielBrascher If sometimes an extra '\"' is added and sometimes not, this is still going to be an issue if you try to remove it. I'd rather replace the exact "something" with "****" or "s***". it seems that we are brushing a bug under the carpet otherwise.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-705288540


   <b>Trillian test result (tid-2910)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 29745 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4387-t2910-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
   Intermittent failure detected: /marvin/tests/smoke/test_outofbandmanagement_nestedplugin.py
   Intermittent failure detected: /marvin/tests/smoke/test_outofbandmanagement.py
   Intermittent failure detected: /marvin/tests/smoke/test_hostha_kvm.py
   Smoke tests completed. 81 look OK, 4 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   ContextSuite context=TestDeployVirtioSCSIVM>:setup | `Error` | 0.00 | test_deploy_virtio_scsi_vm.py
   test_oobm_issue_power_cycle | `Error` | 2.17 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_off | `Error` | 1.16 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_on | `Error` | 1.16 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_reset | `Error` | 2.16 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_soft | `Error` | 2.18 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_status | `Error` | 2.17 | test_outofbandmanagement_nestedplugin.py
   test_oobm_enabledisable_across_clusterzones | `Error` | 20.11 | test_outofbandmanagement.py
   test_oobm_issue_power_cycle | `Error` | 4.29 | test_outofbandmanagement.py
   test_oobm_issue_power_off | `Error` | 4.25 | test_outofbandmanagement.py
   test_oobm_issue_power_on | `Error` | 4.24 | test_outofbandmanagement.py
   test_oobm_issue_power_reset | `Error` | 3.25 | test_outofbandmanagement.py
   test_oobm_issue_power_soft | `Error` | 3.26 | test_outofbandmanagement.py
   test_oobm_issue_power_status | `Error` | 4.25 | test_outofbandmanagement.py
   test_oobm_zchange_password | `Error` | 5.32 | test_outofbandmanagement.py
   test_hostha_kvm_host_degraded | `Error` | 4.43 | test_hostha_kvm.py
   test_hostha_kvm_host_fencing | `Error` | 4.45 | test_hostha_kvm.py
   test_hostha_kvm_host_recovering | `Error` | 7.52 | test_hostha_kvm.py
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on a change in pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#discussion_r504755098



##########
File path: framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
##########
@@ -475,14 +475,14 @@ public AsyncJob queryJob(final long jobId, final boolean updatePollTime) {
         return job;
     }
 
-    private String obfuscatePassword(String result, boolean hidePassword) {
+    public String obfuscatePassword(String result, boolean hidePassword) {
         if (hidePassword) {
             String pattern = "\"password\":";
             if (result != null) {
                 if (result.contains(pattern)) {
                     String[] resp = result.split(pattern);
                     String psswd = resp[1].toString().split(",")[0];
-                    result = resp[0] + pattern + psswd.replace(psswd.substring(2, psswd.length() - 1), "*****") + "," + resp[1].split(",", 2)[1];
+                    result = resp[0] + pattern + psswd.replace(psswd.substring(2, psswd.length() - 1), "*****\"") + "," + resp[1].split(",", 2)[1];

Review comment:
       I am not sure if replacing the password with `****` would then affect the intention of the password response. 
   I think that the idea was to offer admins a hint on the password.
   
   But that is good to keep in mind, thanks for the heads up @rhtyd. What do you think @DaanHoogland?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-705083337


   @blueorangutan test


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-706264717


   @DaanHoogland what about removing the password from the JSON response?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-704608976


   @GabrielBrascher a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-706027812


   did work @GabrielBrascher 
   ```
   ======================================================================
   ERROR: Tests degraded HA state when agent is stopped/killed
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 355, in test_hostha_kvm_host_degraded
       self.assertIssueCommandState('ON', 'On')
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 493, in assertIssueCommandState
       self.issuePowerActionCmd(command)
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 539, in issuePowerActionCmd
       raise e
   Exception: Job failed: {jobprocstatus : 0, created : u'2020-10-08T02:10:21+0000', completed : u'2020-10-08T02:10:21+0000', cmd : u'org.apache.cloudstack.api.command.admin.outofbandmanagement.IssueOutOfBandManagementPowerActionCmd', userid : u'a8138930-08c3-11eb-8574-1e00ca0138c9', jobstatus : 2, jobid : u'f8439839-f821-4bd6-b7a3-820345992038', jobresultcode : 530, jobresulttype : u'object', jobresult : {errorcode : 530, errortext : u'com.google.gson.stream.MalformedJsonException: Unterminated object near "password":"p*****"","action":"ON","desc'}, accountid : u'a812be97-08c3-11eb-8574-1e00ca0138c9'}
   ```
   note that in this case the replacement yield a double double quote, which is one in excess.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-709872445


   @rhtyd no further comments? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708682692


   Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2180


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708659020


   @DaanHoogland I found out why some cases the regex failed and some not. Updated code to fix it (for good, I hope). Also added test case addressing both situations.
   
   The regex uses comma to set the split separator: `String psswd = resp[1].toString().split(",")[0];`
   This works on cases such as:
   ```
   ...,"password":"password","action":"OFF"...
   ```
   
   However, the specific case that I got with OOBM it has the following JSON String:
   
   ```
   "username":"root","password":"password"},"resourcestate":"PrepareForMaintenance","hahost":false
   ```
   
   With that said, the code has been updated to deal with both cases: `"password":"password"},` and `"password":"password",`.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland edited a comment on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland edited a comment on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-706027812


   didn't work @GabrielBrascher 
   ```
   ======================================================================
   ERROR: Tests degraded HA state when agent is stopped/killed
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 355, in test_hostha_kvm_host_degraded
       self.assertIssueCommandState('ON', 'On')
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 493, in assertIssueCommandState
       self.issuePowerActionCmd(command)
     File "/marvin/tests/smoke/test_hostha_kvm.py", line 539, in issuePowerActionCmd
       raise e
   Exception: Job failed: {jobprocstatus : 0, created : u'2020-10-08T02:10:21+0000', completed : u'2020-10-08T02:10:21+0000', cmd : u'org.apache.cloudstack.api.command.admin.outofbandmanagement.IssueOutOfBandManagementPowerActionCmd', userid : u'a8138930-08c3-11eb-8574-1e00ca0138c9', jobstatus : 2, jobid : u'f8439839-f821-4bd6-b7a3-820345992038', jobresultcode : 530, jobresulttype : u'object', jobresult : {errorcode : 530, errortext : u'com.google.gson.stream.MalformedJsonException: Unterminated object near "password":"p*****"","action":"ON","desc'}, accountid : u'a812be97-08c3-11eb-8574-1e00ca0138c9'}
   ```
   note that in this case the replacement yield a double double quote (`"password":"p*****""`), which is one in excess.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-708440271


   It is adding value but only if having a password is optional, @GabrielBrascher. And i think hiding it should be optional as well as a private cloud operator might opt for having it visible. I am not going to argue that anymore, btw.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4387: Fix JsonSyntaxException when creating API command response #4355

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4387:
URL: https://github.com/apache/cloudstack/pull/4387#issuecomment-704619789


   Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2140


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org