s3backup 0.6.6 → 0.6.7

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.
data/History.txt CHANGED
@@ -17,3 +17,8 @@
17
17
  * don't use raise,change exit and error log
18
18
  * config BUFESIZE to buffer_size
19
19
  * mod bug if directory name has '\'
20
+
21
+
22
+ === 0.6.7 2010-01-19
23
+ * default max_retry_count 6 to 10
24
+ * add config log_level
data/README.rdoc CHANGED
@@ -16,15 +16,18 @@ To use remotebackup,you should prepare backup configuretion file by yaml such be
16
16
  bucket: "bucket name"
17
17
  directories:
18
18
  - "absolute path to directory for backup/restore"
19
- - "absolute path to directory for backup/restore"
19
+ - "iterate directory as you like"
20
20
  access_key_id: 'Amazon access_key_id'
21
21
  secret_access_key: 'Amazon secret_access_key'
22
22
  password: 'password for aes. (optional)'
23
23
  salt: 'HexString(16 length) (must when password is specified) '
24
+ buffer_size: 'number of byte max 50000000000 (optional default 32000000)'
25
+ max_retry_count: 'number of retry of post if post failed.(optional default 10)'
24
26
  proxy_host: proxy host address if you use proxy.
25
27
  proxy_port: proxy port if you use proxy.
26
28
  proxy_user: login name for proxy server if you use proxy.
27
29
  proxy_password: login password for proxy server if you use proxy.
30
+ log_level: 'output log level. value is debug or info or warn or error(optional default info)'
28
31
  *If directories isn't specified when restore, it restores all directories in bucket.
29
32
 
30
33
  == COMMAND:
data/backup.yml CHANGED
@@ -1,8 +1,15 @@
1
- bucket: "bucket name"
1
+ bucket: "bucket name. it is necessary uniq of the world wide"
2
2
  directories:
3
3
  - "absolute path to directory for backup/restore"
4
- - "absolute path to directory for backup/restore"
4
+ - "iterate directory as you like"
5
5
  access_key_id: 'Amazon access_key_id'
6
6
  secret_access_key: 'Amazon secret_access_key'
7
- password: 'password for aes. (optional)'
7
+ password: 'password encrypt files for aes. (optional)'
8
8
  salt: 'HexString(16 length) (must when password is specified) '
9
+ buffer_size: 'number of byte max 50000000000 (optional default 32000000)'
10
+ max_retry_count: 'number of retry of post if post failed.(optional default 10)'
11
+ proxy_host: 'address of proxy server(optional)'
12
+ proxy_port: 'port of proxy server(optional)'
13
+ proxy_user: 'user name of proxy server(optional)'
14
+ proxy_password: 'password of proxy server(optional)'
15
+ log_level: 'output log level. value is debug or info or warn or error(optional default info)'
data/lib/s3backup.rb CHANGED
@@ -2,5 +2,5 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module S3backup
5
- VERSION = '0.6.6'
5
+ VERSION = '0.6.7'
6
6
  end
@@ -16,6 +16,14 @@ module S3backup
16
16
  @manager = Manager.new(@s3_obj,config)
17
17
  end
18
18
  def check_config(config)
19
+ if config["log_level"]
20
+ if config["log_level"] =~ /debug|info|warn|error/i
21
+ S3log.set_level(config["log_level"])
22
+ else
23
+ S3log.error("log_level:#{config['log_level']} is not debug or info or warn or error")
24
+ exit(-1)
25
+ end
26
+ end
19
27
  unless config["directories"]
20
28
  S3log.error("directories doesn't exist in config file.")
21
29
  exit(-1)
@@ -6,8 +6,25 @@ module S3backup
6
6
  def S3log.get_logger
7
7
  @@log_file ? @@log_file : Logger.new($stderr)
8
8
  end
9
+ def S3log.set_level(level)
10
+ unless @@debug
11
+ case level
12
+ when /debug/i
13
+ get_logger.level = Logger::DEBUG
14
+ when /info/i
15
+ get_logger.level = Logger::INFO
16
+ when /warn/i
17
+ get_logger.level = Logger::WARN
18
+ when /error/i
19
+ get_logger.level = Logger::ERROR
20
+ end
21
+ end
22
+ end
9
23
  def S3log.set_debug(flg)
10
24
  @@debug=flg
25
+ if @@debug
26
+ get_logger.level = Logger::DEBUG
27
+ end
11
28
  end
12
29
  def S3log.error(str)
13
30
  get_logger.error(str)
@@ -19,9 +36,7 @@ module S3backup
19
36
  get_logger.warn(str)
20
37
  end
21
38
  def S3log.debug(str)
22
- if @@debug
23
- get_logger.debug(str)
24
- end
39
+ get_logger.debug(str)
25
40
  end
26
41
  def S3log.set_logfile(f)
27
42
  @@log_file = Logger.new(f)
@@ -3,7 +3,7 @@ require 'aws/s3'
3
3
  module S3backup
4
4
  class S3Wrapper
5
5
  attr_reader :bucket
6
- DEFAULT_MAX_RETRY_COUNT = 6
6
+ DEFAULT_MAX_RETRY_COUNT = 10
7
7
  def initialize(config,create_flg)
8
8
  @bucket= nil
9
9
  @s3objects =nil
@@ -64,9 +64,8 @@ module S3backup
64
64
  break;
65
65
  rescue => ex
66
66
  count+=1;
67
- S3log.debug("post #{count} times failed. #{key_name}\n")
67
+ S3log.info("post #{count} times failed. #{key_name}\n")
68
68
  if count >= @max_retry_count
69
- raise ex
70
69
  S3log.error("post #{count} times failed #{key_name} #{ex.class}:#{ex.message}\n")
71
70
  exit(-1)
72
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi Morita