linux_admin 0.10.0 → 0.10.1

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: a394c521ca1d4abc8e16ce37240252106402c390
4
- data.tar.gz: ce03d9f917269c2347367a750760f3036d645ed9
3
+ metadata.gz: 416f57382aba9378eb64a0b558478898d1d40e2f
4
+ data.tar.gz: d4c70351176347b76844638bae4cc6c49dbad3b2
5
5
  SHA512:
6
- metadata.gz: bc7f7c51781a7c7c22bdd5a385ef012d0ba85080a693cc7795c666bd03f8343a134a4912018e08370f8641368cc1c69a780c2e3208ab3f05bee58d0c70f65d69
7
- data.tar.gz: 0023ba36073fcb308609cf042612592145dcf5be54e6725e4cc42a6c9e16125ebc5b6aa864577d7c5f4a1033c980be7a7aff3bb9005ef014aef23f96ce2a1aa8
6
+ metadata.gz: e3f345b3999366943ae185ce3a93a57664142b0213a37490fbeff23d650712fc28c29f64b761deba2eb3652548e461459773e6bfedb1ea393d049a595a15a5c9
7
+ data.tar.gz: 97b4f388757fce7f406a4a5e3671aa034b347384c37958e3c22e9e307aa4cb649143079640fff88b5b0989819c085696b9a6c79ba6653d4a309909baf6c9fc28
data/lib/linux_admin.rb CHANGED
@@ -2,6 +2,8 @@ require 'more_core_extensions/all'
2
2
  require 'active_support'
3
3
  require 'active_support/core_ext'
4
4
 
5
+ require 'linux_admin/logging'
6
+ require 'linux_admin/null_logger'
5
7
 
6
8
  require 'linux_admin/common'
7
9
  require 'linux_admin/exceptions'
@@ -28,5 +30,11 @@ require 'linux_admin/volume_group'
28
30
 
29
31
  module LinuxAdmin
30
32
  extend Common
31
- include Common
33
+ extend self
34
+
35
+ attr_writer :logger
36
+
37
+ def logger
38
+ @logger ||= NullLogger.new
39
+ end
32
40
  end
@@ -7,10 +7,12 @@ module LinuxAdmin
7
7
  end
8
8
 
9
9
  def run(cmd, options = {})
10
+ AwesomeSpawn.logger ||= logger
10
11
  AwesomeSpawn.run(cmd, options)
11
12
  end
12
13
 
13
14
  def run!(cmd, options = {})
15
+ AwesomeSpawn.logger ||= logger
14
16
  AwesomeSpawn.run!(cmd, options)
15
17
  end
16
18
  end
@@ -0,0 +1,5 @@
1
+ module LinuxAdmin
2
+ module Logging
3
+ delegate :logger, :to => :LinuxAdmin
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'logger'
2
+
3
+ module LinuxAdmin
4
+ class NullLogger < Logger
5
+ def initialize(*_args)
6
+ end
7
+
8
+ def add(*_args, &_block)
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,7 @@
1
1
  module LinuxAdmin
2
2
  class RegistrationSystem
3
3
  include Common
4
+ include Logging
4
5
 
5
6
  def self.registration_type(reload = false)
6
7
  return @registration_type if @registration_type && !reload
@@ -44,6 +44,7 @@ module LinuxAdmin
44
44
  cmd = "rhn-channel -a"
45
45
  params = user_pwd(options).merge("--channel=" => repo)
46
46
 
47
+ logger.info("#{self.class.name}##{__method__} Enabling channel: #{repo}")
47
48
  run!(cmd, :params => params)
48
49
  end
49
50
  alias_method :subscribe, :enable_channel
@@ -83,6 +83,7 @@ module LinuxAdmin
83
83
  cmd = "subscription-manager repos"
84
84
  params = {"--enable=" => repo}
85
85
 
86
+ logger.info("#{self.class.name}##{__method__} Enabling repository: #{repo}")
86
87
  run!(cmd, :params => params)
87
88
  end
88
89
 
@@ -1,5 +1,7 @@
1
1
  module LinuxAdmin
2
2
  class Rpm < Package
3
+ extend Logging
4
+
3
5
  def self.rpm_cmd
4
6
  Distros.local.command(:rpm)
5
7
  end
@@ -16,8 +18,8 @@ module LinuxAdmin
16
18
  #
17
19
  # Rpm.import_key("/etc/pki/my-gpg-key")
18
20
  def self.import_key(file)
19
- params = {"--import" => file}
20
- run!("rpm", :params => params)
21
+ logger.info("#{self.class.name}##{__method__} Importing RPM-GPG-KEY: #{file}")
22
+ run!("rpm", :params => {"--import" => file})
21
23
  end
22
24
 
23
25
  def self.info(pkg)
@@ -1,3 +1,3 @@
1
1
  module LinuxAdmin
2
- VERSION = "0.10.0"
2
+ VERSION = "0.10.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linux_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dunne
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-02-20 00:00:00.000000000 Z
16
+ date: 2015-05-04 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -119,14 +119,14 @@ dependencies:
119
119
  requirements:
120
120
  - - ~>
121
121
  - !ruby/object:Gem::Version
122
- version: '1.2'
122
+ version: '1.3'
123
123
  type: :runtime
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - ~>
128
128
  - !ruby/object:Gem::Version
129
- version: '1.2'
129
+ version: '1.3'
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: nokogiri
132
132
  requirement: !ruby/object:Gem::Requirement
@@ -166,8 +166,10 @@ files:
166
166
  - lib/linux_admin/exceptions.rb
167
167
  - lib/linux_admin/fstab.rb
168
168
  - lib/linux_admin/hosts.rb
169
+ - lib/linux_admin/logging.rb
169
170
  - lib/linux_admin/logical_volume.rb
170
171
  - lib/linux_admin/mountable.rb
172
+ - lib/linux_admin/null_logger.rb
171
173
  - lib/linux_admin/package.rb
172
174
  - lib/linux_admin/partition.rb
173
175
  - lib/linux_admin/physical_volume.rb