Sha256: 999ec52a41ad4515733eb43802c62f52890cf26a7452e131261da798a446928e
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
# coding: utf-8 require "milc/gcloud/compute" module Milc module Gcloud module Compute module FirewallRules def compare(attrs, res) attrs = attrs.dup Milc.logger.debug("*" * 100) [:allow, :source_ranges, :target_tags].each do |k| attrs[k] = split_sort(attrs[k]) end res = res.symbolize_keys res[:allow] = res[:allowed].map{|h| proto = h["IPProtocol"] if ports = h["ports"] ports.map{|port| '%s:%s' % [proto, port] } else [proto] end }.tap(&:flatten!).sort { :sourceRanges => :source_ranges, :targetTags => :target_tags, }.each do |k1, k2| res[k2] = res[k1] ? res[k1].sort : nil end super(attrs, res) end def call_update(cmd_args, attrs, &block) attrs = attrs.reject{|k,v| k == :network} super(cmd_args, attrs, &block) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
milc-0.1.0 | lib/milc/gcloud/compute/firewall_rules.rb |