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,26 @@
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
+ # Class for all ambari command.
8
+ # @abstract Subclass and override {#exec} to implement
9
+ # @author tnoguer
10
+ class AmbariClusterServiceHostCommand < AmbariClusterServiceCommand
11
+
12
+ public
13
+ # The cluster name
14
+ attr_accessor :host_name
15
+
16
+ private
17
+ # Default constructor.
18
+ # @author tnoguer
19
+ def initialize(cluster_name, service_name, host_name)
20
+ super(cluster_name, service_name)
21
+ @logger.info("Command::AmbariClusterServiceHostCommand initialize the parameters...")
22
+ @host_name = host_name
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tnoguer (INGENSI)
3
+
4
+ require 'command/basic_command'
5
+
6
+ module Command
7
+ # Class for all ambari command.
8
+ # @abstract Subclass and override {#exec} to implement
9
+ # @author tnoguer
10
+ class AmbariCommand < BasicCommand
11
+
12
+ private
13
+ # Default constructor.
14
+ # @author tnoguer
15
+ def initialize
16
+ super(Receiver::AmbariReceiver.new())
17
+ @logger.info("Command::AmbariCommand initialize the parameters...")
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,39 @@
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 configurations of an ambari cluster.
8
+ # @author aboudot
9
+ class AmbariCreateClusterConfiguration < AmbariClusterCommand
10
+
11
+ private
12
+ attr_accessor :type
13
+ attr_accessor :tag
14
+ attr_accessor :properties
15
+ attr_accessor :apply
16
+
17
+ public
18
+ # The execution of the command.
19
+ # @author aboudot
20
+ def initialize(cluster_name, type, tag, properties, apply=false)
21
+ super(cluster_name)
22
+ @logger.info("Command::AmbariCreateClusterConfiguration initialize the parameters...")
23
+ @type=type
24
+ @tag=tag
25
+ @properties = properties
26
+ @apply=apply
27
+
28
+ end
29
+ def exec()
30
+ if apply
31
+ @receiver.create_apply_configuration(@cluster_name ,@type , @tag , @properties)
32
+ else
33
+ @receiver.create_configuration(@cluster_name ,@type , @tag , @properties)
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,29 @@
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 configurations of an ambari cluster.
8
+ # @author aboudot
9
+ class AmbariGetClusterConfiguration < AmbariClusterCommand
10
+
11
+ private
12
+ attr_accessor :type
13
+ attr_accessor :tag
14
+ public
15
+ # The execution of the command.
16
+ # @author aboudot
17
+ def initialize(clustername, type,tag)
18
+ super(clustername)
19
+ @logger.info("Command::AmbariGetClusterConfiguration initialize the parameters...")
20
+ @type=type
21
+ @tag=tag
22
+
23
+ end
24
+ def exec()
25
+ @receiver.get_cluster_configuration(@cluster_name ,@type , @tag )
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author mbretaud (INGENSI)
3
+
4
+ require 'command/ambari_cluster_command'
5
+
6
+ module Command
7
+ # Command used to get the hosts of a cluster.
8
+ # @author tnoguer
9
+ class AmbariHostList < AmbariClusterCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ return @receiver.get_host_list(@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_command'
5
+
6
+ module Command
7
+ # Command used to install every host component of a cluster.
8
+ # @author tnoguer
9
+ class AmbariInstallCluster < AmbariClusterCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.install_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 install a type of component.
8
+ # @author tnoguer
9
+ class AmbariInstallComponent < AmbariClusterComponentCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.install_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 install all components of an host.
8
+ # @author tnoguer
9
+ class AmbariInstallHost < AmbariClusterHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.install_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 install an ambari host component.
8
+ # @author tnoguer
9
+ class AmbariInstallHostComponent < AmbariClusterComponentHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.install_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 install the host component of an host for a specific service.
8
+ # @author tnoguer
9
+ class AmbariInstallHostComponents < AmbariClusterComponentHostCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.install_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 install all components of an ambari service.
8
+ # @author tnoguer
9
+ class AmbariInstallServiceComponents < AmbariClusterServiceCommand
10
+
11
+ public
12
+ # The execution of the command.
13
+ # @author tnoguer
14
+ def exec()
15
+ @receiver.install_service(@cluster_name, @service_name)
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,27 @@
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
+ require 'common/services_description'
7
+
8
+ include Common::ServicesDescription
9
+
10
+ module Command
11
+ # # Command used to get information on a cluster's ambari service.
12
+ # @author tmarmin
13
+ class AmbariServiceAdd < AmbariClusterServiceCommand
14
+
15
+ public
16
+ # The execution of the command.
17
+ # @raise @todo traiter les exceptions
18
+ # @author tmarmin
19
+ def exec()
20
+ @receiver.define_service(@cluster_name, @service_name)
21
+ Common::ServicesDescription.get_components(@service_name).each do |component_name|
22
+ @receiver.add_service_component(cluster_name, service_name, component_name)
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tmarmin (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_host_command'
5
+ require 'receiver/ambari_receiver'
6
+
7
+ module Command
8
+ # # Command used to add a service component into an ambari cluster.
9
+ # @author tmarmin
10
+ class AmbariServiceComponentAdd < AmbariClusterComponentHostCommand
11
+
12
+ public
13
+ # The execution of the command.
14
+ # @raise [Common::AlreadyExistsEntity] if host component already exists
15
+ # @author tmarmin
16
+ def exec()
17
+ @receiver.add_host_component(@cluster_name, @host_name, @component_name)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tmarmin (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_host_command'
5
+ require 'receiver/ambari_receiver'
6
+
7
+ module Command
8
+ # # Command used to delete a service component into an ambari cluster.
9
+ # @author tmarmin
10
+ class AmbariServiceComponentDelete < AmbariClusterComponentHostCommand
11
+
12
+ public
13
+ # The execution of the command.
14
+ # @raise @todo raise an appropriate exception if it bug
15
+ # @author tmarmin
16
+ def exec()
17
+ @receiver.delete_host_component(@cluster_name, @host_name, @component_name)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author tmarmin (INGENSI)
3
+
4
+ require 'command/ambari_cluster_component_host_command'
5
+ require 'receiver/ambari_receiver'
6
+
7
+ module Command
8
+ # # Command used to detach a service component into an ambari cluster.
9
+ # @author tmarmin
10
+ class AmbariServiceComponentDetach < AmbariClusterComponentHostCommand
11
+
12
+ public
13
+ # The execution of the command.
14
+ # @raise @todo raise an appropriate exception if it bug
15
+ # @author tmarmin
16
+ def exec()
17
+ @receiver.detach_host_component(@cluster_name, @host_name, @component_name)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,29 @@
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 AmbariServiceComponentInfo < AmbariClusterServiceCommand
10
+
11
+ public
12
+ attr_accessor :hostname
13
+ attr_accessor :cluster_name
14
+ attr_accessor :component
15
+
16
+ # The execution of the command.
17
+ # @return [Hash] The pieces of information of the service.
18
+ # @author tnoguer
19
+ def initialize (service_name,cluster_name ,component)
20
+ super(cluster_name,service_name)
21
+ @cluster_name= cluster_name
22
+ @component= component
23
+ end
24
+ def exec()
25
+ return receiver.show_service_components(@cluster_name, @service_name ,@component)
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ # This file is part oon f cloudbox-server project
2
+ # @author mbretaud (INGENSI)
3
+
4
+ require 'command/ambari_cluster_command'
5
+
6
+ #
7
+ # @author mbretaud
8
+ module Command
9
+ # Command used to apply a configuration on a ambari cluster.
10
+ # @author mbretaud
11
+ class AmbariServiceConfApply < AmbariClusterCommand
12
+
13
+ private
14
+ # Default constructor.
15
+ # @author mbretaud
16
+ def initialize(cluster_name, type_conf_name, tag_conf_name)
17
+ super(cluster_name)
18
+ @logger.info("Command::AmbariServiceConfApply initialize the parameters...")
19
+ @type_conf_name = type_conf_name
20
+ @tag_conf_name = tag_conf_name
21
+ end
22
+
23
+ public
24
+ # The execution of the command.
25
+ # @author mbretaud
26
+ def exec()
27
+ receiver.apply_configuration(@cluster_name, @type_conf_name, @tag_conf_name)
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ # This file is part of cloudbox-server project
2
+ # @author mbretaud (INGENSI)
3
+
4
+ require 'command/ambari_cluster_command'
5
+
6
+ #
7
+ # @author mbretaud
8
+ module Command
9
+ # Command used to get configuration about a ambari cluster.
10
+ # @author mbretaud
11
+ class AmbariServiceConfLs < AmbariClusterCommand
12
+
13
+ private
14
+ # Default constructor.
15
+ # @author mbretaud
16
+ def initialize(cluster_name)
17
+ super(cluster_name)
18
+ @logger.info("Command::AmbariServiceConfLs initialize the parameters...")
19
+ end
20
+
21
+ public
22
+ # The execution of the command.
23
+ # @return [Hash] The pieces of configurations of the cluster.
24
+ # @author mbretaud
25
+ def exec()
26
+ return receiver.get_cluster_configurations_list(@cluster_name)
27
+ end
28
+
29
+ end
30
+ end