knife-ec-backup 1.1.0 → 1.1.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: bfb061efc0e39818119aa5e0d6d2fc1b4e30c67f
4
- data.tar.gz: a7bd9fc29f6f2bfbe5d3f880bdc6fc6b1eb5fbcb
3
+ metadata.gz: 76b450dcd76db4d13569e2a0bb2698f33903f0bb
4
+ data.tar.gz: 70a79178d91d74240cd2db487e4ba0e6a0d1ca24
5
5
  SHA512:
6
- metadata.gz: 4675c0ab2bcb626aa2b5203c0ebfaab596d430b882ea086f0fb82c41e5f29e4e4f833b7c34b3e98b60638c85f56e3a4ee135b603e5b50f54e12b083eddb47b4e
7
- data.tar.gz: 720765653920c29a05ab32a522a2e0796292af9dfe26fcbe55d6d1573054a43d4943d192a93c765668852a7072785f4bbbd2ad8c2bc6fa7a2677793e52a4d9aa
6
+ metadata.gz: da50a45648d1e64559b71aefad81a9e9b2097c2a8673c46346546ea03ca89753c9f1c2cfa81ee1e18cb9ac023d241d36dc9cda3c413d751be51e61359ff523b9
7
+ data.tar.gz: db4a3f1de0962d1dd30eabb0bf441c49073f796d6f5af7499161cf8dfc94cf7daa6faabe0df33a4b03d872bcd1bad7dbca44ec4797da83f8001d69a718ead63b
data/README.md CHANGED
@@ -12,11 +12,17 @@ This knife plugin currently requires the Knife-Essentials gem to be installed in
12
12
 
13
13
  # Installation
14
14
 
15
- This knife plugin is packaged as a gem. To install it, clone the
16
- git repository and run the following:
15
+ ## Chef Server Install (Recommended)
16
+ This will install the plugin directly on the Chef Server:
17
+
18
+ /opt/opscode/embedded/bin/gem install knife-ec-backup
19
+ /opt/opscode/embedded/bin/gem install knife-ec-backup
20
+
21
+ ## Build from source
22
+ Clone the git repository and run the following from inside:
17
23
 
18
24
  gem build knife-ec-backup.gemspec
19
- gem install knife-ec-backup-1.0.0.gem
25
+ gem install knife-ec-backup-1.1.1.gem
20
26
 
21
27
  # Configuration
22
28
 
@@ -37,6 +43,8 @@ It is recommended that you run this from a frontend Enterprise Chef Server, you
37
43
  Used to set the path to the WebUI Key (default: /etc/opscode/webui_priv.pem)
38
44
  * `--skip-useracl`:
39
45
  Whether to skip downloading User ACLs. This is required for EC 11.0.0 and lower (default: false)
46
+ * `--skip-version-check'`:
47
+ Whether to skip checking the Chef Server version. This will also skip any auto-configured options (default: false)
40
48
 
41
49
  Creates a repository of an entire Enterprise Chef / Private Chef server.
42
50
 
@@ -102,6 +110,8 @@ This compares very closely with the "knife download /" from an OSC server:
102
110
  Whether to overwrite pivotal's key. Once this is done, future requests will fail until you fix the private key (default: false)
103
111
  * `--skip-useracl`:
104
112
  Whether to skip downloading User ACLs. This is required for EC 11.0.0 and lower (default: false)
113
+ * `--skip-version-check'`:
114
+ Whether to skip checking the Chef Server version. This will also skip any auto-configured options (default: false)
105
115
 
106
116
  Restores all data from a repository to an Enterprise Chef / Private Chef server.
107
117
 
@@ -19,6 +19,12 @@ class Chef
19
19
  :default => false,
20
20
  :description => "Whether to skip downloading User ACLs. This is required for EC 11.0.0 and lower"
21
21
 
22
+ option :skip_version,
23
+ :long => '--skip-version-check',
24
+ :boolean => true,
25
+ :default => false,
26
+ :description => "Whether to skip checking the Chef Server version. This will also skip any auto-configured options"
27
+
22
28
  deps do
23
29
  require 'chef_fs/config'
24
30
  require 'chef_fs/file_system'
@@ -74,33 +80,38 @@ class Chef
74
80
  end
75
81
 
76
82
  rest = Chef::REST.new(Chef::Config.chef_server_root)
77
- user_acl_rest = Chef::REST.new("http://127.0.0.1:9465")
78
-
79
- # Grab Chef Server version number so that we can auto set options
80
- uri = URI.parse("#{Chef::Config.chef_server_root}/version")
81
- version_manifest = open(uri, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE})
82
- server_version = version_manifest.grep(/private-chef /).first.split(' ').last
83
-
84
- server_version_parts = server_version.split('.')
85
-
86
- if server_version_parts.count == 3
87
- puts "Detected Enterprise Chef Server version: #{server_version}"
88
-
89
- # All versions of Chef Server below 11.0.1 are missing the GET User ACL helper in nginx
90
- if server_version_parts[0] < 11 || (server_version_parts[0] == 11 && server_version_parts[1] == 0 && server_version_parts[0] < 1)
91
- #Check to see if Opscode-Account can be directly from the local machine
92
- begin
93
- user_acl_rest.get('users')
94
- ui.warn("Your version of Enterprise Chef Server does not support the downloading of User ACLs. Using local connection to backup")
95
- rescue
96
- ui.warn("Your version of Enterprise Chef Server does not support the downloading of User ACLs. Setting skip-useracl to TRUE")
97
- config[:skip_useracl] = true
98
- user_acl_rest = nil
83
+
84
+ if config[:skip_version] && config[:skip_useracl]
85
+ ui.warn("Skipping the Chef Server version check. This will also skip any auto-configured options")
86
+ user_acl_rest = nil
87
+ elsif config[:skip_version] && !config[:skip_useracl]
88
+ ui.warn("Skipping the Chef Server version check. This will also skip any auto-configured options")
89
+ user_acl_rest = rest
90
+ else # Grab Chef Server version number so that we can auto set options
91
+ uri = URI.parse("#{Chef::Config.chef_server_root}/version")
92
+ server_version = open(uri, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).each_line.first.split(' ').last
93
+ server_version_parts = server_version.split('.')
94
+
95
+ if server_version_parts.count == 3
96
+ puts "Detected Enterprise Chef Server version: #{server_version}"
97
+
98
+ # All versions of Chef Server below 11.0.1 are missing the GET User ACL helper in nginx
99
+ if server_version_parts[0] < 11 || (server_version_parts[0] == 11 && server_version_parts[1] == 0 && server_version_parts[0] < 1)
100
+ #Check to see if Opscode-Account can be directly from the local machine
101
+ begin
102
+ user_acl_rest.get('users')
103
+ ui.warn("Your version of Enterprise Chef Server does not support the downloading of User ACLs. Using local connection to backup")
104
+ user_acl_rest = Chef::REST.new("http://127.0.0.1:9465")
105
+ rescue
106
+ ui.warn("Your version of Enterprise Chef Server does not support the downloading of User ACLs. Setting skip-useracl to TRUE")
107
+ config[:skip_useracl] = true
108
+ user_acl_rest = nil
109
+ end
99
110
  end
100
- end
101
111
 
102
- else
103
- ui.warn("Unable to detect Chef Server version.")
112
+ else
113
+ ui.warn("Unable to detect Chef Server version.")
114
+ end
104
115
  end
105
116
 
106
117
  # Grab users
@@ -25,6 +25,11 @@ class Chef
25
25
  :default => false,
26
26
  :description => "Whether to skip restoring User ACLs. This is required for EC 11.0.2 and lower"
27
27
 
28
+ option :skip_version,
29
+ :long => '--skip-version-check',
30
+ :boolean => true,
31
+ :default => false,
32
+ :description => "Whether to skip checking the Chef Server version. This will also skip any auto-configured options"
28
33
 
29
34
  deps do
30
35
  require 'chef/json_compat'
@@ -83,23 +88,28 @@ class Chef
83
88
  Chef::Config.chef_server_root = server_root
84
89
  end
85
90
 
86
- # Grab Chef Server version number so that we can auto set options
87
- uri = URI.parse("#{Chef::Config.chef_server_root}/version")
88
- version_manifest = open(uri, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE})
89
- server_version = version_manifest.grep(/private-chef /).first.split(' ').last
90
-
91
- server_version_parts = server_version.split('.')
92
-
93
- if server_version_parts.count == 3
94
- puts "Detected Enterprise Chef Server version: #{server_version}"
95
-
96
- # All versions of Chef Server below 11.0.X are unable to update user acls
97
- if server_version_parts[0] < 11 || (server_version_parts[0] == 11 && server_version_parts[1] == 0)
98
- ui.warn("Your version of Enterprise Chef Server does not support the updating of User ACLs. Setting skip-useracl to TRUE")
99
- config[:skip_useracl] = true
91
+ if config[:skip_version] && config[:skip_useracl]
92
+ ui.warn("Skipping the Chef Server version check. This will also skip any auto-configured options")
93
+ user_acl_rest = nil
94
+ elsif config[:skip_version] && !config[:skip_useracl]
95
+ ui.warn("Skipping the Chef Server version check. This will also skip any auto-configured options")
96
+ user_acl_rest = rest
97
+ else # Grab Chef Server version number so that we can auto set options
98
+ uri = URI.parse("#{Chef::Config.chef_server_root}/version")
99
+ server_version = open(uri, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).each_line.first.split(' ').last
100
+ server_version_parts = server_version.split('.')
101
+
102
+ if server_version_parts.count == 3
103
+ puts "Detected Enterprise Chef Server version: #{server_version}"
104
+
105
+ # All versions of Chef Server below 11.0.X are unable to update user acls
106
+ if server_version_parts[0] < 11 || (server_version_parts[0] == 11 && server_version_parts[1] == 0)
107
+ ui.warn("Your version of Enterprise Chef Server does not support the updating of User ACLs. Setting skip-useracl to TRUE")
108
+ config[:skip_useracl] = true
109
+ end
110
+ else
111
+ ui.warn("Unable to detect Chef Server version.")
100
112
  end
101
- else
102
- ui.warn("Unable to detect Chef Server version.")
103
113
  end
104
114
 
105
115
  # Restore users
@@ -1,3 +1,3 @@
1
1
  module KnifeECBackup
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-ec-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser