knife-voxel 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,18 +21,53 @@ class Chef
21
21
  :long => "--voxel-api-secret SECRET",
22
22
  :description => "Voxel hAPI Secret",
23
23
  :proc => Proc.new { |secret| Chef::Config[:knife][:voxel_api_secret] = secret }
24
+
25
+ option :voxel_api_username,
26
+ :long => "--voxel-api-username USERNAME",
27
+ :description => "Voxel hAPI Username",
28
+ :proc => Proc.new { |username| Chef::Config[:knife][:voxel_api_username] = username }
29
+
30
+ option :voxel_api_password,
31
+ :long => "--voxel-api-password PASSWORD",
32
+ :description => "Voxel hAPI Password",
33
+ :proc => Proc.new { |password| Chef::Config[:knife][:voxel_api_password] = password }
34
+
35
+
24
36
  end
25
37
  end
26
38
 
27
39
  def hapi
28
40
  @hapi ||= begin
29
- hapi = HAPI.new(
30
- :useauthkey => true,
31
- :username => Chef::Config[:knife][:voxel_api_key],
32
- :password => Chef::Config[:knife][:voxel_api_secret],
33
- :default_format => :ruby,
34
- :debug => false
35
- )
41
+ if Chef::Config[:knife].has_key?(:voxel_api_username)
42
+ unless Chef::Config[:knife].has_key?(:voxel_api_password)
43
+ ui.error( "--voxel-api-password is required when using --voxel-api-username" )
44
+ exit 1
45
+ end
46
+
47
+ hapi = HAPI.new(
48
+ :useauthkey => false,
49
+ :username => Chef::Config[:knife][:voxel_api_username],
50
+ :password => Chef::Config[:knife][:voxel_api_password],
51
+ :default_format => :ruby,
52
+ :debug => false
53
+ )
54
+ elsif Chef::Config[:knife].has_key?(:voxel_api_key)
55
+ unless Chef::Config[:knife].has_key?(:voxel_api_secret)
56
+ ui.error( "--voxel-api-secret is required when using --voxel-api-key" )
57
+ exit 1
58
+ end
59
+
60
+ hapi = HAPI.new(
61
+ :useauthkey => true,
62
+ :username => Chef::Config[:knife][:voxel_api_key],
63
+ :password => Chef::Config[:knife][:voxel_api_secret],
64
+ :default_format => :ruby,
65
+ :debug => false
66
+ )
67
+ else
68
+ ui.error( "--voxel-api-key or --voxel-api-username must be specified" )
69
+ exit 1
70
+ end
36
71
  end
37
72
  end
38
73
  end
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Voxel
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-voxel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-15 00:00:00.000000000Z
12
+ date: 2011-10-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: voxel-hapi
16
- requirement: &10910840 !ruby/object:Gem::Requirement
16
+ requirement: &19478320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.1.10
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10910840
24
+ version_requirements: *19478320
25
25
  description: Voxel hAPI Support for Chef's knife command
26
26
  email:
27
27
  - jwb@voxel.net