Skip to content

Commit

Permalink
Merge pull request #315 from skyarch-networks/zabbix-agent
Browse files Browse the repository at this point in the history
Zabbix agent attributes
  • Loading branch information
root-beer committed Aug 17, 2016
2 parents 00e1818 + dea6d36 commit 38eeb26
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion Gemfile
Expand Up @@ -75,7 +75,6 @@ group :development, :test do
gem "awesome_print"
gem 'rack-contrib'
gem 'ruby-prof'
gem 'xray-rails'

gem 'quiet_assets'

Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Expand Up @@ -520,9 +520,6 @@ GEM
nori (~> 2.0)
rubyntlm (~> 0.6.0)
wmi-lite (1.0.0)
xray-rails (0.1.21)
coffee-rails
rails (>= 3.1.0)
yard (0.9.5)

PLATFORMS
Expand Down Expand Up @@ -603,7 +600,6 @@ DEPENDENCIES
therubyracer
uglifier
unicorn-rails
xray-rails
yard

BUNDLED WITH
Expand Down
6 changes: 4 additions & 2 deletions app/controllers/nodes_controller.rb
Expand Up @@ -242,10 +242,12 @@ def schedule_yum
# [infra_id] 認証に必要
def edit_attributes
physical_id = params.require(:id)

fqdn = @infra.project.zabbix_server.fqdn
node = Node.new(physical_id)

@attrs = node.enabled_attributes.dup
@attrs = node.enabled_attributes.dup.select do |_key, value|
value[:default] = fqdn
end
@current_attributes = node.get_attributes
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/node/attribute.rb
Expand Up @@ -79,14 +79,14 @@ def available_attributes
type: Array,
recipes: ['role[zabbix_agent]'],
description: 'Zabbix FQDN ex) ec2-54-165-199-182.compute-1.amazonaws.com',
default: AppSetting.get.zabbix_fqdn,
default: nil,
required: true,
},
'zabbix/agent/servers_active': {
type: Array,
recipes: ['role[zabbix_agent]'],
description: 'Zabbix FQDN ex) ec2-54-165-199-182.compute-1.amazonaws.com',
default: AppSetting.get.zabbix_fqdn,
default: nil,
required: true,
},
'zabbix/database/install_method': {
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/nodes_controller_spec.rb
Expand Up @@ -342,8 +342,10 @@
let(:req){get :edit_attributes, id: physical_id, infra_id: infra.id}
let(:attrs){{foo: {bar: 'hoge'}}}
let(:current_attr){{foo: 'piyopiyo'}}
let(:fqdn){'ec2-ip-.zabbix.com-example'}
let(:node){double(:node, enabled_attributes: attrs, get_attributes: current_attr)}
before do
expect_any_instance_of(Infrastructure).to receive_message_chain(:project, :zabbix_server, :fqdn).and_return(fqdn)
allow(Node).to receive(:new).with(physical_id).and_return(node)
req
end
Expand Down

0 comments on commit 38eeb26

Please sign in to comment.