Skip to content

Commit

Permalink
updating for OS Install
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttyso committed Apr 8, 2024
1 parent d3f9120 commit 0884d39
Show file tree
Hide file tree
Showing 16 changed files with 1,157 additions and 579 deletions.
744 changes: 488 additions & 256 deletions classes/build.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions classes/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ def ipdict(i, ipindex):
kwargs.server_profiles[name].os_vendor = os_vendor
#if not os_vendor == 'Windows':
kwargs = server_profile_networks(name, p, kwargs)
pvars['targets'] = sorted(pvars['targets'], key=lambda item: item['name'])
pvars['targets'] = sorted(pvars['targets'], key=lambda ele: ele.name)
kwargs.class_path= f'profiles,{self.type}'
kwargs = ezfunctions.ez_append(pvars, kwargs)
kwargs.server_profiles = dict(sorted(kwargs.server_profiles.items()))
Expand Down Expand Up @@ -2234,7 +2234,7 @@ def imm(self, kwargs):
kwargs = isight.api('serial_number').calls(kwargs)
serial_moids = kwargs.pmoids
serial = i.serial_numbers[0]
serial_moids = {k: v for k, v in sorted(serial_moids.items(), key=lambda item: (item[1]['switch_id']))}
serial_moids = {k: v for k, v in sorted(serial_moids.items(), key=lambda ele: ele[1].switch_id)}
kwargs.api_filter= f"RegisteredDevice.Moid eq '{serial_moids[serial]['registered_device']}'"
kwargs.uri = 'asset/Targets'
kwargs = isight.api('asset_target').calls(kwargs)
Expand Down Expand Up @@ -2523,8 +2523,8 @@ def os_install(self, kwargs):
if v.os_installed == False:
kwargs.mac_a = v.macs[0].mac
kwargs.mac_b = v.macs[1].mac
if v.os_vendor == 'VMware': kwargs.api_body = ezfunctions.vmware_installation_body(v, kwargs)
elif v.os_vendor == 'Microsoft': kwargs.api_body = ezfunctions.windows_installation_body(v, kwargs)
if v.os_vendor == 'VMware': kwargs.api_body = ezfunctions.installation_body_vmware(v, kwargs)
elif v.os_vendor == 'Microsoft': kwargs.api_body = ezfunctions.installation_body_windows(v, kwargs)
kwargs.method = 'post'
kwargs.uri = 'os/Installs'
if v.boot_volume == 'san':
Expand Down
2 changes: 1 addition & 1 deletion classes/claim_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def claim_targets(kwargs):
pcolor.Yellow(f' !! ERROR !!\n One or More Servers Could not Connect to Intersight.')
pcolor.Yellow(f' Please Check the Output above. claim_device.py line 203.')
pcolor.Cyan(f'\n{"-"*108}\n')
sys.exit(1)
len(False); sys.exit(1)

# logout of any sessions active after exception handling
kwargs.result = result
Expand Down
10 changes: 5 additions & 5 deletions classes/day2tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def add_vlans(self, kwargs):
else:
prRed(f'\n{"-"*108}\n\n Missing Required YAML File Argument `-y`. Exiting Process.')
prRed(f'\n{"-"*108}\n')
sys.exit(1)
len(False); sys.exit(1)
#======================================================
# Get VLAN List and Organizations from YAML configuration file.
#======================================================
Expand Down Expand Up @@ -205,7 +205,7 @@ def add_vlans(self, kwargs):
idata.mac.append(i.mac_pool)
for k, v in idata.items():
if re.search('ethernet_network_group|lan_connectivity', k):
idata[k] = sorted(v, key=lambda item: item['vlan_id'])
idata[k] = sorted(v, key=lambda ele: ele.vlan_id)
else: idata[k] = sorted(list(numpy.unique(numpy.array(v))))
#======================================================
# Query the API for the Ethernet Network Group Policies
Expand Down Expand Up @@ -612,8 +612,8 @@ def server_inventory(self, kwargs):
if e.Profile.Moid == servers[k].moid:
servers[k].vnics.append({'name': e.Name, 'mac_address':e.MacAddress,'mtu':qos_policies[e.EthQosPolicy.Moid].mtu})
for k, v in servers.items():
servers[k].vnics.sort(key=lambda d: d['name'])
servers[k].vhbas.sort(key=lambda d: d['name'])
servers[k].vnics.sort(key=lambda ele: ele.name)
servers[k].vhbas.sort(key=lambda ele: ele.name)
if v.platform == 'UCSFI': servers[k].domain = domains[v.registration].name
elif len(v.parent) > 0: servers[k].domain = domains[v.parent].name
if len(servers) > 0:
Expand Down Expand Up @@ -823,7 +823,7 @@ def update_profile(self, org, target, yaml_arg, ydata, kwargs):
policy_bucket.append({'Moid': policy_moid, 'ObjectType': object_type})
pbucket = []
for x in policy_bucket: pbucket.append(x.toDict())
policy_bucket = (sorted(pbucket, key=lambda k: (k['ObjectType'])))
policy_bucket = sorted(pbucket, key=lambda ele: ele.ObjectType)
#======================================================
# Patch the Profile with new Policy Bucket.
#======================================================
Expand Down
Loading

0 comments on commit 0884d39

Please sign in to comment.