fog-openstack 0.1.7 → 0.1.8
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.
- checksums.yaml +4 -4
- data/README.md +12 -28
- data/docs/workflow.md +129 -0
- data/examples/workflow/workflow-examples.rb +387 -0
- data/gemfiles/Gemfile-1.9 +1 -0
- data/lib/fog/openstack.rb +5 -1
- data/lib/fog/openstack/baremetal.rb +14 -38
- data/lib/fog/openstack/compute.rb +4 -33
- data/lib/fog/openstack/core.rb +104 -50
- data/lib/fog/openstack/identity.rb +2 -1
- data/lib/fog/openstack/identity_v2.rb +0 -2
- data/lib/fog/openstack/identity_v3.rb +0 -2
- data/lib/fog/openstack/image_v1.rb +6 -6
- data/lib/fog/openstack/image_v2.rb +7 -6
- data/lib/fog/openstack/introspection.rb +10 -35
- data/lib/fog/openstack/metering.rb +16 -35
- data/lib/fog/openstack/monitoring.rb +5 -31
- data/lib/fog/openstack/network.rb +5 -34
- data/lib/fog/openstack/nfv.rb +10 -35
- data/lib/fog/openstack/orchestration.rb +5 -40
- data/lib/fog/openstack/planning.rb +11 -36
- data/lib/fog/openstack/requests/compute/get_limits.rb +8 -7
- data/lib/fog/openstack/requests/network/update_router.rb +1 -1
- data/lib/fog/openstack/requests/workflow_v2/create_action.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/create_action_execution.rb +31 -0
- data/lib/fog/openstack/requests/workflow_v2/create_cron_trigger.rb +55 -0
- data/lib/fog/openstack/requests/workflow_v2/create_environment.rb +31 -0
- data/lib/fog/openstack/requests/workflow_v2/create_execution.rb +30 -0
- data/lib/fog/openstack/requests/workflow_v2/create_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/create_workflow.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_action.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_action_execution.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_cron_trigger.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_environment.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_execution.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_workbook.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/delete_workflow.rb +25 -0
- data/lib/fog/openstack/requests/workflow_v2/get_action.rb +27 -0
- data/lib/fog/openstack/requests/workflow_v2/get_action_execution.rb +26 -0
- data/lib/fog/openstack/requests/workflow_v2/get_cron_trigger.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/get_environment.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/get_execution.rb +26 -0
- data/lib/fog/openstack/requests/workflow_v2/get_task.rb +27 -0
- data/lib/fog/openstack/requests/workflow_v2/get_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/get_workflow.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_action_executions.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_actions.rb +30 -0
- data/lib/fog/openstack/requests/workflow_v2/list_cron_triggers.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_environments.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_executions.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_services.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_tasks.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_workbooks.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/list_workflows.rb +30 -0
- data/lib/fog/openstack/requests/workflow_v2/rerun_task.rb +33 -0
- data/lib/fog/openstack/requests/workflow_v2/update_action.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/update_action_execution.rb +33 -0
- data/lib/fog/openstack/requests/workflow_v2/update_environment.rb +31 -0
- data/lib/fog/openstack/requests/workflow_v2/update_execution.rb +33 -0
- data/lib/fog/openstack/requests/workflow_v2/update_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/update_workflow.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/validate_action.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/validate_workbook.rb +28 -0
- data/lib/fog/openstack/requests/workflow_v2/validate_workflow.rb +28 -0
- data/lib/fog/openstack/storage.rb +4 -35
- data/lib/fog/openstack/version.rb +1 -1
- data/lib/fog/openstack/volume_v1.rb +7 -5
- data/lib/fog/openstack/volume_v2.rb +7 -5
- data/lib/fog/openstack/workflow.rb +12 -0
- data/lib/fog/openstack/workflow_v2.rb +160 -0
- metadata +48 -95
- data/lib/fog/openstack/common.rb +0 -44
- data/tests/openstack/models/compute/images_tests.rb +0 -13
- data/tests/openstack/models/compute/security_group_tests.rb +0 -54
- data/tests/openstack/models/compute/server_tests.rb +0 -220
- data/tests/openstack/models/compute/service_tests.rb +0 -17
- data/tests/openstack/models/image/image_tests.rb +0 -36
- data/tests/openstack/models/image/images_tests.rb +0 -19
- data/tests/openstack/models/network/floating_ip_tests.rb +0 -35
- data/tests/openstack/models/network/floating_ips_tests.rb +0 -19
- data/tests/openstack/models/network/ike_policies_tests.rb +0 -28
- data/tests/openstack/models/network/ike_policy_tests.rb +0 -36
- data/tests/openstack/models/network/ipsec_policies_tests.rb +0 -26
- data/tests/openstack/models/network/ipsec_policy_tests.rb +0 -36
- data/tests/openstack/models/network/ipsec_site_connection_tests.rb +0 -50
- data/tests/openstack/models/network/ipsec_site_connections_tests.rb +0 -32
- data/tests/openstack/models/network/lb_health_monitor_tests.rb +0 -52
- data/tests/openstack/models/network/lb_health_monitors_tests.rb +0 -21
- data/tests/openstack/models/network/lb_member_tests.rb +0 -28
- data/tests/openstack/models/network/lb_members_tests.rb +0 -21
- data/tests/openstack/models/network/lb_pool_tests.rb +0 -53
- data/tests/openstack/models/network/lb_pools_tests.rb +0 -20
- data/tests/openstack/models/network/lb_vip_tests.rb +0 -39
- data/tests/openstack/models/network/lb_vips_tests.rb +0 -21
- data/tests/openstack/models/network/network_tests.rb +0 -61
- data/tests/openstack/models/network/networks_tests.rb +0 -21
- data/tests/openstack/models/network/port_tests.rb +0 -28
- data/tests/openstack/models/network/ports_tests.rb +0 -25
- data/tests/openstack/models/network/router_tests.rb +0 -39
- data/tests/openstack/models/network/routers_tests.rb +0 -21
- data/tests/openstack/models/network/security_group_rule_tests.rb +0 -27
- data/tests/openstack/models/network/security_group_rules_tests.rb +0 -25
- data/tests/openstack/models/network/security_group_tests.rb +0 -17
- data/tests/openstack/models/network/security_groups_tests.rb +0 -16
- data/tests/openstack/models/network/subnet_tests.rb +0 -30
- data/tests/openstack/models/network/subnets_tests.rb +0 -27
- data/tests/openstack/models/network/vpn_service_tests.rb +0 -27
- data/tests/openstack/models/network/vpn_services_tests.rb +0 -22
- data/tests/openstack/models/nfv/vnf_tests.rb +0 -35
- data/tests/openstack/models/nfv/vnfd_tests.rb +0 -23
- data/tests/openstack/models/nfv/vnfds_tests.rb +0 -31
- data/tests/openstack/models/nfv/vnfs_tests.rb +0 -38
- data/tests/openstack/models/planning/.gitkeep +0 -0
- data/tests/openstack/models/planning/plan_tests.rb +0 -51
- data/tests/openstack/models/planning/plans_tests.rb +0 -18
- data/tests/openstack/models/planning/role_tests.rb +0 -14
- data/tests/openstack/models/storage/file_tests.rb +0 -251
- data/tests/openstack/requests/compute/address_tests.rb +0 -58
- data/tests/openstack/requests/compute/aggregate_tests.rb +0 -59
- data/tests/openstack/requests/compute/availability_zone_tests.rb +0 -18
- data/tests/openstack/requests/compute/flavor_tests.rb +0 -95
- data/tests/openstack/requests/compute/helper.rb +0 -41
- data/tests/openstack/requests/compute/image_tests.rb +0 -58
- data/tests/openstack/requests/compute/keypair_tests.rb +0 -30
- data/tests/openstack/requests/compute/limit_tests.rb +0 -59
- data/tests/openstack/requests/compute/quota_tests.rb +0 -60
- data/tests/openstack/requests/compute/security_group_tests.rb +0 -61
- data/tests/openstack/requests/compute/server_tests.rb +0 -289
- data/tests/openstack/requests/compute/service_tests.rb +0 -33
- data/tests/openstack/requests/compute/tenant_tests.rb +0 -19
- data/tests/openstack/requests/compute/volume_tests.rb +0 -38
- data/tests/openstack/requests/image/image_tests.rb +0 -135
- data/tests/openstack/requests/metering/event_tests.rb +0 -17
- data/tests/openstack/requests/metering/meter_tests.rb +0 -52
- data/tests/openstack/requests/metering/resource_tests.rb +0 -19
- data/tests/openstack/requests/network/ike_policy_tests.rb +0 -65
- data/tests/openstack/requests/network/ipsec_policy_tests.rb +0 -65
- data/tests/openstack/requests/network/ipsec_site_connection_tests.rb +0 -82
- data/tests/openstack/requests/network/lb_health_monitor_tests.rb +0 -93
- data/tests/openstack/requests/network/lb_member_tests.rb +0 -60
- data/tests/openstack/requests/network/lb_pool_tests.rb +0 -80
- data/tests/openstack/requests/network/lb_vip_tests.rb +0 -71
- data/tests/openstack/requests/network/network_tests.rb +0 -107
- data/tests/openstack/requests/network/port_tests.rb +0 -66
- data/tests/openstack/requests/network/quota_tests.rb +0 -65
- data/tests/openstack/requests/network/router_tests.rb +0 -73
- data/tests/openstack/requests/network/security_group_rule_tests.rb +0 -58
- data/tests/openstack/requests/network/security_group_tests.rb +0 -43
- data/tests/openstack/requests/network/subnet_tests.rb +0 -66
- data/tests/openstack/requests/network/vpn_service_tests.rb +0 -61
- data/tests/openstack/requests/nfv/vnf_tests.rb +0 -70
- data/tests/openstack/requests/nfv/vnfd_tests.rb +0 -44
- data/tests/openstack/requests/orchestration/stack_tests.rb +0 -64
- data/tests/openstack/requests/planning/.gitkeep +0 -0
- data/tests/openstack/requests/planning/plan_tests.rb +0 -65
- data/tests/openstack/requests/planning/role_tests.rb +0 -16
- data/tests/openstack/requests/storage/container_tests.rb +0 -64
- data/tests/openstack/requests/storage/large_object_tests.rb +0 -372
- data/tests/openstack/requests/storage/object_tests.rb +0 -208
- data/tests/openstack/requests/volume/availability_zone_tests.rb +0 -13
- data/tests/openstack/requests/volume/quota_tests.rb +0 -50
- data/tests/openstack/requests/volume/volume_type_tests.rb +0 -32
|
@@ -73,6 +73,10 @@ module Fog
|
|
|
73
73
|
class Real
|
|
74
74
|
include Fog::OpenStack::Core
|
|
75
75
|
|
|
76
|
+
def self.not_found_class
|
|
77
|
+
Fog::Introspection::OpenStack::NotFound
|
|
78
|
+
end
|
|
79
|
+
|
|
76
80
|
def initialize(options = {})
|
|
77
81
|
initialize_identity options
|
|
78
82
|
|
|
@@ -82,7 +86,13 @@ module Fog
|
|
|
82
86
|
@connection_options = options[:connection_options] || {}
|
|
83
87
|
|
|
84
88
|
authenticate
|
|
89
|
+
set_api_path
|
|
85
90
|
|
|
91
|
+
@persistent = options[:persistent] || false
|
|
92
|
+
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def set_api_path
|
|
86
96
|
unless @path.match(SUPPORTED_VERSIONS)
|
|
87
97
|
@path = "/" + Fog::OpenStack.get_supported_version(
|
|
88
98
|
SUPPORTED_VERSIONS,
|
|
@@ -91,41 +101,6 @@ module Fog
|
|
|
91
101
|
@connection_options
|
|
92
102
|
)
|
|
93
103
|
end
|
|
94
|
-
|
|
95
|
-
@persistent = options[:persistent] || false
|
|
96
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def request(params)
|
|
100
|
-
response = @connection.request(
|
|
101
|
-
params.merge(
|
|
102
|
-
:headers => {
|
|
103
|
-
'Content-Type' => 'application/json',
|
|
104
|
-
'X-Auth-Token' => @auth_token
|
|
105
|
-
}.merge!(params[:headers] || {}),
|
|
106
|
-
:path => "#{@path}/#{params[:path]}"
|
|
107
|
-
)
|
|
108
|
-
)
|
|
109
|
-
rescue Excon::Errors::Unauthorized => error
|
|
110
|
-
if error.response.body != "Bad username or password" # token expiration
|
|
111
|
-
@openstack_must_reauthenticate = true
|
|
112
|
-
authenticate
|
|
113
|
-
retry
|
|
114
|
-
else # bad credentials
|
|
115
|
-
raise error
|
|
116
|
-
end
|
|
117
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
118
|
-
raise case error
|
|
119
|
-
when Excon::Errors::NotFound
|
|
120
|
-
Fog::Introspection::OpenStack::NotFound.slurp(error)
|
|
121
|
-
else
|
|
122
|
-
error
|
|
123
|
-
end
|
|
124
|
-
else
|
|
125
|
-
unless response.body.empty?
|
|
126
|
-
response.body = Fog::JSON.decode(response.body)
|
|
127
|
-
end
|
|
128
|
-
response
|
|
129
104
|
end
|
|
130
105
|
end
|
|
131
106
|
end
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
module Fog
|
|
4
4
|
module Metering
|
|
5
5
|
class OpenStack < Fog::Service
|
|
6
|
+
SUPPORTED_VERSIONS = /v2/
|
|
7
|
+
|
|
6
8
|
requires :openstack_auth_url
|
|
7
9
|
recognizes :openstack_auth_token, :openstack_management_url,
|
|
8
10
|
:persistent, :openstack_service_type, :openstack_service_name,
|
|
@@ -93,7 +95,11 @@ module Fog
|
|
|
93
95
|
class Real
|
|
94
96
|
include Fog::OpenStack::Core
|
|
95
97
|
|
|
96
|
-
def
|
|
98
|
+
def self.not_found_class
|
|
99
|
+
Fog::Metering::OpenStack::NotFound
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def initialize(options = {})
|
|
97
103
|
initialize_identity options
|
|
98
104
|
|
|
99
105
|
@openstack_service_type = options[:openstack_service_type] || ['metering']
|
|
@@ -103,47 +109,22 @@ module Fog
|
|
|
103
109
|
@connection_options = options[:connection_options] || {}
|
|
104
110
|
|
|
105
111
|
authenticate
|
|
112
|
+
set_api_path
|
|
106
113
|
|
|
107
114
|
@persistent = options[:persistent] || false
|
|
108
115
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
109
116
|
end
|
|
110
117
|
|
|
111
|
-
def
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
:path => "#{@path}/v2/#{params[:path]}"#,
|
|
120
|
-
# Causes errors for some requests like tenants?limit=1
|
|
121
|
-
# :query => ('ignore_awful_caching' << Time.now.to_i.to_s)
|
|
122
|
-
}))
|
|
123
|
-
rescue Excon::Errors::Unauthorized => error
|
|
124
|
-
if error.response.body != 'Bad username or password' # token expiration
|
|
125
|
-
@openstack_must_reauthenticate = true
|
|
126
|
-
authenticate
|
|
127
|
-
retry
|
|
128
|
-
else # bad credentials
|
|
129
|
-
raise error
|
|
130
|
-
end
|
|
131
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
132
|
-
raise case error
|
|
133
|
-
when Excon::Errors::NotFound
|
|
134
|
-
Fog::Metering::OpenStack::NotFound.slurp(error)
|
|
135
|
-
else
|
|
136
|
-
error
|
|
137
|
-
end
|
|
118
|
+
def set_api_path
|
|
119
|
+
unless @path.match(SUPPORTED_VERSIONS)
|
|
120
|
+
@path = "/" + Fog::OpenStack.get_supported_version(
|
|
121
|
+
SUPPORTED_VERSIONS,
|
|
122
|
+
@openstack_management_uri,
|
|
123
|
+
@auth_token,
|
|
124
|
+
@connection_options
|
|
125
|
+
)
|
|
138
126
|
end
|
|
139
|
-
unless response.body.empty?
|
|
140
|
-
response.body = Fog::JSON.decode(response.body)
|
|
141
|
-
end
|
|
142
|
-
response
|
|
143
127
|
end
|
|
144
|
-
|
|
145
|
-
private
|
|
146
|
-
|
|
147
128
|
end
|
|
148
129
|
end
|
|
149
130
|
end
|
|
@@ -12,7 +12,7 @@ module Fog
|
|
|
12
12
|
:openstack_project_name, :openstack_project_id,
|
|
13
13
|
:openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
|
|
14
14
|
:openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id,
|
|
15
|
-
:openstack_identity_prefix, :openstack_temp_url_key
|
|
15
|
+
:openstack_identity_prefix, :openstack_temp_url_key, :openstack_cache_ttl
|
|
16
16
|
|
|
17
17
|
model_path 'fog/openstack/models/monitoring'
|
|
18
18
|
model :metric
|
|
@@ -68,6 +68,10 @@ module Fog
|
|
|
68
68
|
class Real
|
|
69
69
|
include Fog::OpenStack::Core
|
|
70
70
|
|
|
71
|
+
def self.not_found_class
|
|
72
|
+
Fog::Monitoring::OpenStack::NotFound
|
|
73
|
+
end
|
|
74
|
+
|
|
71
75
|
def initialize(options = {})
|
|
72
76
|
initialize_identity options
|
|
73
77
|
|
|
@@ -80,36 +84,6 @@ module Fog
|
|
|
80
84
|
@persistent = options[:persistent] || false
|
|
81
85
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
82
86
|
end
|
|
83
|
-
|
|
84
|
-
def request(params, parse_json = true)
|
|
85
|
-
begin
|
|
86
|
-
response = @connection.request(params.merge(:headers => {
|
|
87
|
-
'Content-Type' => 'application/json',
|
|
88
|
-
'Accept' => 'application/json',
|
|
89
|
-
'X-Auth-Token' => @auth_token
|
|
90
|
-
}.merge!(params[:headers] || {}),
|
|
91
|
-
:path => "#{@path}/#{params[:path]}"))
|
|
92
|
-
rescue Excon::Errors::Unauthorized => error
|
|
93
|
-
if error.response.body != 'Bad username or password' # token expiration
|
|
94
|
-
@openstack_must_reauthenticate = true
|
|
95
|
-
authenticate
|
|
96
|
-
retry
|
|
97
|
-
else # bad credentials
|
|
98
|
-
raise error
|
|
99
|
-
end
|
|
100
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
101
|
-
raise case error
|
|
102
|
-
when Excon::Errors::NotFound
|
|
103
|
-
Fog::Monitoring::OpenStack::NotFound.slurp(error)
|
|
104
|
-
else
|
|
105
|
-
error
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
if !response.body.empty? && parse_json && response.get_header('Content-Type') =~ %r{application/json}
|
|
109
|
-
response.body = Fog::JSON.decode(response.body)
|
|
110
|
-
end
|
|
111
|
-
response
|
|
112
|
-
end
|
|
113
87
|
end
|
|
114
88
|
end
|
|
115
89
|
end
|
|
@@ -287,6 +287,10 @@ module Fog
|
|
|
287
287
|
class Real
|
|
288
288
|
include Fog::OpenStack::Core
|
|
289
289
|
|
|
290
|
+
def self.not_found_class
|
|
291
|
+
Fog::Network::OpenStack::NotFound
|
|
292
|
+
end
|
|
293
|
+
|
|
290
294
|
def initialize(options = {})
|
|
291
295
|
initialize_identity options
|
|
292
296
|
|
|
@@ -302,41 +306,8 @@ module Fog
|
|
|
302
306
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
303
307
|
end
|
|
304
308
|
|
|
305
|
-
def request(params)
|
|
306
|
-
begin
|
|
307
|
-
response = @connection.request(params.merge(
|
|
308
|
-
:headers => {
|
|
309
|
-
'Content-Type' => 'application/json',
|
|
310
|
-
'Accept' => 'application/json',
|
|
311
|
-
'X-Auth-Token' => @auth_token
|
|
312
|
-
}.merge!(params[:headers] || {}),
|
|
313
|
-
:path => "#{@path}/#{params[:path]}" # ,
|
|
314
|
-
))
|
|
315
|
-
rescue Excon::Errors::Unauthorized => error
|
|
316
|
-
if error.response.body != 'Bad username or password' # token expiration
|
|
317
|
-
@openstack_must_reauthenticate = true
|
|
318
|
-
authenticate
|
|
319
|
-
set_api_path
|
|
320
|
-
retry
|
|
321
|
-
else # bad credentials
|
|
322
|
-
raise error
|
|
323
|
-
end
|
|
324
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
325
|
-
raise case error
|
|
326
|
-
when Excon::Errors::NotFound
|
|
327
|
-
Fog::Network::OpenStack::NotFound.slurp(error)
|
|
328
|
-
else
|
|
329
|
-
error
|
|
330
|
-
end
|
|
331
|
-
end
|
|
332
|
-
unless response.body.empty?
|
|
333
|
-
response.body = Fog::JSON.decode(response.body)
|
|
334
|
-
end
|
|
335
|
-
response
|
|
336
|
-
end
|
|
337
|
-
|
|
338
309
|
def set_api_path
|
|
339
|
-
@path.sub!(%r{
|
|
310
|
+
@path.sub!(%r{/$}, '')
|
|
340
311
|
unless @path.match(SUPPORTED_VERSIONS)
|
|
341
312
|
@path = Fog::OpenStack.get_supported_version_path(SUPPORTED_VERSIONS,
|
|
342
313
|
@openstack_management_uri,
|
data/lib/fog/openstack/nfv.rb
CHANGED
|
@@ -98,6 +98,10 @@ module Fog
|
|
|
98
98
|
class Real
|
|
99
99
|
include Fog::OpenStack::Core
|
|
100
100
|
|
|
101
|
+
def self.not_found_class
|
|
102
|
+
Fog::NFV::OpenStack::NotFound
|
|
103
|
+
end
|
|
104
|
+
|
|
101
105
|
def initialize(options = {})
|
|
102
106
|
initialize_identity options
|
|
103
107
|
|
|
@@ -107,7 +111,13 @@ module Fog
|
|
|
107
111
|
@connection_options = options[:connection_options] || {}
|
|
108
112
|
|
|
109
113
|
authenticate
|
|
114
|
+
set_api_path
|
|
110
115
|
|
|
116
|
+
@persistent = options[:persistent] || false
|
|
117
|
+
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def set_api_path
|
|
111
121
|
unless @path.match(SUPPORTED_VERSIONS)
|
|
112
122
|
@path = "/" + Fog::OpenStack.get_supported_version(
|
|
113
123
|
SUPPORTED_VERSIONS,
|
|
@@ -116,41 +126,6 @@ module Fog
|
|
|
116
126
|
@connection_options
|
|
117
127
|
)
|
|
118
128
|
end
|
|
119
|
-
|
|
120
|
-
@persistent = options[:persistent] || false
|
|
121
|
-
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def request(params)
|
|
125
|
-
response = @connection.request(
|
|
126
|
-
params.merge(
|
|
127
|
-
:headers => {
|
|
128
|
-
'Content-Type' => 'application/json',
|
|
129
|
-
'X-Auth-Token' => @auth_token
|
|
130
|
-
}.merge!(params[:headers] || {}),
|
|
131
|
-
:path => "#{@path}/#{params[:path]}"
|
|
132
|
-
)
|
|
133
|
-
)
|
|
134
|
-
rescue Excon::Errors::Unauthorized => error
|
|
135
|
-
if error.response.body != "Bad username or password" # token expiration
|
|
136
|
-
@openstack_must_reauthenticate = true
|
|
137
|
-
authenticate
|
|
138
|
-
retry
|
|
139
|
-
else # bad credentials
|
|
140
|
-
raise error
|
|
141
|
-
end
|
|
142
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
143
|
-
raise case error
|
|
144
|
-
when Excon::Errors::NotFound
|
|
145
|
-
Fog::NFV::OpenStack::NotFound.slurp(error)
|
|
146
|
-
else
|
|
147
|
-
error
|
|
148
|
-
end
|
|
149
|
-
else
|
|
150
|
-
unless response.body.empty?
|
|
151
|
-
response.body = Fog::JSON.decode(response.body)
|
|
152
|
-
end
|
|
153
|
-
response
|
|
154
129
|
end
|
|
155
130
|
end
|
|
156
131
|
end
|
|
@@ -131,6 +131,11 @@ module Fog
|
|
|
131
131
|
class Real
|
|
132
132
|
include Fog::OpenStack::Core
|
|
133
133
|
|
|
134
|
+
# NOTE: uncommenting this should be treated as api-change!
|
|
135
|
+
# def self.not_found_class
|
|
136
|
+
# Fog::Orchestration::OpenStack::NotFound
|
|
137
|
+
# end
|
|
138
|
+
|
|
134
139
|
def initialize(options={})
|
|
135
140
|
initialize_identity options
|
|
136
141
|
|
|
@@ -146,46 +151,6 @@ module Fog
|
|
|
146
151
|
@persistent = options[:persistent] || false
|
|
147
152
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
148
153
|
end
|
|
149
|
-
|
|
150
|
-
def request(params)
|
|
151
|
-
begin
|
|
152
|
-
response = @connection.request(params.merge({
|
|
153
|
-
:headers => {
|
|
154
|
-
'Content-Type' => 'application/json',
|
|
155
|
-
'Accept' => 'application/json',
|
|
156
|
-
'X-Auth-Token' => @auth_token,
|
|
157
|
-
'X-Auth-User' => @openstack_username,
|
|
158
|
-
'X-Auth-Key' => @openstack_api_key
|
|
159
|
-
}.merge!(params[:headers] || {}),
|
|
160
|
-
:path => "#{@path}/#{params[:path]}",
|
|
161
|
-
:query => params[:query]
|
|
162
|
-
}))
|
|
163
|
-
rescue Excon::Errors::Unauthorized => error
|
|
164
|
-
if error.response.body != 'Bad username or password' # token expiration
|
|
165
|
-
@openstack_must_reauthenticate = true
|
|
166
|
-
authenticate
|
|
167
|
-
retry
|
|
168
|
-
else # Bad Credentials
|
|
169
|
-
raise error
|
|
170
|
-
end
|
|
171
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
172
|
-
raise case error
|
|
173
|
-
when Excon::Errors::NotFound
|
|
174
|
-
Fog::Compute::OpenStack::NotFound.slurp(error)
|
|
175
|
-
else
|
|
176
|
-
error
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
if !response.body.empty? and response.get_header('Content-Type') =~ /application\/json/ then
|
|
181
|
-
response.body = Fog::JSON.decode(response.body)
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
response
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
private
|
|
188
|
-
|
|
189
154
|
end
|
|
190
155
|
end
|
|
191
156
|
end
|
|
@@ -97,7 +97,12 @@ module Fog
|
|
|
97
97
|
class Real
|
|
98
98
|
include Fog::OpenStack::Core
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
# NOTE: uncommenting this should be treated as api-change!
|
|
101
|
+
# def self.not_found_class
|
|
102
|
+
# Fog::Planning::OpenStack::NotFound
|
|
103
|
+
# end
|
|
104
|
+
|
|
105
|
+
def initialize(options = {})
|
|
101
106
|
initialize_identity options
|
|
102
107
|
|
|
103
108
|
@openstack_service_type = options[:openstack_service_type] || ['management'] # currently Tuskar is configured as 'management' service in Keystone
|
|
@@ -107,51 +112,21 @@ module Fog
|
|
|
107
112
|
@connection_options = options[:connection_options] || {}
|
|
108
113
|
|
|
109
114
|
authenticate
|
|
110
|
-
|
|
111
|
-
unless @path.match(SUPPORTED_VERSIONS)
|
|
112
|
-
@path = "/v2"
|
|
113
|
-
end
|
|
115
|
+
set_api_path
|
|
114
116
|
|
|
115
117
|
@persistent = options[:persistent] || false
|
|
116
118
|
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
|
|
117
119
|
end
|
|
118
120
|
|
|
119
|
-
def
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
:headers => {
|
|
123
|
-
'Content-Type' => 'application/json',
|
|
124
|
-
'X-Auth-Token' => @auth_token
|
|
125
|
-
}.merge!(params[:headers] || {}),
|
|
126
|
-
:path => "#{@path}/#{params[:path]}"#,
|
|
127
|
-
}))
|
|
128
|
-
rescue Excon::Errors::Unauthorized => error
|
|
129
|
-
if error.response.body != 'Bad username or password' # token expiration
|
|
130
|
-
@openstack_must_reauthenticate = true
|
|
131
|
-
authenticate
|
|
132
|
-
retry
|
|
133
|
-
else # bad credentials
|
|
134
|
-
raise error
|
|
135
|
-
end
|
|
136
|
-
rescue Excon::Errors::HTTPStatusError => error
|
|
137
|
-
raise case error
|
|
138
|
-
when Excon::Errors::NotFound
|
|
139
|
-
Fog::Compute::OpenStack::NotFound.slurp(error)
|
|
140
|
-
else
|
|
141
|
-
error
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
unless response.body.empty?
|
|
145
|
-
response.body = Fog::JSON.decode(response.body)
|
|
121
|
+
def set_api_path
|
|
122
|
+
unless @path.match(SUPPORTED_VERSIONS)
|
|
123
|
+
@path = "/v2"
|
|
146
124
|
end
|
|
147
|
-
response
|
|
148
125
|
end
|
|
149
|
-
|
|
150
|
-
private
|
|
151
|
-
|
|
152
126
|
end
|
|
153
127
|
end
|
|
154
128
|
|
|
129
|
+
# TODO: get rid of inconform self.[] & self.new & self.services
|
|
155
130
|
def self.[](service)
|
|
156
131
|
new(:service => service)
|
|
157
132
|
end
|