lambom 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lambom.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'lambom'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.date = '2013-12-16'
5
5
  s.summary = "Tool to apply riyic configurations"
6
6
  s.description = "Riyic is a server configuration service based on chef (http://riyic.com). The lambom gem is a tool to apply, through chef-solo, your riyic configurations in your server"
data/lib/lambom/api.rb CHANGED
@@ -8,7 +8,8 @@ require 'net/http'
8
8
  module Lambom
9
9
  class ApiClient
10
10
  API_URL = {
11
- :production => "http://riyic.com/api/v1",
11
+ #:production => "https://riyic.com/api/v1",
12
+ :production => "http://www2.ruleyourcloud.com/api/v1",
12
13
  :development => "http://10.0.3.1:3000/api/v1"
13
14
  }
14
15
 
data/lib/lambom/config.rb CHANGED
@@ -2,7 +2,8 @@ require 'yaml'
2
2
 
3
3
  module Lambom
4
4
  class Config
5
- FILE = '/etc/riyic/lambom.conf'
5
+ CONFIG_DIR = "/etc/riyic"
6
+ FILE = "#{CONFIG_DIR}/lambom.conf"
6
7
 
7
8
 
8
9
  attr_accessor :server, :private_key_file, :environment, :loglevel
@@ -20,10 +20,10 @@ module Lambom
20
20
  rvm_version
21
21
  }
22
22
 
23
- CHEF_CONF_FILE = '/etc/chef/solo.rb'
23
+ CHEF_CONF_FILE = "#{Lambom::Config::CONFIG_DIR}/solo.rb"
24
24
 
25
25
  CHEF_CONF = {
26
- development: '
26
+ :development => '
27
27
  cookbook_path ["/mnt/opscode/cookbooks", "/mnt/others/cookbooks", "/mnt/riyic/cookbooks"]
28
28
  '
29
29
  }
@@ -55,6 +55,7 @@ cookbook_path ["/mnt/opscode/cookbooks", "/mnt/others/cookbooks", "/mnt/riyic/co
55
55
  file.close
56
56
 
57
57
  run_cmd('/usr/bin/chef-solo',
58
+ '-c',CHEF_CONF_FILE,
58
59
  '--log_level', conf.loglevel,
59
60
  '--logfile', "#{conf.logdir}/#{conf.logfile}",
60
61
  '-j', filename)
@@ -66,30 +67,34 @@ cookbook_path ["/mnt/opscode/cookbooks", "/mnt/others/cookbooks", "/mnt/riyic/co
66
67
  ENV["PATH"] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
67
68
 
68
69
  #creamos directorio de logs
69
- FileUtils.mkdir_p(conf.logdir) unless Dir.exists?(conf.logdir)
70
+ FileUtils.mkdir_p(conf.logdir) unless File.directory?(conf.logdir)
70
71
  File.chmod(0750, conf.logdir)
71
72
 
72
73
  #creamos o directorio cache de chef
73
- FileUtils.mkdir_p(TEMP) unless Dir.exists?(TEMP)
74
+ FileUtils.mkdir_p(TEMP) unless File.directory?(TEMP)
74
75
  File.chmod(0750,TEMP)
75
76
 
76
77
  # establecemos o archivo de configuracion de chef segun o entorno
77
- switch_chef_conf(conf.environment)
78
+ switch_chef_conf(conf.environment.to_sym)
78
79
  end
79
80
 
80
81
  def descargar_cookbooks
81
82
  unless (conf.environment == 'development')
82
83
  # aqui podemos meter unha ejecucion de berkshelf para descargar os cookbooks necesarios
83
84
  run_cmd('curl','-o','/tmp/cookbooks.tar.gz', '-L',COOKBOOKS_URL)
84
- FileUtils.mkdir_p(DEFAULT_CHEF_PATH) unless Dir.exists?(DEFAULT_CHEF_PATH)
85
+ FileUtils.mkdir_p(DEFAULT_CHEF_PATH) unless File.directory?(DEFAULT_CHEF_PATH)
85
86
  run_cmd('tar','xzf','/tmp/cookbooks.tar.gz','--no-same-owner','-C', DEFAULT_CHEF_PATH);
86
87
  end
87
88
  end
88
89
 
89
90
  def switch_chef_conf(env)
91
+ file = File.new(CHEF_CONF_FILE,"w")
92
+
90
93
  if CHEF_CONF.has_key?(env)
91
- IO.write(CHEF_CONF_FILE,CHEF_CONF[env])
94
+ file.write(CHEF_CONF[env])
92
95
  end
96
+
97
+ file.close
93
98
  end
94
99
  end
95
100
  end
data/lib/lambom.rb CHANGED
@@ -19,7 +19,8 @@ module Lambom
19
19
  def run(argv)
20
20
  puts "DEBUG ENABLED" if $debug
21
21
  puts "args recibidos #{argv.inspect}" if $debug
22
-
22
+ raise 'Must run as root' unless Process.uid == 0
23
+
23
24
  #cargar config
24
25
  conf = Lambom::Config.new.load
25
26
 
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - J. Gomez
@@ -13,6 +14,7 @@ dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: oj
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: mixlib-authentication
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: mixlib-shellout
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -83,25 +90,26 @@ files:
83
90
  homepage: https://github.com/RIYIC/lambom
84
91
  licenses:
85
92
  - Apache-2.0
86
- metadata: {}
87
93
  post_install_message:
88
94
  rdoc_options: []
89
95
  require_paths:
90
96
  - lib
91
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
92
99
  requirements:
93
- - - '>='
100
+ - - ! '>='
94
101
  - !ruby/object:Gem::Version
95
102
  version: '0'
96
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
97
105
  requirements:
98
- - - '>='
106
+ - - ! '>='
99
107
  - !ruby/object:Gem::Version
100
108
  version: '0'
101
109
  requirements: []
102
110
  rubyforge_project:
103
- rubygems_version: 2.1.11
111
+ rubygems_version: 1.8.24
104
112
  signing_key:
105
- specification_version: 4
113
+ specification_version: 3
106
114
  summary: Tool to apply riyic configurations
107
115
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 144162d3f7b3636e039a8d09381ee380d484972f
4
- data.tar.gz: 1d8b1ee42de69116792b4cc96c874c5ed8451e3b
5
- SHA512:
6
- metadata.gz: dc7a6b4ab57fd0821abc439336e2015e7a709035d82bf3e08785888866da28a549e169cd675536896580232ddf7c773150edd2d81f51cc4ab91cb74523465bd8
7
- data.tar.gz: b6fbfe89b8e83257f24fd2c39323a06594d940cee1351b62c07b97bf66280a2d5982b121da4e3b03db01715b8425da5a55c95a846cf484abcf99ef764e81700f