zapix 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,10 @@ class Templates < Base
5
5
  client.template_exists({'name' => name})
6
6
  end
7
7
 
8
+ def create(options)
9
+ client.template_create(options) unless exists?(options['host'])
10
+ end
11
+
8
12
  def get_id(name)
9
13
  if(exists?(name))
10
14
  client.template_get({'filter' => {'name' => name}}).first['templateid']
data/lib/zapix/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zapix
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/spec/zapix_specs.rb CHANGED
@@ -12,6 +12,7 @@ another_hostgroup = 'anotherhostgroup'
12
12
  hostgroup_with_hosts = 'withhosts'
13
13
  template_1 = 'Template OS Linux'
14
14
  template_2 = 'Template App MySQL'
15
+ templates_hostgroup = 'Templates'
15
16
  application = 'web scenarios'
16
17
  host = 'hostname'
17
18
  scenario = 'scenario'
@@ -204,6 +205,14 @@ existing_action_name
204
205
  options['macros'] = [{'macro' => '{$TESTMACRO}', 'value' => 'this is only a test macro'}]
205
206
  zrc.hosts.update_macros(options)
206
207
  end
208
+
209
+ it 'creates a template' do
210
+ template_name = 'Template Tomcat'
211
+ options = {'host' => template_name}
212
+ options['groups'] = zrc.hostgroups.get_id(templates_hostgroup)
213
+ zrc.templates.create(options)
214
+ zrc.templates.exists?(template_name).should be_true
215
+ end
207
216
  end
208
217
 
209
218
  describe 'applications' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zapix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-20 00:00:00.000000000 Z
12
+ date: 2013-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: -3818181725703302818
141
+ hash: 619888090407519833
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  none: false
144
144
  requirements:
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: -3818181725703302818
150
+ hash: 619888090407519833
151
151
  requirements: []
152
152
  rubyforge_project:
153
153
  rubygems_version: 1.8.24