lds-cf-plugin 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
|
|
1
|
+
require "cf/cli"
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
module LdsCfPlugin
|
5
|
+
class MarkLogicService < CF::CLI
|
6
|
+
def precondition
|
7
|
+
check_target
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Create a Marklogic Service"
|
11
|
+
group :lds, :services
|
12
|
+
input :name, :desc => "Name for your service", :argument => :optional
|
13
|
+
|
14
|
+
def create_marklogic_service
|
15
|
+
offerings = client.services
|
16
|
+
offerings.keep_if { |s| s.label == 'marklogic-service' && s.provider == 'ICS' }
|
17
|
+
service = offerings.first
|
18
|
+
|
19
|
+
if !service
|
20
|
+
fail "Cannot find Marklogic service on #{client.target}"
|
21
|
+
end
|
22
|
+
|
23
|
+
if service.version != "0.1"
|
24
|
+
fail "Your lds-cf-plugin version is out of date. To update execute `gem update lds-cf-plugin`"
|
25
|
+
end
|
26
|
+
|
27
|
+
rest_client = CFoundry::RestClient.new(service.url, client.token)
|
28
|
+
rest_client.trace = client.trace
|
29
|
+
|
30
|
+
instance_name = input[:name]
|
31
|
+
if !instance_name
|
32
|
+
instance_name = ask("Name")
|
33
|
+
end
|
34
|
+
|
35
|
+
plan = service.service_plans.first
|
36
|
+
|
37
|
+
# Create service instance
|
38
|
+
instance = client.managed_service_instance
|
39
|
+
instance.name = instance_name
|
40
|
+
|
41
|
+
instance.service_plan = plan
|
42
|
+
instance.space = client.current_space
|
43
|
+
|
44
|
+
with_progress("Creating service #{c(instance.name, :name)}") do
|
45
|
+
instance.create!
|
46
|
+
end
|
47
|
+
|
48
|
+
instance
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/lds-cf-plugin/plugin.rb
CHANGED
@@ -79,30 +79,10 @@ module LdsCfPlugin
|
|
79
79
|
env = ask("Service Manager environment to use", options)
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
|
-
# Register service with gateway
|
84
|
-
choices = ["y","n"]
|
85
|
-
|
86
82
|
prexisting = input[:prexisting]
|
87
|
-
|
88
|
-
options = {
|
89
|
-
:choices => choices,
|
90
|
-
:display => proc { |choice|
|
91
|
-
if choice == "y"
|
92
|
-
"yes"
|
93
|
-
elsif choice == "n"
|
94
|
-
"no"
|
95
|
-
end
|
96
|
-
},
|
97
|
-
:default => "y",
|
98
|
-
:allow_other => false
|
99
|
-
}
|
100
|
-
prexisting = ask("Use Pre-existing Service Manager application?",options)
|
101
|
-
end
|
102
|
-
|
103
|
-
|
83
|
+
prexisting = ask("Use existing Service Manager application CI for '#{sm_app_name}'?", :default => true) if !prexisting
|
104
84
|
|
105
|
-
if prexisting
|
85
|
+
if prexisting
|
106
86
|
payload = {
|
107
87
|
:space_guid => client.current_space.guid,
|
108
88
|
:name => instance_name,
|
@@ -115,28 +95,28 @@ module LdsCfPlugin
|
|
115
95
|
|
116
96
|
dutyPhone = input[:dutyPhone]
|
117
97
|
if !dutyPhone
|
118
|
-
dutyPhone = ask("Duty Phone (e.g. 1 801 555 5555
|
98
|
+
dutyPhone = ask("Duty Phone (e.g. 1 801 555 5555)")
|
119
99
|
end
|
120
100
|
|
121
101
|
primaryContact = input[:primaryContact]
|
122
102
|
if !primaryContact
|
123
|
-
primaryContact = ask("Primary Contact")
|
103
|
+
primaryContact = ask("Primary Contact (LDS Account)")
|
124
104
|
end
|
125
105
|
|
126
106
|
solutionManager = input[:solutionManager]
|
127
107
|
if !solutionManager
|
128
|
-
solutionManager = ask("Solution Manager")
|
108
|
+
solutionManager = ask("Solution Manager (LDS Account)")
|
129
109
|
end
|
130
110
|
|
131
111
|
supportGroup = input[:supportGroup]
|
132
112
|
if !supportGroup
|
133
|
-
supportGroup = ask("Support Group")
|
113
|
+
supportGroup = ask("Support Group (e.g. CHQ-OPS-SOMEGROUP)")
|
134
114
|
end
|
135
115
|
|
136
116
|
|
137
117
|
portfolioId = input[:portfolioId]
|
138
118
|
if !portfolioId
|
139
|
-
portfolioId = ask("Portfolio ID")
|
119
|
+
portfolioId = ask("Portfolio ID (e.g. 1234567)")
|
140
120
|
end
|
141
121
|
|
142
122
|
payload = {
|
@@ -168,6 +148,7 @@ module LdsCfPlugin
|
|
168
148
|
request, response = rest_client.request("POST", "/register", options)
|
169
149
|
if response[:status].to_i != 200
|
170
150
|
fail "Error registering Service Manager app with gateway:\n#{response[:body]}"
|
151
|
+
fail "Try creating your service using the web ui instead. It does a better job of validating parameters: https://ui.cf.lds.org/#/ServiceMarketplace"
|
171
152
|
end
|
172
153
|
end
|
173
154
|
|
data/lib/lds-cf-plugin/tunnel.rb
CHANGED
@@ -117,8 +117,8 @@ module LdsCfPlugin
|
|
117
117
|
tunnel_console do |instances|
|
118
118
|
visualvm = input[:jvisualvm] ? input[:jvisualvm] : "jvisualvm"
|
119
119
|
EventMachine::defer do
|
120
|
-
if system("
|
121
|
-
fail("Unable to run '#{visualvm}'. Is it in your PATH?")
|
120
|
+
if system("\"#{visualvm}\" -cp:a \"#{JMXMP_JAR_FILE}\"") == nil
|
121
|
+
fail("Unable to run '#{visualvm}'. Is it in your PATH? If not you can specify where visual vm is with --jvisualvm (e.g. cf visualvm some-app --jvisualvm \"c:/java/bin/jvisualvm.exe\"")
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -131,7 +131,7 @@ module LdsCfPlugin
|
|
131
131
|
instances.each do |instance|
|
132
132
|
jmxurl = "service:jmx:jmxmp://#{host}:#{port}"
|
133
133
|
puts "Adding instance #{c('#' + instance.id, :instance)} to VisualVM (#{c(jmxurl, :instance)})"
|
134
|
-
system("
|
134
|
+
system("\"#{visualvm}\" --openjmx #{jmxurl}")
|
135
135
|
port = port + 1
|
136
136
|
end
|
137
137
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lds-cf-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cf
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 5.
|
21
|
+
version: 5.4.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,23 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 5.
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: cfoundry
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - '='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 4.3.6
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - '='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 4.3.6
|
29
|
+
version: 5.4.4
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: eventmachine
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +70,7 @@ files:
|
|
86
70
|
- lib/lds-cf-plugin/http_service.rb
|
87
71
|
- lib/lds-cf-plugin/custom_service.rb
|
88
72
|
- lib/lds-cf-plugin/lds_account_service.rb
|
73
|
+
- lib/lds-cf-plugin/marklogic_service.rb
|
89
74
|
- lib/lds-cf-plugin/oracle_service.rb
|
90
75
|
- lib/lds-cf-plugin/tunnel.rb
|
91
76
|
- lib/lds-cf-plugin/version.rb
|