manageiq-appliance_console 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab0a7cbd85921dd1332fbaa9b01329e3bc2a5197be9e12ea928f9737ee499003
4
- data.tar.gz: 9a8fd3d5d58239eec4c21ce7efb4ecb2546215b7e0f66ec2a14c2f6fe81e66b6
3
+ metadata.gz: 9ed41ad025c3f0f288361b95b827806b630519a9d7d14dbb708fbb6737754a9f
4
+ data.tar.gz: 7a12bc4a13675a1350f8df4b9ded7500da77b03638ba3412d64857e958aa783b
5
5
  SHA512:
6
- metadata.gz: ed57328bff42362e4a51920baa3268ed3a2d8d6e16a8b0da493eec419c65e05763ba820a0e195b61279bc521f4c012d0a5246fb9ebeacc5354543d89136eb8bd
7
- data.tar.gz: 80e710fa562abca7f2a935b9828ebc91841730f9eac789214a35bc64439e011b07918cfea629649d11519eee676bd6264b404e6762b7ce3d6bbbaf94d372f824
6
+ metadata.gz: 36860fdccb66a1e153a848e2c5e579bfcd802685e25fd32bdf13cbd1c2a78b3723b59733267cb4b38a5f86e954ae4bcb8bf182c7de675daf92b2ba0f44c185c1
7
+ data.tar.gz: 361a36c04caece0df425490174477a2a70af553cf56ebee7764656f561a99577adc0be7cdf63f09b49818bdd0949400442c0da5b9a1ba846a0e9fff4ccb62ff7
@@ -30,6 +30,6 @@ module ApplianceConsole
30
30
  self.executed_periodic_action = periodic.activate
31
31
  executed_hourly_action || executed_periodic_action
32
32
  end
33
- end # class DatabaseMaintenance < DatabaseConfiguration
33
+ end # class DatabaseMaintenance
34
34
  end # module ApplianceConsole
35
35
  end
@@ -53,6 +53,6 @@ module ApplianceConsole
53
53
  f.write("exit 0\n")
54
54
  end
55
55
  end
56
- end # class DatabaseMaintenance < DatabaseConfiguration
56
+ end # class DatabaseMaintenanceHourly
57
57
  end # module ApplianceConsole
58
58
  end
@@ -142,6 +142,6 @@ Replication Server Configuration
142
142
  :password => database_password
143
143
  }
144
144
  end
145
- end # class DatabaseReplication < DatabaseConfiguration
145
+ end # class DatabaseReplication
146
146
  end # module ApplianceConsole
147
147
  end
@@ -112,6 +112,6 @@ Date and Time Configuration
112
112
  logger.error("Failed to apply time configuration: #{e.message}")
113
113
  false
114
114
  end
115
- end # class TimezoneConfiguration
115
+ end # class DateTimeConfiguration
116
116
  end # module ApplianceConsole
117
117
  end
@@ -6,7 +6,7 @@ require "linux_admin"
6
6
  module ManageIQ
7
7
  module ApplianceConsole
8
8
  class InternalDatabaseConfiguration < DatabaseConfiguration
9
- attr_accessor :disk, :ssl, :run_as_evm_server
9
+ attr_accessor :disk, :run_as_evm_server
10
10
 
11
11
  DEDICATED_DB_SHARED_BUFFERS = "'1GB'".freeze
12
12
  SHARED_DB_SHARED_BUFFERS = "'128MB'".freeze
@@ -88,6 +88,7 @@ module ApplianceConsole
88
88
  log_and_feedback(__method__) do
89
89
  PostgresAdmin.prep_data_directory
90
90
  run_initdb
91
+ configure_ssl
91
92
  relabel_postgresql_dir
92
93
  configure_postgres
93
94
  start_postgres
@@ -98,10 +99,8 @@ module ApplianceConsole
98
99
  end
99
100
 
100
101
  def configure_postgres
101
- self.ssl = File.exist?(PostgresAdmin.certificate_location.join("postgres.key"))
102
-
103
102
  copy_template "postgresql.conf"
104
- copy_template "pg_hba.conf.erb"
103
+ copy_template "pg_hba.conf"
105
104
  copy_template "pg_ident.conf"
106
105
  end
107
106
 
@@ -115,14 +114,8 @@ module ApplianceConsole
115
114
  PostgresAdmin.mount_point
116
115
  end
117
116
 
118
- def copy_template(src, src_dir = self.class.postgresql_template, dest_dir = PostgresAdmin.data_directory)
119
- full_src = src_dir.join(src)
120
- if src.include?(".erb")
121
- full_dest = dest_dir.join(src.gsub(".erb", ""))
122
- File.open(full_dest, "w") { |f| f.puts ERB.new(File.read(full_src), nil, '-').result(binding) }
123
- else
124
- FileUtils.cp full_src, dest_dir
125
- end
117
+ def copy_template(src)
118
+ FileUtils.cp(self.class.postgresql_template.join(src), PostgresAdmin.data_directory)
126
119
  end
127
120
 
128
121
  def pg_mount_point?
@@ -175,13 +168,21 @@ module ApplianceConsole
175
168
 
176
169
  def apply_initial_configuration
177
170
  shared_buffers = run_as_evm_server ? SHARED_DB_SHARED_BUFFERS : DEDICATED_DB_SHARED_BUFFERS
178
- with_pg_connection do |conn|
179
- conn.exec("ALTER SYSTEM SET ssl TO on") if ssl
180
- conn.exec("ALTER SYSTEM SET shared_buffers TO #{shared_buffers}")
181
- end
171
+ with_pg_connection { |conn| conn.exec("ALTER SYSTEM SET shared_buffers TO #{shared_buffers}") }
182
172
 
183
173
  restart_postgres
184
174
  end
175
+
176
+ def configure_ssl
177
+ cert_file = self.class.postgres_dir.join("server.crt").to_s
178
+ key_file = self.class.postgres_dir.join("server.key").to_s
179
+ AwesomeSpawn.run!("/usr/bin/generate_miq_server_cert.sh", :env => {"NEW_CERT_FILE" => cert_file, "NEW_KEY_FILE" => key_file})
180
+
181
+ FileUtils.chown("postgres", "postgres", cert_file)
182
+ FileUtils.chown("postgres", "postgres", key_file)
183
+ FileUtils.chmod(0644, cert_file)
184
+ FileUtils.chmod(0600, key_file)
185
+ end
185
186
  end
186
187
  end
187
188
  end
@@ -41,10 +41,15 @@ module ApplianceConsole
41
41
  private
42
42
 
43
43
  def create_partition_to_fill_disk
44
- disk.create_partition_table
45
- AwesomeSpawn.run!("parted -s #{disk.path} mkpart primary 0% 100%")
46
-
44
+ # Check if you need to create a GPT part table or a MSDOS one in base of
45
+ # max size of partition table
46
+ max_msdos_ptable_size = 2.terabyte
47
47
  self.disk = LinuxAdmin::Disk.local.find { |d| d.path == disk.path }
48
+
49
+ partition_type = disk.size >= max_msdos_ptable_size ? 'gpt' : 'msdos'
50
+ disk.create_partition_table(partition_type)
51
+
52
+ AwesomeSpawn.run!("parted -s #{disk.path} mkpart primary 0% 100%")
48
53
  @partition = disk.partitions.first
49
54
  end
50
55
 
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module ApplianceConsole
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-appliance_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-11 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord