Class: VagrantPlugins::Blockwart::BwManage
- Inherits:
-
Object
- Object
- VagrantPlugins::Blockwart::BwManage
- Defined in:
- lib/vagrant-blockwart/bwmanage.rb
Instance Method Summary collapse
- #apply(node, interactive = false) ⇒ Object
- #bw_cli(params, ret_stdout = true) ⇒ Object
-
#initialize(repo_path) ⇒ BwManage
constructor
A new instance of BwManage.
- #node_hosts ⇒ Object
- #nodes ⇒ Object
Constructor Details
#initialize(repo_path) ⇒ BwManage
Returns a new instance of BwManage.
5 6 7 |
# File 'lib/vagrant-blockwart/bwmanage.rb', line 5 def initialize(repo_path) @repo_path = repo_path end |
Instance Method Details
#apply(node, interactive = false) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/vagrant-blockwart/bwmanage.rb', line 32 def apply(node, interactive=false) node = node.gsub(/[^a-zA-Z0-9\-\_\.]/,'') if interactive return bw_cli("apply #{node} -i", ret_stdout=false) else return bw_cli("apply #{node}", ret_stdout=false) end end |
#bw_cli(params, ret_stdout = true) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vagrant-blockwart/bwmanage.rb', line 9 def bw_cli(params, ret_stdout=true) params = params.gsub(/[^a-zA-Z0-9\-\_\.\s]/,'') old_path = Dir.pwd Dir.chdir(@repo_path) if ret_stdout result = `bw #{params}` else result = system("bw #{params}") end Dir.chdir(old_path) return result end |
#node_hosts ⇒ Object
27 28 29 30 |
# File 'lib/vagrant-blockwart/bwmanage.rb', line 27 def node_hosts() nodes = bw_cli("nodes --hostnames") return nodes.split("\n") end |
#nodes ⇒ Object
22 23 24 25 |
# File 'lib/vagrant-blockwart/bwmanage.rb', line 22 def nodes() nodes = bw_cli("nodes") return nodes.split("\n") end |