code
stringlengths
1
1.73M
language
stringclasses
1 value
class RenamePduDetailToPduModel < ActiveRecord::Migration def self.up rename_table :pdu_details, :pdu_models rename_column :pdus, :pdu_detail_id, :pdu_model_id end def self.down rename_table :pdu_models, :pdu_details rename_column :pdus, :pdu_model_id, :pdu_tail_id end end
Ruby
class CreateColos < ActiveRecord::Migration def self.up create_table :colos do |t| t.string :name t.text :description t.timestamps end end def self.down drop_table :colos end end
Ruby
class RenameDisksToDiskDetails < ActiveRecord::Migration def self.up rename_table :disks, :disk_models rename_column :disk_details, :disk_id, :disk_model_id end def self.down rename_table :disk_models, :disks rename_column :disk_details, :disk_model_id, :disk_id end end
Ruby
class CreateNetworks < ActiveRecord::Migration def self.up create_table :networks do |t| t.integer :network_model_id t.timestamps end end def self.down drop_table :networks end end
Ruby
class GenerateNagiosHostgoups < ActiveRecord::Migration def self.up hostgroups = ['ads','cpm','mq','oc','web','db-master', 'db-slave','ac','tic','feed','tap','me','mm','r','uu', 'www','df','dmdb','dm','mid','tool','tool1','tool2', 'had','log','log101','log104','dev1'] for hostgroup in ho...
Ruby
class IncreaseServiceCheckerDefinitionSize < ActiveRecord::Migration def self.up change_column :service_checkers, :definition, :string, :limit => 1024 end def self.down raise ActiveRecord::IrreversibleMigration end end
Ruby
class AddStateAndTextToAsset < ActiveRecord::Migration def self.up add_column :assets, :state_id, :integer add_column :assets, :note, :text end def self.down remove_column :assets, :state_id remove_column :assets, :note end end
Ruby
class AddRootToCheckLabelToChecker < ActiveRecord::Migration def self.up add_column :service_checks, :root, :text add_column :service_checkers, :label, :text end def self.down remove_column :service_checks, :root remove_column :service_checkers, :label end end
Ruby
class CreateNagiosServiceTemplates < ActiveRecord::Migration def self.up create_table :nagios_service_templates do |t| t.string :name t.timestamps end end def self.down drop_table :nagios_service_templates end end
Ruby
class RenameMemoryDetailToModel < ActiveRecord::Migration def self.up rename_table :memory_details, :memory_models end def self.down rename_table :memory_models, :memory_details end end
Ruby
class AddCountToDiskDetails < ActiveRecord::Migration def self.up add_column :disk_details, :count, :integer end def self.down add_column :disk_details, :count end end
Ruby
class AddAssetTagToAsset < ActiveRecord::Migration def self.up add_column :assets, :asset_tag, :string end def self.down remove_column :assets, :asset_tag end end
Ruby
class ChangeCountOnDiskDetails < ActiveRecord::Migration def self.up rename_column :disk_details, :count, :cnt end def self.down rename_column :disk_details, :cnt, :count end end
Ruby
class CreateVips < ActiveRecord::Migration def self.up create_table :vips do |t| t.integer :asset_id t.integer :port t.timestamps end end def self.down drop_table :vips end end
Ruby
class CreateMemoryDetails < ActiveRecord::Migration def self.up create_table :memory_details do |t| t.string :speed t.string :type t.integer :capacity t.timestamps end end def self.down drop_table :memory_details end end
Ruby
class CreateNagiosServiceGroups < ActiveRecord::Migration def self.up create_table :nagios_service_groups do |t| t.string :name t.timestamps end end def self.down drop_table :nagios_service_groups end end
Ruby
class AddAutofixToServiceChecks < ActiveRecord::Migration def self.up add_column :service_checks, :autofix, :text end def self.down remove_column :service_checks, :autofix end end
Ruby
class CreateDisks < ActiveRecord::Migration def self.up create_table :disks do |t| t.string :name t.string :speed t.integer :capacity t.string :part_number t.timestamps end end def self.down drop_table :disks end end
Ruby
class RenameMemoryToMemoryModel < ActiveRecord::Migration def self.up rename_column :memories, :memory_id, :memory_model_id rename_table :memories, :memory_details end def self.down rename_table :memory_details, :memories rename_column :memories, :memory_model_id, :memory_id end end
Ruby
class ModIpColumn < ActiveRecord::Migration def self.up change_column :interfaces, :ip, :bigint, :unsigned => true end def self.down change_column :interfaces, :ip, :integer end end
Ruby
class LoadColoAndVlanData < ActiveRecord::Migration def self.up end def self.down end end
Ruby
class CreateNagiosContactGroups < ActiveRecord::Migration def self.up create_table :nagios_contact_groups do |t| t.string :name t.timestamps end end def self.down drop_table :nagios_contact_groups end end
Ruby
class CreateNagiosContactGroupServiceEscalationDetails < ActiveRecord::Migration def self.up create_table :nagios_contact_group_service_escalation_details do |t| t.integer :nagios_contact_group_id t.integer :nagios_service_escalation_id t.timestamps end end def self.down drop_table...
Ruby
class CreateAstBases < ActiveRecord::Migration def self.up create_table :ast_bases do |t| t.timestamps end end def self.down drop_table :ast_bases end end
Ruby
class CreateServiceChecks < ActiveRecord::Migration def self.up create_table :service_checks do |t| t.string :name t.string :description t.integer :container_id t.integer :parent_id t.integer :service_checkers_id t.string :definition t.timestamps end end d...
Ruby
class CreateVlanDetails < ActiveRecord::Migration def self.up create_table :vlan_details do |t| t.integer :colo_id t.integer :vlan_id t.string :subnet t.timestamps end end def self.down drop_table :vlan_details end end
Ruby
class AddAuditsTable < ActiveRecord::Migration def self.up create_table :audits, :force => true do |t| t.column :auditable_id, :integer t.column :auditable_type, :string t.column :auditable_parent_id, :integer t.column :auditable_parent_type, :string t.column :user_id, :integer ...
Ruby
class CreateServiceCheckers < ActiveRecord::Migration def self.up create_table :service_checkers do |t| t.string :name t.string :description t.integer :type t.integer :strict t.string :definition t.timestamps end end def self.down drop_table :service_checkers ...
Ruby
class RenameCpuModelsToCpuModel < ActiveRecord::Migration def self.up rename_table :cpu_models, :cpu_model end def self.down rename_table :cpu_model, :cpu_models end end
Ruby
class CreateDnsCnames < ActiveRecord::Migration def self.up create_table :dns_cnames do |t| t.timestamps end end def self.down drop_table :dns_cnames end end
Ruby
class CreateNagiosServices < ActiveRecord::Migration def self.up create_table :nagios_services do |t| t.string :name t.integer :nagios_service_template_id t.string :check_command t.timestamps end end def self.down drop_table :nagios_services end end
Ruby
class CreateStorages < ActiveRecord::Migration def self.up create_table :storages do |t| t.string :raid_type t.string :controller t.string :enclosure t.string :os t.timestamps end end def self.down drop_table :storages end end
Ruby
class AddDracFlagToVlan < ActiveRecord::Migration def self.up add_column :vlans, :drac, :boolean, :default => false remove_column :vlan_details, :drac end def self.down remove_column :vlans, :drac add_column :vlan_details, :drac, :boolean, :default => false end end
Ruby
class CreateNagiosServiceDetails < ActiveRecord::Migration def self.up create_table :nagios_service_details do |t| t.integer :nagios_host_group_id t.integer :nagios_service_id t.timestamps end end def self.down drop_table :nagios_service_details end end
Ruby
class RenameAssetIdInVips < ActiveRecord::Migration def self.up rename_column :vips, :asset_id, :hoster_id end def self.down rename_column :vips, :hoster_id, :asset_id end end
Ruby
class ChangeIpToInteger < ActiveRecord::Migration def self.up change_column :interfaces, :ip, :integer end def self.down change_column :interfaces, :ip, :string end end
Ruby
class CreateDnsCnameDetails < ActiveRecord::Migration def self.up create_table :dns_cname_details do |t| t.integer :dns_cname_id t.integer :asset_id t.timestamps end end def self.down drop_table :dns_cname_details end end
Ruby
class VipAndInterfaceChanges < ActiveRecord::Migration def self.up add_column :vips, :proto, :string add_column :vips, :flag, :string add_column :interfaces, :mac, :string end def self.down remove_column :interfaces, :mac remove_column :vips, :flag remove_column :vips, :proto end e...
Ruby
class AddFrequencyToServiceChecks < ActiveRecord::Migration def self.up add_column :service_checks, :frequency, :integer end def self.down remove_column :service_checks, :frequency end end
Ruby
class FixedUpServers < ActiveRecord::Migration def self.up remove_column :servers, :asset_id add_column :servers, :state, :string add_column :servers, :server_model_id, :integer add_column :servers, :service_tag, :string add_column :servers, :bios_version, :string end def self.down a...
Ruby
class AddDescriptionToNagiosServices < ActiveRecord::Migration def self.up add_column :nagios_services, :description, :text end def self.down remove_column :nagios_services, :description end end
Ruby
class AddFieldsToServiceContainers < ActiveRecord::Migration def self.up add_column :service_containers, :check_command, :text add_column :service_containers, :nagios_service_template_id, :text end def self.down remove_column :service_containers, :check_command remove_column :service_containers, ...
Ruby
class CreateServiceContainers < ActiveRecord::Migration def self.up create_table :service_containers do |t| t.string :name t.string :description t.integer :frequency t.timestamps end end def self.down drop_table :service_containers end end
Ruby
class AddPortToVipServer < ActiveRecord::Migration def self.up add_column :vip_servers, :port, :integer end def self.down remove_column :vip_servers, :port end end
Ruby
class Cpumodelsdetails < ActiveRecord::Migration def self.up add_column :cpu_details, :num_cores, :integer remove_column :cpu_models, :number end def self.down remove_column :cpu_details, :num_cores add_column :cpu_models, :number, :integer end end
Ruby
class CreateCpuDetails < ActiveRecord::Migration def self.up create_table :cpu_details do |t| t.string :type t.string :speed t.integer :number t.timestamps end end def self.down drop_table :cpu_details end end
Ruby
class RenameTypeToMtype < ActiveRecord::Migration def self.up # Because type is actually a key word in rail rename_column :memory_models, :type, :mtype end def self.down rename_column :memory_models, :mtype, :type end end
Ruby
class CreateNagiosServiceEscalationTemplates < ActiveRecord::Migration def self.up create_table :nagios_service_escalation_templates do |t| t.string :name t.timestamps end end def self.down drop_table :nagios_service_escalation_templates end end
Ruby
class CreateAssets < ActiveRecord::Migration def self.up create_table :assets do |t| t.string :name t.integer :colo_id t.integer :resource_id t.string :resource_type t.timestamps end end def self.down drop_table :assets end end
Ruby
class RenameCpuIdToCpuModelId < ActiveRecord::Migration def self.up rename_column :cpu_details, :cpu_id, :cpu_model_id end def self.down rename_column :cpu_details, :cpu_model_id, :cpu_id end end
Ruby
class RemoveIpInPdu < ActiveRecord::Migration def self.up remove_column :pdus, :ip end def self.down add_column :pdus, :ip, :string end end
Ruby
class RenameCpuModelToCpuModels < ActiveRecord::Migration def self.up rename_table :cpu_model, :cpu_models end def self.down rename_table :cpu_models, :cpu_model end end
Ruby
class CreateCpus < ActiveRecord::Migration def self.up create_table :cpus do |t| t.integer :asset_id t.integer :cpu_id t.timestamps # rename_table :cpus, :cpu_models end end def self.down drop_table :cpus end end
Ruby
class ConvertRakeToInteger < ActiveRecord::Migration def self.up change_column :assets, :rack, :integer end def self.down change_column :assets, :rack, :string end end
Ruby
class CreateVipServers < ActiveRecord::Migration def self.up create_table :vip_servers do |t| t.integer :vip_id t.integer :asset_id t.timestamps end end def self.down drop_table :vip_servers end end
Ruby
class CreateNagiosServiceGroupDetails < ActiveRecord::Migration def self.up create_table :nagios_service_group_details do |t| t.integer :nagios_service_group_id t.integer :nagios_host_group_id t.integer :nagios_service_id t.timestamps end end def self.down drop_table :nagios_...
Ruby
class CreateNagiosHostTemplates < ActiveRecord::Migration def self.up create_table :nagios_host_templates do |t| t.string :name t.timestamps end add_column :nagios_host_groups, :nagios_host_template_id, :integer end def self.down drop_table :nagios_host_templates remo...
Ruby
class RenameContainerIdServiceContainerId < ActiveRecord::Migration def self.up rename_column :service_check_details, :container_id, :service_container_id end def self.down rename_column :service_check_details, :service_container_id, :container_id end end
Ruby
class AddInterfaceIdtoVips < ActiveRecord::Migration def self.up add_column :vips, :interface_id, :integer end def self.down remove_column :vips, :interface_id end end
Ruby
class CreateDnsNsRecords < ActiveRecord::Migration def self.up create_table :dns_ns_records do |t| t.string :name t.integer :dns_zone_id t.integer :ttl t.timestamps end end def self.down drop_table :dns_ns_records end end
Ruby
class AddDracIdentifierTo < ActiveRecord::Migration def self.up add_column :vlan_details, :drac, :boolean, :default => false end def self.down remove_column :vlan_details, :drac end end
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the Fast...
Ruby
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispat...
Ruby
load 'deploy' if respond_to?(:namespace) # cap2 differentiator Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } load 'config/deploy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
escalations = NagiosServiceEscalation.find(:all) # Find escalation without proper service_detail escalations.each { |a| if ! a.nagios_service_detail puts "Destroying escalation #{a.id}" a.destroy end } puts "Finding nil nagios_host_group" # Find again escalations = NagiosServiceEscalation.find(:all) ...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
# Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Ruby
# Copyright 2011 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Ruby