MuranoCLI 3.2.0.beta.5 → 3.2.0.beta.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.ignore +22 -11
  3. data/dockers/Dockerfile.2.2.9 +2 -2
  4. data/dockers/Dockerfile.2.3.6 +2 -2
  5. data/dockers/Dockerfile.2.4.3 +2 -2
  6. data/dockers/Dockerfile.2.5.0 +2 -2
  7. data/dockers/Dockerfile.GemRelease +6 -6
  8. data/dockers/Dockerfile.m4 +4 -4
  9. data/dockers/README.rst +87 -19
  10. data/dockers/RELEASE.rst +1 -1
  11. data/dockers/docker-test.sh +4 -1
  12. data/{.trustme.plugin → docs/ci/.trustme.plugin} +5 -2
  13. data/{.trustme.sh → docs/ci/.trustme.sh} +64 -16
  14. data/lib/MrMurano/Business.rb +73 -0
  15. data/lib/MrMurano/Config.rb +4 -3
  16. data/lib/MrMurano/Keystore.rb +4 -0
  17. data/lib/MrMurano/ReCommander.rb +23 -0
  18. data/lib/MrMurano/Solution.rb +10 -0
  19. data/lib/MrMurano/SyncUpDown-Core.rb +94 -56
  20. data/lib/MrMurano/SyncUpDown-Item.rb +2 -0
  21. data/lib/MrMurano/Webservice-Endpoint.rb +8 -7
  22. data/lib/MrMurano/commands/business.rb +60 -0
  23. data/lib/MrMurano/commands/content.rb +7 -1
  24. data/lib/MrMurano/commands/cors.rb +1 -0
  25. data/lib/MrMurano/commands/devices.rb +1 -1
  26. data/lib/MrMurano/commands/element.rb +40 -14
  27. data/lib/MrMurano/commands/keystore.rb +8 -0
  28. data/lib/MrMurano/commands/logs.rb +1 -0
  29. data/lib/MrMurano/commands/network.rb +120 -0
  30. data/lib/MrMurano/commands/postgresql.rb +2 -0
  31. data/lib/MrMurano/commands/service.rb +5 -0
  32. data/lib/MrMurano/commands/settings.rb +3 -0
  33. data/lib/MrMurano/commands/show.rb +1 -0
  34. data/lib/MrMurano/commands/status.rb +1 -0
  35. data/lib/MrMurano/commands/sync.rb +2 -0
  36. data/lib/MrMurano/commands/timeseries.rb +9 -0
  37. data/lib/MrMurano/commands/tsdb.rb +4 -0
  38. data/lib/MrMurano/commands.rb +1 -0
  39. data/lib/MrMurano/variegated/ruby_dig.rb +11 -0
  40. data/lib/MrMurano/version.rb +1 -1
  41. data/spec/cmd_element_spec.rb +2 -2
  42. data/spec/fixtures/dumped_config +1 -0
  43. metadata +6 -5
  44. /data/{.trustme.vim → docs/ci/.trustme.vim} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aee0c62e2b43c3677482ff5962c744efeb602e2a889aec33f4c25318e14b24d7
4
- data.tar.gz: 626bc2a19f7a9d5dccc4943b3710ec75f4b7dcaf75aedb2e8d216f300bc42129
3
+ metadata.gz: 8940564247a955849c5a89835b1915f57b3766f28b0fc52cd83e282ec9aef599
4
+ data.tar.gz: dda30a89bf0f573fd124902dba05fe8c7f21b0b803dd951a6573ccd400a6293f
5
5
  SHA512:
6
- metadata.gz: 6cc99cff39c92cbcce0b368bc5cf665eee0d1a296fb62ebed9002fe52b64e5aaa919dfa0696893be838b292f9d275cfa5c387db9befd8327123fa3980b8d4d18
7
- data.tar.gz: 8b7234f489e517edc073ce7386426f19f376d04fe8e5694fb60396903a2c2c0f4cecd1452f36835d668e72fd3bfd1355beadb76b22f6132fd60ac906b21161d1
6
+ metadata.gz: e221c40000b55e2c6b18aa2738541ed3c8edbc4bdb61377a2e62342a0ca2f6e261731e455a846eff2a77b18893e1d90fc6c2bd74b9dee4d41ee23bdd8868a4ee
7
+ data.tar.gz: 6d9076522f2a45cd76a95ffc2f362952e6f2d3978699571efcc93663906b062051e8e883edc58400758112ad7093632f14d087d3218ec87179d9f121473fd01c
data/.ignore CHANGED
@@ -1,19 +1,30 @@
1
1
  .git/
2
- coverage/
3
- pkg/
4
- report/
5
2
 
6
- .byebug_history
7
- .rspec_examples.txt
3
+ # Build/install cruft.
4
+ pkg/
8
5
  Gemfile.lock
9
6
  .bundle/
10
- tags
11
-
12
- # 2017-05-12: Testing!
13
- *.out
14
- .trustme.log
15
- curldebug.out
7
+ .rake_build.out
16
8
 
9
+ # Testing cruft.
10
+ coverage/
11
+ report/
17
12
  rspec-*.html
18
13
  *.rspec.html
14
+ .rspec_examples.txt
15
+
16
+ # Debugging/developing cruft.
17
+ curldebug.out
18
+ tags
19
+ .byebug_history
20
+ .trustme.log
21
+ active-project
22
+ projects
23
+
24
+ # Symlinks!
25
+ projects
26
+ active-project
27
+
28
+ # Generated files.
29
+ docs/completions/murano_completion-bash
19
30
 
@@ -16,7 +16,7 @@ RUN \
16
16
  && apt-get -qq update \
17
17
  && apt-get install -y sudo
18
18
 
19
- RUN echo "jenkins ALL= NOPASSWD: ALL" >> /etc/sudoers
19
+ RUN echo "jenkins ALL= NOPASSWD: /bin/chmod" >> /etc/sudoers
20
20
 
21
21
  WORKDIR /app
22
22
  COPY . /app
@@ -26,7 +26,7 @@ RUN /bin/chown -R jenkins /app
26
26
  USER jenkins
27
27
 
28
28
  RUN cd /app && \
29
- sudo gem install bundler && \
29
+ gem install bundler && \
30
30
  gem install rspec && \
31
31
  bundle install --with test && \
32
32
  rake build
@@ -16,7 +16,7 @@ RUN \
16
16
  && apt-get -qq update \
17
17
  && apt-get install -y sudo
18
18
 
19
- RUN echo "jenkins ALL= NOPASSWD: ALL" >> /etc/sudoers
19
+ RUN echo "jenkins ALL= NOPASSWD: /bin/chmod" >> /etc/sudoers
20
20
 
21
21
  WORKDIR /app
22
22
  COPY . /app
@@ -26,7 +26,7 @@ RUN /bin/chown -R jenkins /app
26
26
  USER jenkins
27
27
 
28
28
  RUN cd /app && \
29
- sudo gem install bundler && \
29
+ gem install bundler && \
30
30
  gem install rspec && \
31
31
  bundle install --with test && \
32
32
  rake build
@@ -16,7 +16,7 @@ RUN \
16
16
  && apt-get -qq update \
17
17
  && apt-get install -y sudo
18
18
 
19
- RUN echo "jenkins ALL= NOPASSWD: ALL" >> /etc/sudoers
19
+ RUN echo "jenkins ALL= NOPASSWD: /bin/chmod" >> /etc/sudoers
20
20
 
21
21
  WORKDIR /app
22
22
  COPY . /app
@@ -26,7 +26,7 @@ RUN /bin/chown -R jenkins /app
26
26
  USER jenkins
27
27
 
28
28
  RUN cd /app && \
29
- sudo gem install bundler && \
29
+ gem install bundler && \
30
30
  gem install rspec && \
31
31
  bundle install --with test && \
32
32
  rake build
@@ -16,7 +16,7 @@ RUN \
16
16
  && apt-get -qq update \
17
17
  && apt-get install -y sudo
18
18
 
19
- RUN echo "jenkins ALL= NOPASSWD: ALL" >> /etc/sudoers
19
+ RUN echo "jenkins ALL= NOPASSWD: /bin/chmod" >> /etc/sudoers
20
20
 
21
21
  WORKDIR /app
22
22
  COPY . /app
@@ -26,7 +26,7 @@ RUN /bin/chown -R jenkins /app
26
26
  USER jenkins
27
27
 
28
28
  RUN cd /app && \
29
- sudo gem install bundler && \
29
+ gem install bundler && \
30
30
  gem install rspec && \
31
31
  bundle install --with test && \
32
32
  rake build
@@ -26,11 +26,11 @@ RUN /bin/chown -R jenkins /app
26
26
 
27
27
  USER jenkins
28
28
 
29
- RUN cd /app
30
- RUN gem install bundler
31
- RUN gem install rspec
32
- RUN bundle install
33
- RUN rake build
29
+ RUN cd /app && \
30
+ gem install bundler && \
31
+ gem install rspec && \
32
+ bundle install && \
33
+ rake build
34
34
 
35
35
  RUN gem install \
36
36
  pkg/MuranoCLI-$(ruby -e \
@@ -41,7 +41,7 @@ RUN gem install \
41
41
 
42
42
  RUN mkdir -p /home/jenkins/Downloads && \
43
43
  cd /home/jenkins/Downloads && \
44
- curl -L https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 | bzcat | tar xf - && \
44
+ curl -L https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | bzcat | tar xf - && \
45
45
  mkdir -p /home/jenkins/bin && \
46
46
  cp bin/linux/amd64/github-release /home/jenkins/bin/github-release
47
47
 
@@ -77,10 +77,10 @@ RUN \
77
77
  && apt-get -qq update \
78
78
  && apt-get install -y sudo
79
79
 
80
- dnl # NOTE: It's just easier to give the jenkins user full sudo...
81
- dnl # RUN echo "jenkins ALL= NOPASSWD: /bin/chmod" >> /etc/sudoers
80
+ dnl # (lb) It may be easier to give the jenkins user full sudo...
81
+ RUN echo "jenkins ALL= NOPASSWD: /bin/chmod" >> /etc/sudoers
82
82
  dnl # RUN echo "jenkins ALL= NOPASSWD: /usr/local/bundle/bin/gem" >> /etc/sudoers
83
- RUN echo "jenkins ALL= NOPASSWD: ALL" >> /etc/sudoers
83
+ dnl # RUN echo "jenkins ALL= NOPASSWD: ALL" >> /etc/sudoers
84
84
  dnl # If you have complainst about sudoers, try:
85
85
  dnl # RUN visudo -c
86
86
 
@@ -106,7 +106,7 @@ dnl #
106
106
  USER jenkins
107
107
 
108
108
  RUN cd /app && \
109
- sudo gem install bundler && \
109
+ gem install bundler && \
110
110
  gem install rspec && \
111
111
  bundle install --with test && \
112
112
  rake build
data/dockers/README.rst CHANGED
@@ -196,7 +196,7 @@ Jenkins project configuration: Murano CLI Gem Release
196
196
 
197
197
  - NEW:
198
198
 
199
- *TBD*
199
+ https://jenkins.exosite.com/job/MuranoCLI/job/Murano_CLI_Gem_Release/configure
200
200
 
201
201
  - OLD:
202
202
 
@@ -204,7 +204,13 @@ Jenkins project configuration: Murano CLI Gem Release
204
204
 
205
205
  - General configuration
206
206
 
207
- - Project name: ``Murano CLI Gem Release``
207
+ - Project name: ``Murano_CLI_Gem_Release``
208
+
209
+ - NOTE: Do not use spaces in the project name -- e.g., this is bad:
210
+ ``Murano CLI Gem Release`` -- or the `Jenkins Docker Plugin
211
+ <https://github.com/jenkinsci/docker-custom-build-environment-plugin>`__
212
+ will complain, e.g., ``docker: Error response from daemon: Invalid container
213
+ name (Murano CLI Gem Release-69), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed``.
208
214
 
209
215
  - Discard old builds ``✓``
210
216
 
@@ -226,7 +232,7 @@ Jenkins project configuration: Murano CLI Gem Release
226
232
 
227
233
  - Repository URL: https://github.com/exosite/MuranoCLI.git
228
234
 
229
- - Credentials: (SSH key. Set Deploy Key in GitHub; Credentials in Jenkins.)
235
+ - Credentials [dropdown]: ``git``
230
236
 
231
237
  - Branches to build
232
238
 
@@ -242,33 +248,31 @@ Jenkins project configuration: Murano CLI Gem Release
242
248
 
243
249
  - Build Environment
244
250
 
245
- - Build inside a Docker container ``✓``
251
+ - Use secret text(s) or file(s) ``✓``
246
252
 
247
- - Docker image to use
253
+ - Bindings
248
254
 
249
- - Build from Dockerfile ``✓``
255
+ - Secret text
250
256
 
251
- - path to docker context: ``.``
257
+ - Variable: ``GITHUB_TOKEN``
252
258
 
253
- - Dockerfile: ``./dockers/Dockerfile.GemRelease``
259
+ - Credentials: "Specific credentials"
254
260
 
255
- - Inject environment variables to the build process ``✓``
261
+ Dropdown: "Exosite Github API Token"
256
262
 
257
- - Properties Content::
263
+ - Build inside a Docker container ``✓``
258
264
 
259
- GITHUB_REPO=MuranoCLI
260
- GITHUB_USER=exosite
261
- PATH=$HOME/bin:$PATH
265
+ - Docker image to use
262
266
 
263
- - Inject passwords to the build as environment variables ``✓``
267
+ - Build from Dockerfile ``✓``
264
268
 
265
- - Job passwords
269
+ - path to docker context: ``.``
266
270
 
267
- - Name: ``GITHUB_TOKEN``
271
+ - Dockerfile: ``./dockers/Dockerfile.GemRelease``
268
272
 
269
- - Password: (App token generated on GitHub.)
273
+ - Color ANSI Console Output ``✓``
270
274
 
271
- - Mask password parameters ``✓``
275
+ - ANSI color map [dropdown]: ``xterm``
272
276
 
273
277
  - Build
274
278
 
@@ -277,11 +281,75 @@ Jenkins project configuration: Murano CLI Gem Release
277
281
  - Command::
278
282
 
279
283
  #!/bin/bash
284
+ export GITHUB_REPO=MuranoCLI
285
+ export GITHUB_USER=exosite
286
+ export PATH=$HOME/bin:$PATH
280
287
  /app/dockers/gem-release.sh
281
288
 
282
289
  - Post-build Actions
283
290
 
284
291
  - Files to archive: ``pkg/MuranoCLI-*.gem``
285
292
 
286
- FIXME: Missing GitHub & other notifications. See old job.
293
+ - E-mail Notification
294
+
295
+ - Recipients: ``user`@exosite.com user2@exosite.com``
296
+
297
+ - Send e-mail for every unstable build ``✓``
298
+
299
+ - HipChat Notifications
300
+
301
+ - Credentials [dropdown]: ``HipChat token for Jenkins``
302
+
303
+ - Project Room: ``4403216`` [MurCLI:CI]
304
+
305
+ - Notifications
306
+
307
+ - Notification Type: ``Build started``
308
+
309
+ - Notification Type: ``Build aborted``
310
+
311
+ - Notification Type: ``Build successful``
312
+
313
+ - Notification Type: ``Build failed``
314
+
315
+ - Notification Type: ``Module not built``
316
+
317
+ - Notification Type: ``Build is back to normal``
318
+
319
+ - Notification Type: ``Build is unstable``
320
+
321
+ Job started::
322
+
323
+ Jenkins is starting up <a href="$URL">$JOB_NAME #$BUILD_NUMBER</a> using <a href="$GIT_URL">$GIT_BRANCH</a> ($CHANGES_OR_CAUSE).
324
+
325
+ Job Completed::
326
+
327
+ Jenkins completed <a href="$URL">$JOB_NAME #$BUILD_NUMBER</a> on <a href="$GIT_URL">$GIT_BRANCH</a> (Lap Time: $DURATION).
328
+
329
+ Legacy Jenkins Settings:
330
+
331
+ - (lb): This is how it looked on the old build server, which is still
332
+ alive if we need it:
333
+
334
+ https://build.exosite.com/view/MuranoCLI/job/MrMurano%20Gem%20Release/
335
+
336
+ - Build Environment
337
+
338
+ - Inject environment variables to the build process ``✓``
339
+
340
+ - Properties Content::
341
+
342
+ GITHUB_REPO=MuranoCLI
343
+ GITHUB_USER=exosite
344
+ PATH=$HOME/bin:$PATH
345
+
346
+ - Inject passwords to the build as environment variables ``✓``
347
+
348
+ - Job passwords
349
+
350
+ - Name: ``GITHUB_TOKEN``
351
+
352
+ - Password: (App token generated on GitHub.)
353
+
354
+ - Mask password parameters ``✓``
287
355
 
data/dockers/RELEASE.rst CHANGED
@@ -38,7 +38,7 @@ Set that latest version
38
38
 
39
39
  Set the release version, e.g.,::
40
40
 
41
- MURCLI_VER="3.1.0.beta.8"
41
+ MURCLI_VER="3.2.0.beta.8"
42
42
  MURCLI_REL="v${MURCLI_VER}"
43
43
 
44
44
  Choose a release: pre or official
@@ -52,6 +52,9 @@ must_verify_environs () {
52
52
 
53
53
  # Create a basic Murano CLI config indicating the Murano account credentials.
54
54
 
55
+ # Default to host "bizapi-staging.hosted.exosite.io".
56
+ export MURANO_BIZAPIIO=${MURANO_BIZAPIIO:-bizapi-staging.hosted.exosite.io}
57
+
55
58
  create_basic_config () {
56
59
  cat > "${WORKSPACE}/test.run.muranocfg" <<-EOCFB
57
60
  [user]
@@ -59,7 +62,7 @@ create_basic_config () {
59
62
  [business]
60
63
  id = ${MURANO_BUSINESS}
61
64
  [net]
62
- host = bizapi-staging.hosted.exosite.io
65
+ host = ${MURANO_BIZAPIIO}
63
66
  EOCFB
64
67
  export MURANO_CONFIGFILE="${WORKSPACE}/test.run.muranocfg"
65
68
  }
@@ -43,6 +43,8 @@ build_it() {
43
43
  ).gem \
44
44
  &>> ${OUT_FILE} 2>&1 &
45
45
  wait_maybe_fail
46
+ #alert_success_toast 'Murano CLI says, "Woot woot!!"' 'Wheeee!' 666
47
+ alert_success_flash
46
48
 
47
49
  say '' true
48
50
  }
@@ -57,8 +59,9 @@ lint_it() {
57
59
 
58
60
  test_it() {
59
61
  test_it_
60
- # MEH/2017-12-06: The tests take a number of seconds to run, so skipping.
61
- return
62
+ # 2017-10-02: (lb): Testing takes too long (20 minutes!), and saving often
63
+ # just means constant churn, so skip tests.
64
+ return
62
65
 
63
66
  rake rspec &>> ${OUT_FILE}
64
67
 
@@ -66,7 +66,8 @@ source_plugin() {
66
66
  PROJECT_DIR=$(dirname -- "${BASH_SOURCE[0]}")
67
67
  DOTFILENAME=${TRUSTME_BASENAME:-.trustme}
68
68
 
69
- source_color
69
+ source_home_fries_util 'color_util.sh'
70
+ source_home_fries_util 'logger.sh'
70
71
 
71
72
  PROJ_PLUGIN="${PROJECT_DIR}/${DOTFILENAME}.plugin"
72
73
  if [[ ! -f "${PROJ_PLUGIN}" ]]; then
@@ -76,22 +77,24 @@ source_plugin() {
76
77
  source "${PROJ_PLUGIN}"
77
78
  }
78
79
 
79
- source_color() {
80
- local color_util='color_util.sh'
81
- local color_path="${color_util}"
80
+ source_home_fries_util() {
81
+ local home_fries_util="$1"
82
+ local source_path="${home_fries_util}"
82
83
  # If the /user/home/.fries/lib path is on $PATH, you can just source it.
83
- if ! source "${color_path}" &> /dev/null; then
84
- # But if it's not on $PATH, see if this script is a symlink, in which
85
- # case color_util.sh is also part of this file's owning repo.
84
+ if ! source "${source_path}" &> /dev/null; then
85
+ # But if it's not on $PATH, see if this script is a symlink, and if so,
86
+ # see if the util file is part of this file's owning repo.
86
87
  if [[ -h "${BASH_SOURCE[0]}" ]]; then
87
- color_path="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/${color_util}"
88
+ source_path="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/${home_fries_util}"
88
89
  fi
89
- if ! source "${color_path}" &> /dev/null; then
90
- >&2 echo "Unable to find and source ${color_util}. You're missing out!"
90
+ if ! source "${source_path}" &> /dev/null; then
91
+ >&2 echo "Unable to find and source ${home_fries_util}. You're missing out!"
91
92
  fi
92
93
  fi
93
94
  }
94
95
 
96
+ # ***
97
+
95
98
  assign_globals_() {
96
99
  OUT_FILE="${PROJECT_DIR}/${DOTFILENAME}.log"
97
100
 
@@ -113,6 +116,8 @@ assign_globals() {
113
116
  assign_globals_
114
117
  }
115
118
 
119
+ # ***
120
+
116
121
  say() {
117
122
  FORCE_ECHO=${2:-false}
118
123
  # Restrict newlines to no more than 2 in a row.
@@ -161,6 +166,8 @@ repeat_char() {
161
166
  printf "$1"'%.s' $(eval "echo {1.."$(($2))"}")
162
167
  }
163
168
 
169
+ # ***
170
+
164
171
  death() {
165
172
  if [[ -n ${WAIT_PID} ]]; then
166
173
  say "Sub-killing ‘${WAIT_PID}’"
@@ -263,7 +270,7 @@ lock_kill_or_die() {
263
270
  lock_kill_die true
264
271
  }
265
272
 
266
- # ===
273
+ # ***
267
274
 
268
275
  wait_maybe_fail_pre_exit() {
269
276
  : # no-op
@@ -286,9 +293,51 @@ wait_maybe_fail() {
286
293
  WAIT_PID=
287
294
  }
288
295
 
296
+ # ***
297
+
298
+ alert_success_toast() {
299
+ local message
300
+ local title
301
+ local timeout
302
+ message="${1:-Yay!}"
303
+ title="${2:-Build Success!}"
304
+ timeout=${3:-2123}
305
+ if ``command -v notify-send >/dev/null 2>&1``; then
306
+ #notify-send -i face-wink -t 1234 \
307
+ # 'Build Success!' 'Murano CLI says, "Woot woot!!"'
308
+ # 2018-03-19: 1234 msec. is a tad too long. Something quicker,
309
+ # so I can train myself to ignore if it's a blip in the corner of my eye.
310
+ # Just make sure your mouse into over popup, or it won't go away!
311
+ # Hahaha, at 333 msec. it's basically a flash on the screen...
312
+ # in that case, there's probably a better way to implement this!
313
+ notify-send \
314
+ -t ${timeout} \
315
+ -u normal \
316
+ -i '/home/landonb/.waffle/home/Pictures/Landonb-Bitmoji-Thumbs.Up.png' \
317
+ "${title}" \
318
+ "${message}"
319
+ fi
320
+ }
321
+
322
+ alert_success_flash() {
323
+ local duration
324
+ duration=${1:-0.075}
325
+ # 2018-03-19 18:04: This just gets better!
326
+ # sudo apt-get install xcalib
327
+ ##xcalib -invert -alter
328
+ #xcalib -alter -invert
329
+ # xcalib, because of X, only works on the first monitor!
330
+ # 2018-04-12: But I found a solution that works on all!!
331
+ /srv/opt/bin/xrandr-invert-colors.bin
332
+ sleep ${duration}
333
+ ##xcalib -invert -alter
334
+ #xcalib -alter -invert
335
+ /srv/opt/bin/xrandr-invert-colors.bin
336
+ }
337
+
338
+ # ***
339
+
289
340
  prepare_to_build() {
290
- #/bin/rm "${DONE_FILE}"
291
- #/bin/rm "${OUT_FILE}"
292
341
  rmdir "${KILL_DIR}"
293
342
  say
294
343
  say "See you on the other side!"
@@ -360,10 +409,11 @@ remove_pid_files() {
360
409
  /bin/rm "${KILL_BIN}"
361
410
  }
362
411
 
412
+ # ***
413
+
363
414
  main() {
364
415
  source_plugin
365
416
 
366
- # MAYBE: This call is redundant. Do we need to call it again here? Or should we delete first call?
367
417
  assign_globals
368
418
 
369
419
  # We're called on both save, and on simple buffer enter.
@@ -448,8 +498,6 @@ main() {
448
498
 
449
499
  lint_it
450
500
 
451
- # 2017-10-02: I think testing takes too long, and saving often just means constant churn.
452
-
453
501
  # Unit tests.
454
502
  test_it
455
503
 
@@ -357,6 +357,79 @@ module MrMurano
357
357
  def delete_application(sid)
358
358
  delete_solution(sid)
359
359
  end
360
+
361
+ # ---------------------------------------------------------------------
362
+
363
+ def get_business_network(bid)
364
+ return nil unless check_if_biz_network_capable(bid) == true
365
+ get('business/' + bid + '/network') do |request, http|
366
+ response = http.request(request)
367
+ case response
368
+ when Net::HTTPSuccess
369
+ workit_response(response)
370
+ else
371
+ showHttpError(request, response)
372
+ nil
373
+ end
374
+ end
375
+ end
376
+ # ---------------------------------------------------------------------
377
+
378
+ # ---------------------------------------------------------------------
379
+
380
+ def configure_business_network(bid, name)
381
+ return nil unless check_if_biz_network_capable(bid) == true
382
+ patch('business/' + bid + '/network', name: name) do |request, http|
383
+ response = http.request(request)
384
+ case response
385
+ when Net::HTTPSuccess
386
+ workit_response(response)
387
+ else
388
+ showHttpError(request, response)
389
+ nil
390
+ end
391
+ end
392
+ end
393
+ # ---------------------------------------------------------------------
394
+
395
+ def check_if_biz_network_capable(bid)
396
+ get('business/' + bid + '/tier') do |request, http|
397
+ tier_response = http.request(request)
398
+ case tier_response
399
+ when Net::HTTPSuccess
400
+ parsed_response = workit_response(tier_response)
401
+ if parsed_response[:network] != true
402
+ MrMurano::Verbose.error(
403
+ 'Your business does not have access to business network features. Please upgrade your business.'
404
+ )
405
+ nil
406
+ else
407
+ true
408
+ end
409
+ else
410
+ showHttpError(request, tier_response)
411
+ nil
412
+ end
413
+ end
414
+ end
415
+
416
+ def self.must_not_be_managed!
417
+ # Check that the solution(s) are not managed.
418
+ # NOTE: BizAPI only tells us 'managed' via the business/<bizid>/solutions
419
+ # endpoint. I.e., we have to fetch all solutions, and cannot just check
420
+ # them individually. (lb): Probably not a big deal for most people, but
421
+ # I know some Support and QA biznesses have loads and loads o' solutions.
422
+ MrMurano::Verbose.whirly_msg 'Verifying solutions can be managed...'
423
+ biz = MrMurano::Business.new
424
+ solz = biz.solutions
425
+ solz.each do |sol|
426
+ # FIXME/2018-05-16: (lb): Fix this when Multi-solution support.
427
+ if [$cfg['application.id'], $cfg['product.id']].include? sol.sid
428
+ sol.must_not_be_managed!
429
+ end
430
+ end
431
+ MrMurano::Verbose.whirly_stop
432
+ end
360
433
  end
361
434
  end
362
435
 
@@ -195,6 +195,7 @@ module MrMurano
195
195
  set('tool.no-page', false, :defaults)
196
196
  set('tool.no-progress', false, :defaults)
197
197
  set('tool.show-password', false, :defaults)
198
+ set('tool.skip-managed', false, :defaults)
198
199
  end
199
200
 
200
201
  def set_defaults_net
@@ -222,12 +223,12 @@ module MrMurano
222
223
  set('location.resources', 'specs/resources.yaml', :defaults)
223
224
  set('location.cors', 'cors.yaml', :defaults)
224
225
  # MUR-6562/MUR-6329: Changing defaults: files => assets; routes => endpoints.
225
- set_defaults_location_MUR_6562('location.files', 'files', 'assets')
226
- set_defaults_location_MUR_6562('location.endpoints', 'routes', 'endpoints')
226
+ set_defaults_location_newstyle('location.files', 'files', 'assets')
227
+ set_defaults_location_newstyle('location.endpoints', 'routes', 'endpoints')
227
228
  end
228
229
 
229
230
  # rubocop:disable Style/MethodName: Use snake_case for method names.
230
- def set_defaults_location_MUR_6562(key, formerly, currently)
231
+ def set_defaults_location_newstyle(key, formerly, currently)
231
232
  if @project_dir && !@project_dir.join(formerly).exist?
232
233
  set(key, currently, :defaults)
233
234
  elsif @project_dir.join(currently).exist?
@@ -26,15 +26,19 @@ module MrMurano
26
26
  end
27
27
 
28
28
  def getkey(key)
29
+ key = URI.encode_www_form_component(key)
29
30
  ret = call(:get, :post, key: key)
30
31
  ret[:value]
31
32
  end
32
33
 
33
34
  def setkey(key, value)
35
+ key = URI.encode_www_form_component(key)
36
+ value = URI.encode_www_form_component(value)
34
37
  call(:set, :post, key: key, value: value)
35
38
  end
36
39
 
37
40
  def delkey(key)
41
+ key = URI.encode_www_form_component(key)
38
42
  call(:delete, :post, key: key)
39
43
  end
40
44