cloudbox-server 0.0.1

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 (147) hide show
  1. data/.yardopts +3 -0
  2. data/README.md +17 -0
  3. data/bin/cb-cluster-allocate +5 -0
  4. data/bin/cb-cluster-create +5 -0
  5. data/bin/cb-cluster-delete +5 -0
  6. data/bin/cb-cluster-desallocate +5 -0
  7. data/bin/cb-cluster-info +5 -0
  8. data/bin/cb-cluster-ls +5 -0
  9. data/bin/cb-node-destroy +5 -0
  10. data/bin/cb-node-detach +6 -0
  11. data/bin/cb-node-info +5 -0
  12. data/bin/cb-node-install +5 -0
  13. data/bin/cb-node-ls +5 -0
  14. data/bin/cb-service-add +5 -0
  15. data/bin/cb-service-component-add +5 -0
  16. data/bin/cb-service-component-delete +5 -0
  17. data/bin/cb-service-component-detach +5 -0
  18. data/bin/cb-service-conf-apply +5 -0
  19. data/bin/cb-service-conf-create +5 -0
  20. data/bin/cb-service-conf-get +5 -0
  21. data/bin/cb-service-conf-ls +5 -0
  22. data/bin/cb-service-follow-request +5 -0
  23. data/bin/cb-service-info +5 -0
  24. data/bin/cb-service-install +5 -0
  25. data/bin/cb-service-ls +5 -0
  26. data/bin/cb-service-start +5 -0
  27. data/bin/cb-service-stop +5 -0
  28. data/lib/command.rb +61 -0
  29. data/lib/command/ambari_add_host.rb +19 -0
  30. data/lib/command/ambari_cluster_command.rb +26 -0
  31. data/lib/command/ambari_cluster_component_command.rb +26 -0
  32. data/lib/command/ambari_cluster_component_host_command.rb +26 -0
  33. data/lib/command/ambari_cluster_create.rb +19 -0
  34. data/lib/command/ambari_cluster_host_command.rb +27 -0
  35. data/lib/command/ambari_cluster_list.rb +20 -0
  36. data/lib/command/ambari_cluster_service_command.rb +26 -0
  37. data/lib/command/ambari_cluster_service_host_command.rb +26 -0
  38. data/lib/command/ambari_command.rb +21 -0
  39. data/lib/command/ambari_create_cluster_configuration.rb +39 -0
  40. data/lib/command/ambari_get_cluster_configuration.rb +29 -0
  41. data/lib/command/ambari_host_list.rb +19 -0
  42. data/lib/command/ambari_install_cluster.rb +19 -0
  43. data/lib/command/ambari_install_component.rb +19 -0
  44. data/lib/command/ambari_install_host.rb +19 -0
  45. data/lib/command/ambari_install_host_component.rb +19 -0
  46. data/lib/command/ambari_install_host_components.rb +19 -0
  47. data/lib/command/ambari_install_service_components.rb +19 -0
  48. data/lib/command/ambari_service_add.rb +27 -0
  49. data/lib/command/ambari_service_component_add.rb +21 -0
  50. data/lib/command/ambari_service_component_delete.rb +21 -0
  51. data/lib/command/ambari_service_component_detach.rb +21 -0
  52. data/lib/command/ambari_service_component_info.rb +29 -0
  53. data/lib/command/ambari_service_conf_apply.rb +31 -0
  54. data/lib/command/ambari_service_conf_ls.rb +30 -0
  55. data/lib/command/ambari_service_delete.rb +21 -0
  56. data/lib/command/ambari_service_info.rb +20 -0
  57. data/lib/command/ambari_service_list.rb +21 -0
  58. data/lib/command/ambari_start_cluster.rb +19 -0
  59. data/lib/command/ambari_start_component.rb +19 -0
  60. data/lib/command/ambari_start_host.rb +19 -0
  61. data/lib/command/ambari_start_host_component.rb +19 -0
  62. data/lib/command/ambari_start_host_components.rb +19 -0
  63. data/lib/command/ambari_start_service_components.rb +19 -0
  64. data/lib/command/ambari_stop_cluster.rb +19 -0
  65. data/lib/command/ambari_stop_component.rb +19 -0
  66. data/lib/command/ambari_stop_host.rb +19 -0
  67. data/lib/command/ambari_stop_host_component.rb +19 -0
  68. data/lib/command/ambari_stop_host_components.rb +19 -0
  69. data/lib/command/ambari_stop_service_components.rb +19 -0
  70. data/lib/command/basic_command.rb +44 -0
  71. data/lib/command/cluster_create.rb +50 -0
  72. data/lib/command/cluster_delete.rb +30 -0
  73. data/lib/command/cluster_info.rb +30 -0
  74. data/lib/command/cluster_ls.rb +30 -0
  75. data/lib/command/crowbar_cluster_allocate.rb +42 -0
  76. data/lib/command/crowbar_command.rb +30 -0
  77. data/lib/command/crowbar_get_barclamps_list.rb +30 -0
  78. data/lib/command/crowbar_node_command.rb +21 -0
  79. data/lib/command/crowbar_node_list.rb +40 -0
  80. data/lib/command/crowbar_vcluster_command.rb +20 -0
  81. data/lib/command/filter.rb +15 -0
  82. data/lib/command/node_destroy.rb +58 -0
  83. data/lib/command/node_detach.rb +44 -0
  84. data/lib/command/node_info.rb +27 -0
  85. data/lib/command/node_install.rb +46 -0
  86. data/lib/command/node_reinstall.rb +44 -0
  87. data/lib/command/state_filter.rb +16 -0
  88. data/lib/common.rb +11 -0
  89. data/lib/common/cb-lib-node-erase-hard-disk.sh +29 -0
  90. data/lib/common/cloudbox_exceptions.rb +631 -0
  91. data/lib/common/cloudbox_logger.rb +81 -0
  92. data/lib/common/cloudbox_logger_mock.rb +43 -0
  93. data/lib/common/color.rb +267 -0
  94. data/lib/common/config_properties.rb +2027 -0
  95. data/lib/common/services_description.rb +192 -0
  96. data/lib/exec.rb +35 -0
  97. data/lib/exec/check_parameter.rb +208 -0
  98. data/lib/exec/cluster_allocate.rb +163 -0
  99. data/lib/exec/cluster_create.rb +99 -0
  100. data/lib/exec/cluster_delete.rb +38 -0
  101. data/lib/exec/cluster_desallocate.rb +37 -0
  102. data/lib/exec/cluster_info.rb +177 -0
  103. data/lib/exec/cluster_ls.rb +150 -0
  104. data/lib/exec/command_option.rb +222 -0
  105. data/lib/exec/executable_command.rb +194 -0
  106. data/lib/exec/node_destroy.rb +101 -0
  107. data/lib/exec/node_detach.rb +98 -0
  108. data/lib/exec/node_info.rb +280 -0
  109. data/lib/exec/node_install.rb +234 -0
  110. data/lib/exec/node_ls.rb +160 -0
  111. data/lib/exec/service_add.rb +224 -0
  112. data/lib/exec/service_component_add.rb +39 -0
  113. data/lib/exec/service_component_delete.rb +37 -0
  114. data/lib/exec/service_component_detach.rb +37 -0
  115. data/lib/exec/service_conf_apply.rb +57 -0
  116. data/lib/exec/service_conf_create.rb +80 -0
  117. data/lib/exec/service_conf_get.rb +165 -0
  118. data/lib/exec/service_conf_ls.rb +103 -0
  119. data/lib/exec/service_follow_request.rb +49 -0
  120. data/lib/exec/service_info.rb +346 -0
  121. data/lib/exec/service_install.rb +87 -0
  122. data/lib/exec/service_ls.rb +124 -0
  123. data/lib/exec/service_start.rb +110 -0
  124. data/lib/exec/service_stop.rb +112 -0
  125. data/lib/receiver.rb +14 -0
  126. data/lib/receiver/ambari_receiver.rb +812 -0
  127. data/lib/receiver/ambari_rest_api_connector.rb +599 -0
  128. data/lib/receiver/basic_receiver.rb +28 -0
  129. data/lib/receiver/connector.rb +28 -0
  130. data/lib/receiver/crowbar_receiver.rb +588 -0
  131. data/lib/receiver/crowbar_rest_api_connector.rb +518 -0
  132. data/lib/receiver/crowbar_shell_api.rb +643 -0
  133. data/lib/receiver/rest_api_connector.rb +275 -0
  134. data/resources/ambari-configurations/HBASE/default_hbase-site +33 -0
  135. data/resources/ambari-configurations/HDFS/default_hdfs-site +49 -0
  136. data/resources/ambari-configurations/HIVE/default_hive-site +33 -0
  137. data/resources/ambari-configurations/MAPREDUCE/default_mapred-site +72 -0
  138. data/resources/ambari-configurations/OOZIE/default_oozie-site +28 -0
  139. data/resources/ambari-configurations/WEBHCAT/default_webhcat-site +18 -0
  140. data/resources/ambari-configurations/ZOOKEEPER/default_zookeeper-site +8 -0
  141. data/resources/ambari-configurations/default_core-site +22 -0
  142. data/resources/ambari-configurations/default_global +141 -0
  143. data/resources/cloudbox-server.conf +10 -0
  144. data/spec/common/services_description.rb +130 -0
  145. data/spec/exec/check_parameter.rb +152 -0
  146. data/spec/exec/command_option_spec.rb +97 -0
  147. metadata +328 -0
@@ -0,0 +1,21 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tmarmin (INGENSI)
3
+
4
+ require 'command/ambari_cluster_service_command'
5
+ require 'receiver/ambari_receiver'
6
+
7
+ module Command
8
+ # # Command used to get information on a cluster's ambari service.
9
+ # @author tmarmin
10
+ class AmbariServiceDelete < AmbariClusterServiceCommand
11
+
12
+ public
13
+ # The execution of the command.
14
+ # @raise @todo traiter les exceptions
15
+ # @author tmarmin
16
+ def exec()
17
+ @receiver.delete_service(@cluster_name, @service_name)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_service_command'
5
+
6
+ module Command
7
+ # # Command used to get information on a cluster's ambari service.
8
+ # @author tnoguer
9
+ class AmbariServiceInfo < AmbariClusterServiceCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @return [Hash] The pieces of information of the service.
14
+ # @author tnoguer
15
+ def exec()
16
+ return receiver.show_service(@cluster_name, @service_name)
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_command'
5
+
6
+ module Command
7
+ # Command used to get the list of the ambari services of a cluster.
8
+ # @author tnoguer
9
+ class AmbariServiceList < AmbariClusterCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @param cluster_name The name of the cluster.
14
+ # @return [Hash] The list of services.
15
+ # @author tnoguer
16
+ def exec()
17
+ return receiver.show_cluster_services(@cluster_name)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_command'
5
+
6
+ module Command
7
+ # Command used to start very host component of a cluster.
8
+ # @author tnoguer
9
+ class AmbariStartCluster < AmbariClusterCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.start_cluster(@cluster_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_command'
5
+
6
+ module Command
7
+ # Command used to start a type of component.
8
+ # @author tnoguer
9
+ class AmbariStartComponent < AmbariClusterComponentCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.start_component(@cluster_name, @component_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_host_command'
5
+
6
+ module Command
7
+ # Command used to start all components of an host.
8
+ # @author tnoguer
9
+ class AmbariStartHost < AmbariClusterHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.start_host(@cluster_name, @host_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_host_command'
5
+
6
+ module Command
7
+ # Command used to start an ambari host component.
8
+ # @author tnoguer
9
+ class AmbariStartHostComponent < AmbariClusterComponentHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.start_host_component(@cluster_name, @host_name, @component_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_host_command'
5
+
6
+ module Command
7
+ # Command used to start the host component of an host for a specific service.
8
+ # @author tnoguer
9
+ class AmbariStartHostComponents < AmbariClusterComponentHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.start_host_components(@cluster_name, @service_name, @host_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_service_command'
5
+
6
+ module Command
7
+ # Command used to start all components of an ambari service.
8
+ # @author tnoguer
9
+ class AmbariStartServiceComponents < AmbariClusterServiceCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.start_service(@cluster_name, @service_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_command'
5
+
6
+ module Command
7
+ # Command used to stop very host component of a cluster.
8
+ # @author tnoguer
9
+ class AmbariStopCluster < AmbariClusterCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.stop_cluster(@cluster_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_command'
5
+
6
+ module Command
7
+ # Command used to stop a type of component.
8
+ # @author tnoguer
9
+ class AmbariStopComponent < AmbariClusterComponentCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.stop_component(@cluster_name, @component_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_host_command'
5
+
6
+ module Command
7
+ # Command used to stop all components of an host.
8
+ # @author tnoguer
9
+ class AmbariStopHost < AmbariClusterHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.stop_host(@cluster_name, @host_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_host_command'
5
+
6
+ module Command
7
+ # Command used to stop an ambari host component.
8
+ # @author tnoguer
9
+ class AmbariStopHostComponent < AmbariClusterComponentHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.stop_host_component(@cluster_name, @host_name, @component_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_service_host_command'
5
+
6
+ module Command
7
+ # Command used to stop the host component of an host for a specific service.
8
+ # @author tnoguer
9
+ class AmbariStopHostComponents < AmbariClusterServiceHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.stop_host_components(@cluster_name, @service_name, @host_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/ambari_cluster_service_command'
5
+
6
+ module Command
7
+ # Command used to stop all components of an ambari service.
8
+ # @author tnoguer
9
+ class AmbariStopServiceComponents < AmbariClusterServiceCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.stop_service(@cluster_name, @service_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ # This file is part of cloudbox-service project
2
+ # @author tmarmin (INGENSI)
3
+
4
+ require 'common/cloudbox_logger'
5
+ require 'common/cloudbox_logger_mock'
6
+
7
+ module Command
8
+ # @abstract Subclass and override {#exec} to implement.
9
+ # @author tnoguer
10
+ class BasicCommand
11
+
12
+ protected
13
+ # This attribute is the receiver, which will receive executed command.
14
+ attr_accessor :receiver
15
+ # This attribute is the logger.
16
+ attr_accessor :logger
17
+
18
+ protected
19
+ def receiver=(value)
20
+ raise ArgumentError.new("receiver param has to be an implementation of BasicReceiver") if !value.is_a?(Receiver::BasicReceiver)
21
+ @receiver=value
22
+ end
23
+
24
+ private
25
+ # Default constructor.
26
+ # @param [Receiver::BasicReceiver] receiver The receiver.
27
+ # @raise [ArgumentError] if the type of receiver is not correct.
28
+ def initialize(receiver, logger = nil)
29
+ @receiver = receiver
30
+ @logger = logger
31
+ @logger = Common::CloudboxLoggerMock.new if @logger.nil?
32
+ @logger.info("Command::BasicCommand initialize the parameters...")
33
+ end
34
+
35
+ public
36
+ # The execution of the command.
37
+ # @note This method has to be overrided by the inheriting class.
38
+ # @raise [NotImplementedError] When the method is not overrided by the inheriting class.
39
+ # @author tnoguer
40
+ def exec()
41
+ raise NotImplementedError
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,50 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author mbretaud (INGENSI)
3
+
4
+ require 'command/crowbar_node_command'
5
+
6
+ module Command
7
+ # Allows to create a cluster
8
+ class ClusterCreate < CrowbarNodeCommand
9
+
10
+ attr_reader :cluster_name
11
+ attr_reader :network_address
12
+ attr_reader :mask
13
+ attr_reader :cpu_weight
14
+ attr_reader :ram
15
+ attr_reader :description
16
+ attr_reader :vlan_id
17
+
18
+ public
19
+ # Default constructor.
20
+ # @param cluster_name [String] The cluster name.
21
+ # @param network_address [String] The network address.
22
+ # @param network_mask [String] The network mask.
23
+ # @param cpu_weight [Integer] The CPU weight.
24
+ # @param ram [String] The ram to allocate.
25
+ # @param vlan_id [Integer] The VLAN id.
26
+ # @param description [String] The cluster description.
27
+ # @author mbretaud
28
+ def initialize(cluster_name, network_address, network_mask, cpu_weight = nil, ram = nil, vlan_id = nil, description = nil)
29
+ super()
30
+ @logger.info("Command::ClusterCreate initialize the parameters...")
31
+ @cluster_name = cluster_name
32
+ @network_address = network_address
33
+ @cpu_weight = cpu_weight
34
+ @ram = ram
35
+ @description = description
36
+ @vlan_id = vlan_id
37
+ @mask = network_mask
38
+ end
39
+
40
+ # The method allow to create cluster
41
+ # @author mbretaud
42
+ def exec()
43
+ output = ""
44
+
45
+ output += @receiver.crowbar_create_cluster(@cluster_name, @network_address, @mask, @cpu_weight, @ram, @vlan_id, @description)
46
+
47
+ return output
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,30 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author mbretaud (INGENSI)
3
+
4
+ require 'command/crowbar_vcluster_command'
5
+
6
+ #
7
+ # @author mbretaud
8
+ module Command
9
+ # Allows to delete a cluster
10
+ class ClusterDelete < CrowbarVclusterCommand
11
+
12
+ attr_reader :vcluster_name
13
+
14
+ public
15
+ # Default constructor.
16
+ # @param vcluster_name [String] The cluster name.
17
+ # @author mbretaud
18
+ def initialize(vcluster_name)
19
+ super()
20
+ @logger.info("Command::ClusterDelete initialize the parameters...")
21
+ @cluster_name = cluster_name
22
+ end
23
+
24
+
25
+ # method who call crowbar_receiver for delete a cluster
26
+ def exec()
27
+ return @receiver.crowbar_vcluster_delete(@cluster_name)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author mbretaud (INGENSI)
3
+
4
+ require 'command/crowbar_vcluster_command'
5
+
6
+ #
7
+ # @author mbretaud
8
+ module Command
9
+ # Display a information's cluster
10
+ class ClusterInfo < CrowbarVclusterCommand
11
+
12
+ public
13
+ #
14
+ # @param vcluster_name [String] The cluster name.
15
+ # @param proposal_name [String] The proposal name.
16
+ # @author mbretaud
17
+ def initialize(vcluster_name, proposal_name)
18
+ super()
19
+ @logger.info("Command::ClusterInfo initialize the parameters...")
20
+ @vcluster_name = vcluster_name
21
+ @proposal_name = proposal_name
22
+ end
23
+
24
+
25
+ # Method who call crowbar_receiver for display an information's cluster
26
+ def exec()
27
+ return @receiver.crowbar_vcluster_info(@vcluster_name, @proposal_name)
28
+ end
29
+ end
30
+ end