Module: HostExt::Proxmox::Interfaces
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/host_ext/proxmox/interfaces.rb
Overview
You should have received a copy of the GNU General Public License along with ForemanFogProxmox. If not, see <www.gnu.org/licenses/>.
Instance Method Summary collapse
- #add_interface_to_compute_attributes(index, interface_attributes, compute_attributes) ⇒ Object
- #add_interfaces_to_compute_attributes(attributes) ⇒ Object
- #update(attributes = {}) ⇒ Object
Instance Method Details
#add_interface_to_compute_attributes(index, interface_attributes, compute_attributes) ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/models/concerns/host_ext/proxmox/interfaces.rb', line 30 def add_interface_to_compute_attributes(index,interface_attributes,compute_attributes) compute_attributes[index] = {} compute_attributes[index].store('id',interface_attributes['identifier']) compute_attributes[index].store('_delete',interface_attributes['_destroy']) compute_attributes[index].store('macaddr',interface_attributes['mac']) compute_attributes[index].merge!(interface_attributes['compute_attributes'].reject { |k,_v| k == 'id' }) end |
#add_interfaces_to_compute_attributes(attributes) ⇒ Object
26 27 28 29 |
# File 'app/models/concerns/host_ext/proxmox/interfaces.rb', line 26 def add_interfaces_to_compute_attributes(attributes) attributes['compute_attributes']['interfaces_attributes'] = {} attributes['interfaces_attributes'].each { |index,interface_attributes| add_interface_to_compute_attributes(index,interface_attributes,attributes['compute_attributes']['interfaces_attributes']) } end |
#update(attributes = {}) ⇒ Object
22 23 24 25 |
# File 'app/models/concerns/host_ext/proxmox/interfaces.rb', line 22 def update(attributes = {}) add_interfaces_to_compute_attributes(attributes) super(attributes) end |