bcome 1.1.3 → 1.1.4

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: cbfebb5c540c081b9950cc8b2d07ac5fb223b25f
4
- data.tar.gz: ee09f3487853f75b020577ddcd65092da556b313
3
+ metadata.gz: cdf4b817e9c7afb1b0b5508a811e2e74a71a6b97
4
+ data.tar.gz: 881ae215c6873cc81b5214f2876cd13833ce1ae1
5
5
  SHA512:
6
- metadata.gz: 3768171f03a2b1ffc72f2488fb1f8f61af3b8e6d15f89acafb332e7e7d1a4b1544d1f146a86338d26bffbf2424d7e6a037b8f7426df50a3f436869028d6c2d90
7
- data.tar.gz: c9a21a4b4bb483cdbeecbc6767b5454827fffaa9e40d6fc4b9b576467045969736cb5802270f7c43c8297ed8bd7321125d6eda7f9f88bbffc9fe36961089e7c2
6
+ metadata.gz: c67f27ca6e33d761311f9bf8c226e774b10516b9f14d2bade52e8d04e2e9df35b48e0e8ad53c1199b4fa18381e8e7a3fe51ddf9e52d05035aab15024be5c4472
7
+ data.tar.gz: c610e971283f6cc178d746a4eb1ceca8b619ac66d4a76bd1353eb2c999ab5da48c4075d7d02f7da4197ac253ab928a02c31a5e4f9cb6ce0a0032017fc73df5ec
@@ -1,3 +1,3 @@
1
1
  module Bcome
2
- VERSION = '1.1.3'.freeze
2
+ VERSION = '1.1.4'.freeze
3
3
  end
@@ -1,8 +1,11 @@
1
1
  module Bcome::Node::Inventory
2
2
  class Base < ::Bcome::Node::Base
3
+
3
4
  def initialize(*params)
4
5
  super
5
6
  raise Bcome::Exception::InventoriesCannotHaveSubViews, @views if @views[:views] && !@views[:views].empty?
7
+
8
+ @bootstrap = false
6
9
  end
7
10
 
8
11
  def meta_matches(matchers)
@@ -25,6 +28,14 @@ module Bcome::Node::Inventory
25
28
  end
26
29
  end
27
30
 
31
+ def toggle_bootstrap(set_to = (@bootstrap ? false : true))
32
+ resources.active.each do |machine|
33
+ machine.toggle_bootstrap(set_to)
34
+ end
35
+ @bootstrap = (@bootstrap ? false : true)
36
+ return
37
+ end
38
+
28
39
  def enabled_menu_items
29
40
  super + %i[ssh]
30
41
  end
@@ -14,7 +14,8 @@ module Bcome::Registry::Command
14
14
  def valid_types
15
15
  {
16
16
  external: ::Bcome::Registry::Command::External,
17
- internal: ::Bcome::Registry::Command::Internal
17
+ internal: ::Bcome::Registry::Command::Internal,
18
+ shortcut: ::Bcome::Registry::Command::Shortcut
18
19
  }
19
20
  end
20
21
  end
@@ -0,0 +1,24 @@
1
+ module Bcome::Registry::Command
2
+ class Shortcut < Base
3
+ # In which the bcome context is a shortcut to a more complex command
4
+
5
+ def execute(node, arguments) ## We'll add in arguments later
6
+ if run_as_pseudo_tty?
7
+ node.pseudo_tty command
8
+ else
9
+ node.run command
10
+ end
11
+ rescue Interrupt
12
+ puts "\nExiting gracefully from interrupt\n".warning
13
+ end
14
+
15
+ def command
16
+ @data[:shortcut_command]
17
+ end
18
+
19
+ def run_as_pseudo_tty?
20
+ @data[:run_as_pseudo_tty]
21
+ end
22
+
23
+ end
24
+ end
@@ -19,6 +19,13 @@ module Bcome::Registry
19
19
  begin
20
20
  if /^#{key.to_s}$/.match(node.keyed_namespace)
21
21
  commands.each do |c|
22
+
23
+ unless c[:console_command]
24
+ error_message = "Registry method is missing key 'console_command'."
25
+ error_message += "\n\n#{c.inspect}"
26
+ raise Bcome::Exception::InvalidRegistryDataConfig.new error_message
27
+ end
28
+
22
29
  # Verify that the proposed user registered method does not conflict with either an existing method name, instance var, or other registry command name for this node
23
30
  if node.is_node_level_method?(c[:console_command]) || command_group.console_method_name_exists?(c[:console_command])
24
31
  raise Bcome::Exception::MethodNameConflictInRegistry, "'#{c[:console_command]}'"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcome
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Roderick (Webzakimbo)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2018-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -254,6 +254,7 @@ files:
254
254
  - lib/objects/registry/command/external.rb
255
255
  - lib/objects/registry/command/group.rb
256
256
  - lib/objects/registry/command/internal.rb
257
+ - lib/objects/registry/command/shortcut.rb
257
258
  - lib/objects/registry/command_list.rb
258
259
  - lib/objects/registry/loader.rb
259
260
  - lib/objects/ssh/bootstrap.rb