Module: Construqt

Defined in:
lib/construqt.rb,
lib/construqt/bgps.rb,
lib/construqt/tags.rb,
lib/construqt/util.rb,
lib/construqt/hosts.rb,
lib/construqt/users.rb,
lib/construqt/vlans.rb,
lib/construqt/cables.rb,
lib/construqt/hostid.rb,
lib/construqt/ipsecs.rb,
lib/construqt/regions.rb,
lib/construqt/version.rb,
lib/construqt/networks.rb,
lib/construqt/resource.rb,
lib/construqt/services.rb,
lib/construqt/addresses.rb,
lib/construqt/firewalls.rb,
lib/construqt/templates.rb,
lib/construqt/interfaces.rb,
lib/construqt/flavour/flavour.rb,
lib/construqt/flavour/delegates.rb,
lib/construqt/flavour/ciscian/ciscian.rb,
lib/construqt/flavour/unknown/unknown.rb,
lib/construqt/flavour/plantuml/plantuml.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu.rb,
lib/construqt/flavour/ciscian/dialect_hp-2510g.rb,
lib/construqt/flavour/mikrotik/flavour_mikrotik.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_bgp.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_dns.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_opvn.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_vrrp.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_ipsec.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb,
lib/construqt/flavour/ciscian/dialect_dlink-dgs15xx.rb,
lib/construqt/flavour/mikrotik/flavour_mikrotik_bgp.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb,
lib/construqt/flavour/ubuntu/flavour_ubuntu_services.rb,
lib/construqt/flavour/mikrotik/flavour_mikrotik_ipsec.rb,
lib/construqt/flavour/mikrotik/flavour_mikrotik_result.rb,
lib/construqt/flavour/mikrotik/flavour_mikrotik_schema.rb,
lib/construqt/flavour/mikrotik/flavour_mikrotik_interface.rb

Defined Under Namespace

Modules: Bgps, Firewalls, Flavour, Ipsecs, Networks, Regions, Tags, Util Classes: Addresses, Cables, HostId, Hosts, Interfaces, Resources, Services, Templates, Users, Vlans

Constant Summary collapse

VERSION =
"0.0.5"

Class Method Summary collapse

Class Method Details

.log_level(level) ⇒ Object



18
19
20
# File 'lib/construqt.rb', line 18

def self.log_level(level)
  @logger.level = level
end

.loggerObject



36
37
38
# File 'lib/construqt.rb', line 36

def self.logger
  @logger
end

.produce(region_or_hosts) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/construqt.rb', line 75

def self.produce(region_or_hosts)
  hosts = false
  hosts = region_or_hosts if region_or_hosts.kind_of?(Array)
  hosts = region_or_hosts.hosts.get_hosts if region_or_hosts.kind_of?(Construqt::Regions::Region)
  throw "need a region or hosts list" unless hosts
  Construqt::Ipsecs.build_config()
  Construqt::Bgps.build_config()
  hosts.inject({}) do |r, host|
    r[host.region.name] ||= []
    r[host.region.name] << host
    r
  end.values.each do |hosts|
    hosts.first.region.hosts.build_config(hosts)
    hosts.first.region.interfaces.build_config(hosts)
    hosts.first.region.hosts.commit(hosts)
  end
end