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

add physical server profile template #81

Merged
merged 20 commits into from Nov 30, 2022

Conversation

eilam20
Copy link
Contributor

@eilam20 eilam20 commented Nov 18, 2022

Add the physical_server_profile_templates to Physical Infra Manager.

@agrare agrare self-assigned this Nov 22, 2022
@agrare agrare added the enhancement New feature or request label Nov 22, 2022
move deploy_server_from_template_queue to core
set the deploy_server_from_template function to be an instance method
Comment on lines +27 to +38
def refresh
task_ids = EmsRefresh.queue_refresh_task(ext_management_system)
if task_ids.blank?
process_error("Failed to queue refresh", "error")
queue_signal(:error)
else
context[:refresh_task_ids] = task_ids
update!(:context => context)

queue_signal(:poll_refresh)
end
end
Copy link
Member

Choose a reason for hiding this comment

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

NOTE this looks identical to the method in core except for the target_entity/ext_management_system bit. It would be nice to add a refresh_target method in core that defaults to target_entity if targeted_refresh is supported and ext_management_system otherwise which would allow you to override it and simply return ext_management_system if you just want to do a full.

Would be a good follow-up PR if you want to implement that in core.

Copy link
Member

Choose a reason for hiding this comment

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

@agrare
Copy link
Member

agrare commented Nov 28, 2022

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 eilam20 reopened this Nov 29, 2022
@eilam20 eilam20 closed this Nov 29, 2022
@eilam20 eilam20 reopened this Nov 29, 2022
@eilam20
Copy link
Contributor Author

eilam20 commented Nov 29, 2022

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?

@@ -33778,6 +33778,185 @@ http_interactions:
]
}
http_version:
recorded_at: Thu, 12 May 2022 13:46:56 GMT- request:
Copy link
Member

@agrare agrare Nov 29, 2022

Choose a reason for hiding this comment

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

This is a YAML syntax error

Suggested change
recorded_at: Thu, 12 May 2022 13:46:56 GMT- request:
recorded_at: Thu, 12 May 2022 13:46:56 GMT
- request:

Comment on lines 33858 to 33862
{
"ObjectType": "server.ProfileTemplate.List",
"Results":
[
{
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{
"ObjectType": "server.ProfileTemplate.List",
"Results":
[
{
{
"ObjectType": "server.Profile.List",
"Results": [
{

Then indent the rest of this accordingly

@agrare
Copy link
Member

agrare commented Nov 29, 2022

@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
Copy link
Member

agrare commented Nov 29, 2022

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

@eilam20
Copy link
Contributor Author

eilam20 commented Nov 29, 2022

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
Copy link
Member

agrare commented Nov 29, 2022

@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
Copy link
Member

agrare commented Nov 29, 2022

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
Copy link
Contributor Author

eilam20 commented Nov 29, 2022

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

@miq-bot
Copy link
Member

miq-bot commented Nov 29, 2022

Checked commits Autosde/manageiq-providers-cisco_intersight@6dd1444~...324e40e 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. 🍰

@agrare
Copy link
Member

agrare commented Nov 30, 2022

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

@eilam20
Copy link
Contributor Author

eilam20 commented Nov 30, 2022

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

@agrare
Copy link
Member

agrare commented Nov 30, 2022

woohoo 🎉

@agrare agrare merged commit 5677ae8 into ManageIQ:master Nov 30, 2022
@Fryguy Fryguy added this to the Petrosian milestone Sep 14, 2023
@Fryguy Fryguy added this to Petrosian in Roadmap Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Roadmap
  
Petrosian
Development

Successfully merging this pull request may close these issues.

None yet

4 participants