cyoi 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDA0OTA5Y2IyMTc3MWYyZTg4NDcyN2M3NWQwN2M5MzU5MmZhMWRhZg==
4
+ MmEzZGE0MzhjNDVkOTZjOWIxYWNiOTFmZmYyZDQ3YjI2ZDIyMTA1Ng==
5
5
  data.tar.gz: !binary |-
6
- MjE4Yjc1OTU4MjcwMDMzMzU4YWE5YTYxMDQ0YTQxODBhZWY5MWI1NQ==
6
+ YjY0MWMxZTliYzA5YmQ0MWVjNjQ4ZTQ2ZGYzZTM2ZjhiMjBmZjBiYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWEyNDY1MTc4YTFjODcyMTgzZmRlNWFiYTBiYmExZGNjYmI0ZTM1OTgyOWY3
10
- MzYzZWY3NDk1NDVhMzA3NDBkNTJmMGE0MjM5MTZkN2QzYjMyODI2NjA2NmY1
11
- N2E1ZWYyODlmZDQwOWFkNTNmZTIyZjZhYWRiMjVmNmJmNGQzMWE=
9
+ NjdmZTdlZGIzZjlkZTIyNWUzOGFjNWQ0MzNkYjc4M2NhYjhhMGRiY2VjODQ2
10
+ NWQ2NjdlYjI4MzE3NDRmZGIxNzhmMGMyMjE2MDZiZDRjMjNlYjcwNTU5MDU1
11
+ MGIwZTgzY2MxNDRhY2ZjMDA5ZTE3NDk5ZGI1MTU4Y2Y2YTRmZWE=
12
12
  data.tar.gz: !binary |-
13
- MDczYzBhMTBjY2M2NWZhMzkxZTc1ZTM0OGIyNGY0M2E5YTVhMzBkYmZhMzQ3
14
- YmFkNjFhNmZlNzc3M2FmNjk2MmZlZDI3ZmE3ZWM2YjBiYmNiOTMxMjM3Nzcx
15
- NDI5MGNlYzc0MzFiZDVhMjYyNGVkZmIxYjM5M2RiMWQyNWEyZmU=
13
+ MWE0N2Q5MmVjYTE3ZDQ1OTNiY2RlMjNlZjllNGZjNWE3MmQ2NTViOTk5ZTFi
14
+ ZGQxNWU4YjU0YzlkNzAxNDY1YmQyMDRmZmMyNzEzOTM3MTU1YTNhZjdhNWVi
15
+ Nzc2ZWNmMTcyNTM0OTA2OGNkNTQ1MTFiODBhN2E2ZGNiZmJhYzQ=
data/ChangeLog.md CHANGED
@@ -5,6 +5,7 @@ Cyoi (choose-your-own-infrastructure) is a library to ask an end-user to choose
5
5
  ## v0.6
6
6
 
7
7
  * added `cyoi image` - AWS: public AMI for Ubuntu 13.04; OpenStack: choose an Image from menu
8
+ * openstack region doesn't repeatably prompt if set to nothing [v0.6.1]
8
9
 
9
10
  ## v0.5
10
11
 
@@ -64,15 +64,16 @@ class Cyoi::Cli::AutoDetection::AutoDetectionFog
64
64
  }
65
65
  end
66
66
  if profile[:openstack_username]
67
- fog_choices["OpenStack (#{profile_name})"] = {
67
+ choice = {
68
68
  "name" => "openstack",
69
69
  "provider" => "OpenStack",
70
70
  "openstack_username" => profile[:openstack_username],
71
71
  "openstack_api_key" => profile[:openstack_api_key],
72
72
  "openstack_tenant" => profile[:openstack_tenant],
73
73
  "openstack_auth_url" => profile[:openstack_auth_url],
74
- "openstack_region" => profile[:openstack_region]
75
74
  }
75
+ choice["openstack_region"] = profile[:openstack_region] if profile[:openstack_region]
76
+ fog_choices["OpenStack (#{profile_name})"] = choice
76
77
  end
77
78
  end
78
79
  fog_choices
@@ -9,7 +9,6 @@ class Cyoi::Cli::Providers::ProviderCliOpenStack < Cyoi::Cli::Providers::Provide
9
9
  end
10
10
 
11
11
  def setup_credentials
12
- puts "\n"
13
12
  attributes.set_default("credentials", {})
14
13
  credentials = attributes.credentials
15
14
  credentials["openstack_username"] = hl.ask("Username: ").to_s unless credentials.exists?("openstack_username")
@@ -17,7 +16,10 @@ class Cyoi::Cli::Providers::ProviderCliOpenStack < Cyoi::Cli::Providers::Provide
17
16
  credentials["openstack_tenant"] = hl.ask("Tenant: ").to_s unless credentials.exists?("openstack_tenant")
18
17
  credentials["openstack_auth_url"] = hl.ask("Authorization Token URL: ").to_s unless credentials.exists?("openstack_auth_url")
19
18
  credentials["openstack_auth_url"] = credentials["openstack_auth_url"] + "/tokens" unless credentials["openstack_auth_url"].match(/\/tokens$/)
20
- credentials["openstack_region"] = hl.ask("OpenStack Region (optional): ").to_s unless credentials.exists?("openstack_region")
19
+ unless credentials.has_key?("openstack_region")
20
+ credentials["openstack_region"] = hl.ask("OpenStack Region (optional): ").to_s.strip
21
+ end
22
+ attributes["credentials"] = credentials # need to reassign changed value
21
23
  end
22
24
 
23
25
  def valid_infrastructure?
@@ -30,7 +32,12 @@ class Cyoi::Cli::Providers::ProviderCliOpenStack < Cyoi::Cli::Providers::Provide
30
32
 
31
33
  def display_confirmation
32
34
  puts "\n"
33
- puts "Confirming: Using OpenStack"
35
+ region = attributes.credentials["openstack_region"]
36
+ if region.size > 0
37
+ puts "Confirming: Using OpenStack/#{region} (user: #{attributes.credentials.openstack_username})"
38
+ else
39
+ puts "Confirming: Using OpenStack (user: #{attributes.credentials.openstack_username})"
40
+ end
34
41
  end
35
42
  end
36
43
 
data/lib/cyoi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cyoi
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -12,7 +12,7 @@ describe "cyoi provider openstack" do
12
12
  setting "provider.credentials.openstack_auth_url", "TOKENURL"
13
13
  setting "provider.credentials.openstack_region", "REGION"
14
14
  run_interactive(unescape("cyoi provider #{settings_dir}"))
15
- assert_passing_with("Confirming: Using OpenStack")
15
+ assert_passing_with("Confirming: Using OpenStack/REGION (user: USERNAME)")
16
16
  end
17
17
 
18
18
  it "prompts for everything (no region)" do
@@ -29,9 +29,8 @@ describe "cyoi provider openstack" do
29
29
  2. OpenStack
30
30
  Choose your infrastructure:
31
31
  Using provider OpenStack
32
-
33
32
  Username: Password: Tenant: Authorization Token URL: OpenStack Region (optional):
34
- Confirming: Using OpenStack
33
+ Confirming: Using OpenStack (user: USERNAME)
35
34
  OUT
36
35
 
37
36
  reload_settings!
@@ -61,9 +60,8 @@ Confirming: Using OpenStack
61
60
  2. OpenStack
62
61
  Choose your infrastructure:
63
62
  Using provider OpenStack
64
-
65
63
  Username: Password: Tenant: Authorization Token URL: OpenStack Region (optional):
66
- Confirming: Using OpenStack
64
+ Confirming: Using OpenStack/REGION (user: USERNAME)
67
65
  OUT
68
66
  end
69
67
 
@@ -72,7 +70,7 @@ Confirming: Using OpenStack
72
70
  setup_fog_with_various_accounts_setup
73
71
  run_interactive(unescape("cyoi provider #{settings_dir}"))
74
72
  type("4")
75
- type("REGION")
73
+ type("")
76
74
  type("")
77
75
  assert_passing_with(<<-OUT)
78
76
  Auto-detected infrastructure API credentials at ~/.fog (override with $FOG)
@@ -83,9 +81,8 @@ Auto-detected infrastructure API credentials at ~/.fog (override with $FOG)
83
81
  5. Alternate credentials
84
82
  Choose an auto-detected infrastructure:
85
83
  Using provider OpenStack
86
-
87
84
  OpenStack Region (optional):
88
- Confirming: Using OpenStack
85
+ Confirming: Using OpenStack (user: USERNAME)
89
86
  OUT
90
87
  end
91
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyoi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-27 00:00:00.000000000 Z
11
+ date: 2013-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog