continuent-tools-core 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4e0a602b7a4383ac128219b0d25dc365dbe72f0
4
- data.tar.gz: 61a2d564fe9dc122d58a0c7a6fa2c063aae26f24
3
+ metadata.gz: 2b7b64099ff0f37bfcbaa4afa998993a4e023b74
4
+ data.tar.gz: 58ebccaa84312b4a8e4f2b1f7365c44c7fa9d5f9
5
5
  SHA512:
6
- metadata.gz: c67fc00dd70e2d36af541fab0c29199ba93764e85cc3b8030cbc95d18c7eb341561643a4a2cb8f593acf39e81744f056db45f003efd99e0694c44d1ff1d7f5da
7
- data.tar.gz: 43c45657e6bad3b0ad1fb23e58e43ce1844bb0599a90858c3ebfb39d186af7154bcad9d2f6b3f316bdb2a56f7373a35aeec902e731e174a6218a7413cee60f6d
6
+ metadata.gz: 04bdffb22ff4b6152d423afbcbbfbd8315196e23c9f90a6eec80425d13976e0a42bdfe0bdbd7a4ec883ed3f2dc5e7c6d177a8fcd5064170cb47e46db794caf24
7
+ data.tar.gz: 9b6b04384b36919462ab7e5a4a455f58f2e1442419492a1ae05ca3c0acb9350f1a76ff063769e818c1f750164f5173506ace560f9308362dec10e20fe5221708
data/lib/tungsten/exec.rb CHANGED
@@ -238,6 +238,19 @@ class TungstenUtil
238
238
 
239
239
  return
240
240
  end
241
+
242
+ # A wrapper for running another Tungsten script. This will automatically
243
+ # forward messages to the console and add any TungstenScript options to
244
+ # the command.
245
+ def tungsten_cmd_result(command)
246
+ original_fwd_state = forward_cmd_results?()
247
+ begin
248
+ forward_cmd_results?(true)
249
+ return cmd_result("#{command} #{get_tungsten_command_options()}")
250
+ ensure
251
+ forward_cmd_results?(original_fwd_state)
252
+ end
253
+ end
241
254
 
242
255
  # Run a standard check to see if SSH connectivity to the host works
243
256
  def test_ssh(host, user)
@@ -52,10 +52,17 @@ class TungstenInstall
52
52
  end
53
53
  end
54
54
 
55
+ # Path to the install directory for Continuent Tungsten. This will include
56
+ # all previous releases and a symlink to the current running version.
55
57
  def root
56
58
  @root
57
59
  end
58
60
 
61
+ # Path to the current running version of Continuent Tungsten.
62
+ def base_path
63
+ "#{@root}/#{CURRENT_RELEASE_DIRECTORY}"
64
+ end
65
+
59
66
  def hostname
60
67
  setting("host_name")
61
68
  end
@@ -79,7 +86,12 @@ class TungstenInstall
79
86
  if is_manager?()
80
87
  setting("dataservice_name")
81
88
  elsif is_replicator?()
82
- local_services = TU.cmd_result("egrep -l \"^replicator.service.type=local\" #{@root}/#{CURRENT_RELEASE_DIRECTORY}/tungsten-replicator/conf/static*").split("\n")
89
+ begin
90
+ local_services = TU.cmd_result("egrep -l \"^replicator.service.type=local\" #{@root}/#{CURRENT_RELEASE_DIRECTORY}/tungsten-replicator/conf/static*").split("\n")
91
+ rescue
92
+ local_services = []
93
+ end
94
+
83
95
  if local_services.size() == 0
84
96
  dataservices().get(0)
85
97
  else
@@ -91,7 +103,11 @@ class TungstenInstall
91
103
  end
92
104
 
93
105
  def replication_services
94
- TU.cmd_result("egrep \"^service.name\" #{@root}/#{CURRENT_RELEASE_DIRECTORY}/tungsten-replicator/conf/static-* | awk -F \"=\" '{print $2}'").split("\n")
106
+ begin
107
+ TU.cmd_result("egrep \"^service.name\" #{@root}/#{CURRENT_RELEASE_DIRECTORY}/tungsten-replicator/conf/static-* | awk -F \"=\" '{print $2}'").split("\n")
108
+ rescue
109
+ []
110
+ end
95
111
  end
96
112
 
97
113
  def tpm
@@ -141,19 +157,37 @@ class TungstenInstall
141
157
  if third == nil
142
158
  raise "Unable to create setting key for #{first}.#{second}"
143
159
  end
144
- "#{first}.#{TU.to_identifier(second)}.#{third}"
160
+
161
+ service_aliases = setting(setting_key(HOSTS, "deployment_dataservice_aliases"))
162
+ unless service_aliases.has_key?(second)
163
+ raise "Unable to find a configuration alias for the #{second} service"
164
+ end
165
+
166
+ "#{first}.#{TU.to_identifier(service_aliases[second])}.#{third}"
145
167
  elsif first == HOSTS
146
168
  "#{first}.#{TU.to_identifier(hostname())}.#{second}"
147
169
  elsif first == MANAGERS
148
170
  if third == nil
149
171
  raise "Unable to create setting key for #{first}.#{second}"
150
172
  end
151
- "#{first}.#{TU.to_identifier(second)}_#{TU.to_identifier(hostname())}.#{third}"
173
+
174
+ service_aliases = setting(setting_key(HOSTS, "deployment_dataservice_aliases"))
175
+ unless service_aliases.has_key?(second)
176
+ raise "Unable to find a configuration alias for the #{second} service"
177
+ end
178
+
179
+ "#{first}.#{TU.to_identifier(service_aliases[second])}_#{TU.to_identifier(hostname())}.#{third}"
152
180
  elsif first == REPL_SERVICES
153
181
  if third == nil
154
182
  raise "Unable to create setting key for #{first}.#{second}"
155
183
  end
156
- "#{first}.#{TU.to_identifier(second)}_#{TU.to_identifier(hostname())}.#{third}"
184
+
185
+ service_aliases = setting(setting_key(HOSTS, "deployment_dataservice_aliases"))
186
+ unless service_aliases.has_key?(second)
187
+ raise "Unable to find a configuration alias for the #{second} service"
188
+ end
189
+
190
+ "#{first}.#{TU.to_identifier(service_aliases[second])}_#{TU.to_identifier(hostname())}.#{third}"
157
191
  else
158
192
  "#{first}.#{TU.to_identifier(hostname())}.#{second}"
159
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: continuent-tools-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Continuent