bixby-provision 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db4d0ededfc5a0b6d36c32f9e7d7cfee185f6c46
4
- data.tar.gz: de7a32debeecca803ac62728aca97a1629046e80
3
+ metadata.gz: 78e2d92af6c09642d09a9cceea7b8293078039b5
4
+ data.tar.gz: da695f8b5263d53eadeebe9586b58bb8d4427304
5
5
  SHA512:
6
- metadata.gz: db476128adaab503e365a90abe5b038cb10b180f41be65db3406bd1c24bda111d3a8f6d848e610c66dcf35eb61dc2a3b3dbbd5037b8e1a556d0971dc9f60e847
7
- data.tar.gz: 94b3512e72bc915628f6453b29c014fc2283ba806e570aa3d8969567deae5b0599d239479651b20da2d038b636adb9288d6fb8589e7c8ca05ca50fe53d544c1c
6
+ metadata.gz: 9175bbe8b45d1bdaa68cf8c0ab6da64ea8a533e673f17ff13e2a39d9a65d227f16342f2271ff90e86233c41d712ca23d6e6c7d13b079108ec21996b40f48777a
7
+ data.tar.gz: 492027346fe8ecdf96dfa545d2330912f94a48d11dfb70f809102294ccd4bf7fda1cc987fd71438ff90ee4b6f5cd6bd952f192936711823704a5bd957bb022e9
data/Gemfile.lock CHANGED
@@ -44,7 +44,7 @@ GIT
44
44
  PATH
45
45
  remote: .
46
46
  specs:
47
- bixby-provision (0.1.2)
47
+ bixby-provision (0.1.3)
48
48
  api-auth
49
49
  bixby-client
50
50
  git (~> 1.2.6)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bixby-provision 0.1.2 ruby lib
5
+ # stub: bixby-provision 0.1.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bixby-provision"
9
- s.version = "0.1.2"
9
+ s.version = "0.1.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Chetan Sarva"]
14
- s.date = "2014-05-02"
14
+ s.date = "2014-05-03"
15
15
  s.description = "Bixby Provisioner"
16
16
  s.email = "chetan@pixelcop.net"
17
17
  s.executables = ["bixby-provision"]
@@ -52,7 +52,7 @@ end
52
52
  require "bixby/provision/manifest"
53
53
  require "bixby/provision/dsl"
54
54
 
55
- Bixby::Log.setup_logger(:filename => Bixby.path("var", "provision.log"))
55
+ Bixby::Log.setup_logger(:level => :info, :filename => Bixby.path("var", "provision.log"))
56
56
 
57
57
  # enable condensed logging to stdout
58
58
  Logging.appenders.stdout( 'provision_stdout',
@@ -1,4 +1,6 @@
1
1
 
2
+ require "tempfile"
3
+
2
4
  module Bixby
3
5
  module Provision
4
6
 
@@ -1,4 +1,6 @@
1
1
 
2
+ require "tempfile"
3
+
2
4
  require "bixby/provision/dsl/util/file"
3
5
 
4
6
  module Bixby
@@ -70,6 +72,17 @@ module Bixby
70
72
  nil
71
73
  end
72
74
 
75
+ # Create a temporary file
76
+ #
77
+ # @param [Boolean] close If true, close the file handle before returning it (default: false)
78
+ #
79
+ # @return [Tempfile]
80
+ def tempfile(close=false)
81
+ t = Tempfile.new("bixby-provision-")
82
+ t.close if close
83
+ t
84
+ end
85
+
73
86
  end
74
87
 
75
88
  end
@@ -76,18 +76,20 @@ module Bixby
76
76
  def install_repo_url(url, opts)
77
77
  logger.info "installing repo from #{url}"
78
78
 
79
- if File.exists? File.join(YUM_REPOS_D, File.basename(url)) then
79
+ dest = File.join(YUM_REPOS_D, File.basename(url))
80
+ if File.exists? dest then
80
81
  logger.debug "repo already exists"
81
82
  return false
82
83
  end
83
84
 
84
85
  self.proxy.sys.package "wget"
85
86
 
86
- if systemu("wget -q #{url}", :cwd => YUM_REPOS_D).fail? then
87
+ t = tempfile(true)
88
+ if logged_systemu("wget -q #{url} -O #{t.path}").fail? then
87
89
  # TODO raise
88
90
  end
89
91
 
90
- true
92
+ logged_sudo("mv -f #{t.path} #{dest}").success?
91
93
  end
92
94
 
93
95
  end # Yum
@@ -20,17 +20,16 @@ module Bixby
20
20
 
21
21
  arch = amd64?() ? "x86_64" : "i686"
22
22
 
23
- File.open(file, 'w') do |f|
24
- f.puts <<-EOF
23
+ t = tempfile()
24
+ t.puts <<-EOF
25
25
  [mongodb]
26
26
  name=MongoDB Repository
27
27
  baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/#{arch}/
28
28
  gpgcheck=0
29
29
  enabled=1
30
30
  EOF
31
- end
32
-
33
- true
31
+ t.close
32
+ logged_sudo("mv -f #{t.path} #{file}").success?
34
33
  end
35
34
 
36
35
  end # MongoDB
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bixby-provision
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chetan Sarva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2014-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bixby-client