ManageIQ / manageiq-providers-cisco_intersight

ManageIQ provider for Cisco Intersight
Apache License 2.0
2 stars 15 forks source link

add physical server profile template #81

Closed eilam20 closed 1 year ago

eilam20 commented 1 year ago

Add the physical_server_profile_templates to Physical Infra Manager.

agrare commented 1 year ago

Specs found a good issue, looks like you need to subclass the PhysicalServerProfileTemplate under your PhysicalInfraManager (make sure to remember the require_nested :PhysicalServerProfileTemplate

eilam20 commented 1 year ago

Specs found a good issue, looks like you need to subclass the PhysicalServerProfileTemplate under your PhysicalInfraManager (make sure to remember the require_nested :PhysicalServerProfileTemplate

I added the require_nested :PhysicalServerProfileTemplate to the PhysicalInfraManager in plugins/manageiq-providers-cisco_intersight/app/models/manageiq/providers/cisco_intersight/physical_infra_manager.rb

is it ok? can you rerun the tests?

agrare commented 1 year ago

@eilam20 looks like the vcr was manually edited, and since you have your 2.times in the it with the :vcr option, you need to add it twice. Usually we like to have a VCR.use_cassette in the 2.times block so you don't have double the HTTP interactions but short cut you can just add the same block twice.

agrare commented 1 year ago

If you want to allow maintainer edits I can push my local changes where I got this green

eilam20 commented 1 year ago

If you want to allow maintainer edits I can push my local changes where I got this green

I pushed the change, but how can I allow maintainer edits?

agrare commented 1 year ago

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

agrare commented 1 year ago

@eilam20 you can also run the specs locally by running bundle exec rake to check if the tests pass, github actions is annoying and I have to approve the workflow run everytime you push a change.

agrare commented 1 year ago
commit f6070d8b1f305b5277ae3e86878a669bce0cbc18
Author: Adam Grare <adam@grare.com>
Date:   Tue Nov 29 16:49:37 2022 -0500

    Fix VCR ProfileTemplates HTTP interaction

diff --git a/spec/vcr_cassettes/ManageIQ_Providers_CiscoIntersight_PhysicalInfraManager_Refresher/refresh/will_perform_a_full_refresh.yml b/spec/vcr_cassettes/ManageIQ_Providers_CiscoIntersight_PhysicalInfraManager_Refresher/refresh/will_perform_a_full_refresh.yml
index e77e9f9..ad49af2 100644
--- a/spec/vcr_cassettes/ManageIQ_Providers_CiscoIntersight_PhysicalInfraManager_Refresher/refresh/will_perform_a_full_refresh.yml
+++ b/spec/vcr_cassettes/ManageIQ_Providers_CiscoIntersight_PhysicalInfraManager_Refresher/refresh/will_perform_a_full_refresh.yml
@@ -64246,7 +64246,7 @@ http_interactions:
   recorded_at: Thu, 12 May 2022 13:47:31 GMT
 - request:
     method: get
-    uri: https://intersight.com/api/v1/server/ProfilesTemplates
+    uri: https://intersight.com/api/v1/server/ProfileTemplates
     body:
       encoding: US-ASCII
       string: ''
@@ -64324,108 +64324,108 @@ http_interactions:
         {
           "ObjectType": "server.ProfileTemplate.List",
           "Results": [
-                    {
-                        "ClassId": "server.ProfileTemplate",
-                        "ObjectType": "server.ProfileTemplate",
-                        "AccountMoid": "5ed10e437564612d3352cc2d",
-                        "CreateTime": "2022-10-12T16:53:46.348Z",
-                        "DomainGroupMoid": "5ed10e437564612d3352cc37",
-                        "ModTime": "2022-11-29T12:32:37.902Z",
-                        "Moid": "6346f11a77696e2d300b6049",
-                        "Owners": [
-                          "5ed10e437564612d3352cc2d"
-                        ],
-                        "SharedScope": "",
-                        "Tags": [
+            {
+              "ClassId": "server.ProfileTemplate",
+              "ObjectType": "server.ProfileTemplate",
+              "AccountMoid": "5ed10e437564612d3352cc2d",
+              "CreateTime": "2022-10-12T16:53:46.348Z",
+              "DomainGroupMoid": "5ed10e437564612d3352cc37",
+              "ModTime": "2022-11-29T12:32:37.902Z",
+              "Moid": "6346f11a77696e2d300b6049",
+              "Owners": [
+                "5ed10e437564612d3352cc2d"
+              ],
+              "SharedScope": "",
+              "Tags": [

-                        ],
-                        "VersionContext": null,
-                        "Ancestors": [
+              ],
+              "VersionContext": null,
+              "Ancestors": [

-                        ],
-                        "PermissionResources": [
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "organization.Organization",
-                            "Moid": "631803456972652d3097eb8d",
-                            "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
-                          }
-                        ],
-                        "DisplayNames": null,
-                        "Description": "",
-                        "Name": "xLabs-Development",
-                        "Type": "instance",
-                        "Action": "No-op",
-                        "ConfigContext": {
-                          "ClassId": "policy.ConfigContext",
-                          "ObjectType": "policy.ConfigContext",
-                          "ConfigState": "",
-                          "ConfigType": "",
-                          "ControlAction": "ConfigChange",
-                          "ErrorState": "",
-                          "OperState": ""
-                        },
-                        "PolicyBucket": [
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "bios.Policy",
-                            "Moid": "6346f13e6275722d30ed4a0e",
-                            "link": "https://www.intersight.com/api/v1/bios/Policies/6346f13e6275722d30ed4a0e"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "access.Policy",
-                            "Moid": "6346f21c6275722d30ed6144",
-                            "link": "https://www.intersight.com/api/v1/access/Policies/6346f21c6275722d30ed6144"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "ipmioverlan.Policy",
-                            "Moid": "6346f2356275722d30ed63d9",
-                            "link": "https://www.intersight.com/api/v1/ipmioverlan/Policies/6346f2356275722d30ed63d9"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "iam.EndPointUserPolicy",
-                            "Moid": "6346f26b6275722d30ed691f",
-                            "link": "https://www.intersight.com/api/v1/iam/EndPointUserPolicies/6346f26b6275722d30ed691f"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "kvm.Policy",
-                            "Moid": "6347308a6275722d30f410e2",
-                            "link": "https://www.intersight.com/api/v1/kvm/Policies/6347308a6275722d30f410e2"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "boot.PrecisionPolicy",
-                            "Moid": "6346f1b26275722d30ed5613",
-                            "link": "https://www.intersight.com/api/v1/boot/PrecisionPolicies/6346f1b26275722d30ed5613"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "vnic.LanConnectivityPolicy",
-                            "Moid": "634846a5ea6a1292fc328d82",
-                            "link": "https://www.intersight.com/api/v1/vnic/LanConnectivityPolicies/634846a5ea6a1292fc328d82"
-                          }
-                        ],
-                        "TargetPlatform": "FIAttached",
-                        "UuidAddressType": "NONE",
-                        "Usage": 1,
-                        "Organization": {
-                          "ClassId": "mo.MoRef",
-                          "ObjectType": "organization.Organization",
-                          "Moid": "631803456972652d3097eb8d",
-                          "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
-                        }
-                      }
-                      ]
+              ],
+              "PermissionResources": [
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "organization.Organization",
+                  "Moid": "631803456972652d3097eb8d",
+                  "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
+                }
+              ],
+              "DisplayNames": null,
+              "Description": "",
+              "Name": "xLabs-Development",
+              "Type": "instance",
+              "Action": "No-op",
+              "ConfigContext": {
+                "ClassId": "policy.ConfigContext",
+                "ObjectType": "policy.ConfigContext",
+                "ConfigState": "",
+                "ConfigType": "",
+                "ControlAction": "ConfigChange",
+                "ErrorState": "",
+                "OperState": ""
+              },
+              "PolicyBucket": [
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "bios.Policy",
+                  "Moid": "6346f13e6275722d30ed4a0e",
+                  "link": "https://www.intersight.com/api/v1/bios/Policies/6346f13e6275722d30ed4a0e"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "access.Policy",
+                  "Moid": "6346f21c6275722d30ed6144",
+                  "link": "https://www.intersight.com/api/v1/access/Policies/6346f21c6275722d30ed6144"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "ipmioverlan.Policy",
+                  "Moid": "6346f2356275722d30ed63d9",
+                  "link": "https://www.intersight.com/api/v1/ipmioverlan/Policies/6346f2356275722d30ed63d9"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "iam.EndPointUserPolicy",
+                  "Moid": "6346f26b6275722d30ed691f",
+                  "link": "https://www.intersight.com/api/v1/iam/EndPointUserPolicies/6346f26b6275722d30ed691f"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "kvm.Policy",
+                  "Moid": "6347308a6275722d30f410e2",
+                  "link": "https://www.intersight.com/api/v1/kvm/Policies/6347308a6275722d30f410e2"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "boot.PrecisionPolicy",
+                  "Moid": "6346f1b26275722d30ed5613",
+                  "link": "https://www.intersight.com/api/v1/boot/PrecisionPolicies/6346f1b26275722d30ed5613"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "vnic.LanConnectivityPolicy",
+                  "Moid": "634846a5ea6a1292fc328d82",
+                  "link": "https://www.intersight.com/api/v1/vnic/LanConnectivityPolicies/634846a5ea6a1292fc328d82"
+                }
+              ],
+              "TargetPlatform": "FIAttached",
+              "UuidAddressType": "NONE",
+              "Usage": 1,
+              "Organization": {
+                "ClassId": "mo.MoRef",
+                "ObjectType": "organization.Organization",
+                "Moid": "631803456972652d3097eb8d",
+                "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
+              }
+            }
+          ]
         }
     http_version:
   recorded_at: Thu, 12 May 2022 13:46:56 GMT
 - request:
     method: get
-    uri: https://intersight.com/api/v1/server/ProfilesTemplates
+    uri: https://intersight.com/api/v1/server/ProfileTemplates
     body:
       encoding: US-ASCII
       string: ''
@@ -64503,102 +64503,102 @@ http_interactions:
         {
           "ObjectType": "server.ProfileTemplate.List",
           "Results": [
-                    {
-                        "ClassId": "server.ProfileTemplate",
-                        "ObjectType": "server.ProfileTemplate",
-                        "AccountMoid": "5ed10e437564612d3352cc2d",
-                        "CreateTime": "2022-10-12T16:53:46.348Z",
-                        "DomainGroupMoid": "5ed10e437564612d3352cc37",
-                        "ModTime": "2022-11-29T12:32:37.902Z",
-                        "Moid": "6346f11a77696e2d300b6049",
-                        "Owners": [
-                          "5ed10e437564612d3352cc2d"
-                        ],
-                        "SharedScope": "",
-                        "Tags": [
+            {
+              "ClassId": "server.ProfileTemplate",
+              "ObjectType": "server.ProfileTemplate",
+              "AccountMoid": "5ed10e437564612d3352cc2d",
+              "CreateTime": "2022-10-12T16:53:46.348Z",
+              "DomainGroupMoid": "5ed10e437564612d3352cc37",
+              "ModTime": "2022-11-29T12:32:37.902Z",
+              "Moid": "6346f11a77696e2d300b6049",
+              "Owners": [
+                "5ed10e437564612d3352cc2d"
+              ],
+              "SharedScope": "",
+              "Tags": [

-                        ],
-                        "VersionContext": null,
-                        "Ancestors": [
+              ],
+              "VersionContext": null,
+              "Ancestors": [

-                        ],
-                        "PermissionResources": [
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "organization.Organization",
-                            "Moid": "631803456972652d3097eb8d",
-                            "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
-                          }
-                        ],
-                        "DisplayNames": null,
-                        "Description": "",
-                        "Name": "xLabs-Development",
-                        "Type": "instance",
-                        "Action": "No-op",
-                        "ConfigContext": {
-                          "ClassId": "policy.ConfigContext",
-                          "ObjectType": "policy.ConfigContext",
-                          "ConfigState": "",
-                          "ConfigType": "",
-                          "ControlAction": "ConfigChange",
-                          "ErrorState": "",
-                          "OperState": ""
-                        },
-                        "PolicyBucket": [
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "bios.Policy",
-                            "Moid": "6346f13e6275722d30ed4a0e",
-                            "link": "https://www.intersight.com/api/v1/bios/Policies/6346f13e6275722d30ed4a0e"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "access.Policy",
-                            "Moid": "6346f21c6275722d30ed6144",
-                            "link": "https://www.intersight.com/api/v1/access/Policies/6346f21c6275722d30ed6144"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "ipmioverlan.Policy",
-                            "Moid": "6346f2356275722d30ed63d9",
-                            "link": "https://www.intersight.com/api/v1/ipmioverlan/Policies/6346f2356275722d30ed63d9"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "iam.EndPointUserPolicy",
-                            "Moid": "6346f26b6275722d30ed691f",
-                            "link": "https://www.intersight.com/api/v1/iam/EndPointUserPolicies/6346f26b6275722d30ed691f"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "kvm.Policy",
-                            "Moid": "6347308a6275722d30f410e2",
-                            "link": "https://www.intersight.com/api/v1/kvm/Policies/6347308a6275722d30f410e2"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "boot.PrecisionPolicy",
-                            "Moid": "6346f1b26275722d30ed5613",
-                            "link": "https://www.intersight.com/api/v1/boot/PrecisionPolicies/6346f1b26275722d30ed5613"
-                          },
-                          {
-                            "ClassId": "mo.MoRef",
-                            "ObjectType": "vnic.LanConnectivityPolicy",
-                            "Moid": "634846a5ea6a1292fc328d82",
-                            "link": "https://www.intersight.com/api/v1/vnic/LanConnectivityPolicies/634846a5ea6a1292fc328d82"
-                          }
-                        ],
-                        "TargetPlatform": "FIAttached",
-                        "UuidAddressType": "NONE",
-                        "Usage": 1,
-                        "Organization": {
-                          "ClassId": "mo.MoRef",
-                          "ObjectType": "organization.Organization",
-                          "Moid": "631803456972652d3097eb8d",
-                          "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
-                        }
-                      }
-                      ]
+              ],
+              "PermissionResources": [
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "organization.Organization",
+                  "Moid": "631803456972652d3097eb8d",
+                  "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
+                }
+              ],
+              "DisplayNames": null,
+              "Description": "",
+              "Name": "xLabs-Development",
+              "Type": "instance",
+              "Action": "No-op",
+              "ConfigContext": {
+                "ClassId": "policy.ConfigContext",
+                "ObjectType": "policy.ConfigContext",
+                "ConfigState": "",
+                "ConfigType": "",
+                "ControlAction": "ConfigChange",
+                "ErrorState": "",
+                "OperState": ""
+              },
+              "PolicyBucket": [
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "bios.Policy",
+                  "Moid": "6346f13e6275722d30ed4a0e",
+                  "link": "https://www.intersight.com/api/v1/bios/Policies/6346f13e6275722d30ed4a0e"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "access.Policy",
+                  "Moid": "6346f21c6275722d30ed6144",
+                  "link": "https://www.intersight.com/api/v1/access/Policies/6346f21c6275722d30ed6144"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "ipmioverlan.Policy",
+                  "Moid": "6346f2356275722d30ed63d9",
+                  "link": "https://www.intersight.com/api/v1/ipmioverlan/Policies/6346f2356275722d30ed63d9"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "iam.EndPointUserPolicy",
+                  "Moid": "6346f26b6275722d30ed691f",
+                  "link": "https://www.intersight.com/api/v1/iam/EndPointUserPolicies/6346f26b6275722d30ed691f"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "kvm.Policy",
+                  "Moid": "6347308a6275722d30f410e2",
+                  "link": "https://www.intersight.com/api/v1/kvm/Policies/6347308a6275722d30f410e2"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "boot.PrecisionPolicy",
+                  "Moid": "6346f1b26275722d30ed5613",
+                  "link": "https://www.intersight.com/api/v1/boot/PrecisionPolicies/6346f1b26275722d30ed5613"
+                },
+                {
+                  "ClassId": "mo.MoRef",
+                  "ObjectType": "vnic.LanConnectivityPolicy",
+                  "Moid": "634846a5ea6a1292fc328d82",
+                  "link": "https://www.intersight.com/api/v1/vnic/LanConnectivityPolicies/634846a5ea6a1292fc328d82"
+                }
+              ],
+              "TargetPlatform": "FIAttached",
+              "UuidAddressType": "NONE",
+              "Usage": 1,
+              "Organization": {
+                "ClassId": "mo.MoRef",
+                "ObjectType": "organization.Organization",
+                "Moid": "631803456972652d3097eb8d",
+                "link": "https://www.intersight.com/api/v1/organization/Organizations/631803456972652d3097eb8d"
+              }
+            }
+          ]
         }
     http_version:
   recorded_at: Thu, 12 May 2022 13:46:56 GMT

Here are my local changes to get this green. I'm not sure what editor you're using but the indentation on the YAML is way off

eilam20 commented 1 year ago

@agrare how can I run only the spec of the cisco provider?

miq-bot commented 1 year ago

Checked commits https://github.com/Autosde/manageiq-providers-cisco_intersight/compare/6dd14448c29e14becd1eb76311f2d04bc87d0c4d~...324e40e24018f7c537cb7b26a4ebd99ad5dea32c with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint 6 files checked, 0 offenses detected Everything looks fine. :cake:

agrare commented 1 year ago

@eilam20 if you are in the manageiq-providers-cisco_intersight repo then bundle exec rake will only run those specs.

eilam20 commented 1 year ago

@agrare I see that the tests ran successfully, so it can be merged?

agrare commented 1 year ago

woohoo :tada: