resource_in 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50c53656ed2eb245432807330e68350588076db3
4
- data.tar.gz: fbe5aa998daff838fbb1dbeded3ef37a427a0bf8
3
+ metadata.gz: 26fa0d6fc3854520c3498b2f7fedcca03fe9adf5
4
+ data.tar.gz: f27754bb3fa96d6ee23c5fa24cc52c5166dd5970
5
5
  SHA512:
6
- metadata.gz: 85ad60cfc628cac8a5ca8f5c581896988d1cbc2c4cbeaa3867f88b7a8c81bec827c4c1e4ee5d2baf1731c4eaba24455e0d9df9369c8dd3e2d8c3b69f1ff1e75b
7
- data.tar.gz: 27364307f50be33cdd2ec8fe2a58c4719ff45a286b97ad56ff6b96461b584a19a9e6685aca79aac9a449d0c848bbf1883c239b8d78561df369481e0124092840
6
+ metadata.gz: a44b48a273e136970f8e3570f74ed534e9dee89df837dc56c6ce5236821b7484b8f1a0e8fd12765d88b2d4243bf056a01f81e4440e39bb077cd149a76a51106f
7
+ data.tar.gz: 988d2fb229ad6eab3bd77918abc81a70436147dd74d5bbb21cdf2efa848ad8565023e32c067007cd5319b318e3258e4325a7d36ea4e648ef4749bba7073b1e07
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ Gemfile.lock
3
3
  /tmp/
4
4
  lib/resource_in/driver
5
5
  *.gem
6
+ build
data/README.md CHANGED
@@ -1,2 +1,4 @@
1
1
  Resource Integrator
2
2
  ===================
3
+
4
+ This project aims to abstract any kind of IT 'Resources' which are managed by verious kind of component, and provides integrated interfaces to control them.
data/build.mk CHANGED
@@ -9,12 +9,12 @@ clean:
9
9
  [ -d ./build ] && sudo rm -fR ./build || true
10
10
 
11
11
  ucs-build:
12
- sudo apt-get install python2.7
12
+ sudo apt-get -y install python2.7 python-pip python-dev
13
13
  wget https://communities.cisco.com/servlet/JiveServlet/download/36899-13-76835/UcsSdk-0.8.3.tar.gz -O build/UcsSdk-0.8.3.tar.gz
14
14
  tar xzf build/UcsSdk-0.8.3.tar.gz -C build
15
15
  cd build/UcsSdk-0.8.3/; /usr/bin/python setup.py build && sudo /usr/bin/python setup.py install
16
16
 
17
17
  vmware-build:
18
- sudo apt-get install python3 python3-pip git
18
+ sudo apt-get -y install python3 python3-pip git
19
19
  git clone https://github.com/vmware/pyvmomi.git build/pyvmomi
20
20
  cd build/pyvmomi/; /usr/bin/python3 setup.py build && sudo bash -lc "/usr/bin/python3 setup.py install"
@@ -6,7 +6,7 @@ require 'terminal-table/import'
6
6
  module ResourceIn
7
7
  class Command
8
8
  def self.list(opts, argv)
9
- unless Authorization.is_viewer?
9
+ unless !!Config['ignore-auth'] or Authorization.is_viewer?
10
10
  puts "[Warning] User '#{ENV['USER']}' needs 'Viewer' permission to execute command 'list'"
11
11
  return
12
12
  end
@@ -29,7 +29,7 @@ module ResourceIn
29
29
  end
30
30
  end
31
31
  def self.get(opts, argv)
32
- unless Authorization.is_user?
32
+ unless !!Config['ignore-auth'] or Authorization.is_user?
33
33
  puts "[Warning] User '#{ENV['USER']}' needs 'User' permission to execute command 'get'"
34
34
  return
35
35
  end
@@ -6,13 +6,25 @@ module ResourceIn
6
6
 
7
7
  class << self
8
8
  def [](param)
9
- (@config_data ||= load_config)['resource-in'][param]
9
+ unless (@config_data ||= load_config).key? 'resource-in'
10
+ return nil
11
+ end
12
+
13
+ unless @config_data['resource-in'] != nil
14
+ return nil
15
+ end
16
+
17
+ unless @config_data['resource-in'].key? param
18
+ return nil
19
+ end
20
+
21
+ @config_data['resource-in'][param]
10
22
  end
11
23
 
12
24
  private
13
25
  def load_config
14
26
  unless FileTest.exists?(config_path)
15
- raise RuntimeError "invalid configuration file (#{config_path})"
27
+ raise RuntimeError.new("invalid configuration file (#{config_path})")
16
28
  end
17
29
 
18
30
  YAML.load_file(config_path)
@@ -8,8 +8,6 @@ module ResourceIn
8
8
  @cachepath = '/tmp/cache.racktables'
9
9
  end
10
10
  def get_lastupdate(vm)
11
- validate_condition(vm)
12
-
13
11
  invoke("#{@cmd_lastupdate} '#{vm}'", @cachepath + ".last_update.#{vm}")
14
12
  end
15
13
  end
@@ -1,3 +1,3 @@
1
1
  module ResourceIn
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/resource-in.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency "terminal-table", "1.5.2"
22
22
  spec.add_runtime_dependency "colorize", "0.7.7"
23
- spec.add_runtime_dependency "dl_racktables", "~> 0.0.1"
23
+ spec.add_runtime_dependency "dl_racktables", "~> 0.0.2"
24
24
  spec.add_development_dependency "bundler", "~> 1.11"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -0,0 +1,21 @@
1
+ # configuration for UCS managers
2
+ ucs:
3
+ - server: 'Hostname or IP address of UCS Manager'
4
+ userid: 'Login userid of UCS Manager'
5
+ passwd: 'Password of UCS Manager'
6
+
7
+ # configuration for VMware
8
+ vmware:
9
+ - server: 'Hostname or IP address of vCenter'
10
+ userid: 'Login userid of vCenter'
11
+ passwd: 'Password of vCenter'
12
+
13
+ # configuration for Racktables
14
+ racktables:
15
+ server: '203.209.146.68' # IPAddress of Racktables
16
+ userid: 'Login userid of Racktables'
17
+ passwd: 'Password of Racktables'
18
+
19
+ # This parameter is usefull for development
20
+ resource-in:
21
+ ignore-auth: true
data/tmp/testrc ADDED
@@ -0,0 +1,5 @@
1
+ # for development
2
+ export RUBYLIB=${HOME}/resource-in/lib:$RUBYLIB
3
+
4
+ # specifing test configuration path
5
+ export RIN_CONFIG=${HOME}/resource-in/tmp/config
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resource_in
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyasu OHYAMA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-01 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-table
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.1
47
+ version: 0.0.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.1
54
+ version: 0.0.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +124,8 @@ files:
124
124
  - lib/resource_in/resource.rb
125
125
  - lib/resource_in/version.rb
126
126
  - resource-in.gemspec
127
+ - tmp/config.example
128
+ - tmp/testrc
127
129
  homepage: https://github.com/userlocalhost2000/resource-in
128
130
  licenses: []
129
131
  metadata: {}