Skip to content

Instantly share code, notes, and snippets.

View jsmartt's full-sized avatar

Jared Smartt jsmartt

View GitHub Profile
@jsmartt
jsmartt / get_oneview_hw_network_type.rb
Last active November 16, 2017 16:41
Method to get the network_type of a particular ServerHardware
def get_oneview_hw_network_type(client, hw)
enclosure = find_oneview_resource(:Enclosure, client, uri: hw['locationUri'])
logical_enclosure = find_oneview_resource(:LogicalEnclosure, client, uri: enclosure['logicalEnclosureUri'])
interconnect_type_uris = [] # List of InterconnectType URIs in this LogicalEnclosure
return 'unmanaged' if logical_enclosure['logicalInterconnectUris'].blank?
logical_enclosure['logicalInterconnectUris'].each do |li_uri|
li = find_oneview_logical_interconnect!(client, uri: li_uri)
# Keep track of the LogicalInterconnect URIs for this LogicalEnclosure
interconnect_type_uris |= li['interconnectMap']['interconnectMapEntries'].map { |e| e['permittedInterconnectTypeUri'] }.compact
end
#
# Cookbook Name:: test_package
# Recipe:: default
#
# This recipe is meant to show the issues with the package resource, specifically
# using Yum, where multiple packages need to be installed/updated at once. It was
# executed with Kitchen-vagrant with the "centos-7.2" platform name. Nothing fancy.
# Make sure my yum cache is clean. Gets around some 404 errors for old mirrors.
require 'chef/provisioning'
with_driver 'oneview'
machine 'web01' do
machine_options :driver_options => {
:server_template => 'Template - Web Server',
:os_build => 'CHEF-RHEL-6.5-x64',
:host_name => 'chef-web01',