Skip to content

Commit

Permalink
Remove Timezone and Date and Time configuration
Browse files Browse the repository at this point in the history
Both of these can be done using the Cockpit UI
https://bugzilla.redhat.com/show_bug.cgi?id=1745895
  • Loading branch information
bdunne committed Oct 10, 2019
1 parent 8665f85 commit 79360a8
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 616 deletions.
24 changes: 0 additions & 24 deletions bin/appliance_console
Original file line number Diff line number Diff line change
Expand Up @@ -296,30 +296,6 @@ Static Network Configuration
end
end

when I18n.t("advanced_settings.timezone")
say("#{selection}\n\n")
timezone_config = ManageIQ::ApplianceConsole::TimezoneConfiguration.new(timezone)
if timezone_config.ask_questions && timezone_config.activate
say("Timezone configured")
press_any_key
else
say("Timezone not configured")
press_any_key
raise MiqSignalError
end

when I18n.t("advanced_settings.datetime")
say("#{selection}\n\n")
date_time_config = ManageIQ::ApplianceConsole::DateTimeConfiguration.new
if date_time_config.ask_questions && date_time_config.activate
say("Date and time configured")
press_any_key
else
say("Date and time not configured")
press_any_key
raise MiqSignalError
end

when I18n.t("advanced_settings.httpdauth")
say("#{selection}\n\n")

Expand Down
2 changes: 0 additions & 2 deletions lib/manageiq-appliance_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def self.logger=(logger)
require 'manageiq/appliance_console/database_replication'
require 'manageiq/appliance_console/database_replication_primary'
require 'manageiq/appliance_console/database_replication_standby'
require 'manageiq/appliance_console/date_time_configuration'
require 'manageiq/appliance_console/external_auth_options'
require 'manageiq/appliance_console/external_database_configuration'
require 'manageiq/appliance_console/external_httpd_authentication'
Expand All @@ -46,5 +45,4 @@ def self.logger=(logger)
require 'manageiq/appliance_console/principal'
require 'manageiq/appliance_console/scap'
require 'manageiq/appliance_console/temp_storage_configuration'
require 'manageiq/appliance_console/timezone_configuration'
require 'manageiq/appliance_console/utilities'
44 changes: 1 addition & 43 deletions lib/manageiq/appliance_console/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ def log_disk?
options[:logdisk]
end

def time_zone?
options[:timezone]
end

def date_time?
options[:datetime]
end

def extauth_opts?
options[:extauth_opts]
end
Expand Down Expand Up @@ -141,8 +133,6 @@ def parse(args)
opt :ipadomain, "IPA Server domain (optional)", :type => :string
opt :iparealm, "IPA Server realm (optional)", :type => :string
opt :ca, "CA name used for certmonger", :type => :string, :default => "ipa"
opt :timezone, "Time zone", :type => :string
opt :datetime, "Date and time, in YYYY-MM-DDTHH:MM:SS (ISO8601) format", :type => :string
opt :http_cert, "install certs for http server", :type => :boolean
opt :extauth_opts, "External Authentication Options", :type => :string
opt :server, "{start|stop|restart} actions on evmserverd Server", :type => :string
Expand All @@ -158,7 +148,7 @@ def region_number_required?
def run
Optimist.educate unless set_host? || key? || database? || tmp_disk? || log_disk? ||
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
time_zone? || date_time? || set_server_state? || set_replication?
set_server_state? || set_replication?
if set_host?
system_hosts = LinuxAdmin::Hosts.new
system_hosts.hostname = options[:host]
Expand All @@ -169,8 +159,6 @@ def run
create_key if key?
set_db if database?
set_replication if set_replication?
set_time_zone if time_zone?
set_date_time if date_time?
config_tmp_disk if tmp_disk?
config_log_disk if log_disk?
uninstall_ipa if uninstall_ipa?
Expand Down Expand Up @@ -266,36 +254,6 @@ def set_replication
db_replication.activate
end

def set_time_zone
timezone_config = ManageIQ::ApplianceConsole::TimezoneConfiguration.new(options[:timezone])
timezone_config.new_timezone = options[:timezone]
if timezone_config.activate
say("Timezone configured")
else
say("Timezone not configured")
end
end

def set_date_time
date_time_config = ManageIQ::ApplianceConsole::DateTimeConfiguration.new
unless options[:datetime] == "auto"
date_time_config.manual_time_sync = true
date_time_config.new_date, date_time_config.new_time = options[:datetime].split("T")
return unless date_time_valid?(date_time_config)
end
date_time_config.activate
end

def date_time_valid?(date_time_config)
unless ManageIQ::ApplianceConsole::DateTimeConfiguration::DATE_REGEXP =~ date_time_config.new_date &&
ManageIQ::ApplianceConsole::DateTimeConfiguration::TIME_REGEXP =~ date_time_config.new_time
say("Datetime should be given in YYYY-MM-DDTHH:MM:SS format")
say("Datetime not configured")
return false
end
true
end

def key_configuration
@key_configuration ||= KeyConfiguration.new(
:action => options[:fetch_key] ? :fetch : :create,
Expand Down
117 changes: 0 additions & 117 deletions lib/manageiq/appliance_console/date_time_configuration.rb

This file was deleted.

58 changes: 0 additions & 58 deletions lib/manageiq/appliance_console/timezone_configuration.rb

This file was deleted.

4 changes: 0 additions & 4 deletions locales/appliance/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ en:
advanced_settings:
menu_order:
- networking
- timezone
- datetime
- dbbackup
- dbdump
- dbrestore
Expand All @@ -24,8 +22,6 @@ en:
- summary
- quit
networking: Configure Network
timezone: Set Timezone
datetime: Set Date and Time
dbbackup: Create Database Backup
dbdump: Create Database Dump
dbrestore: Restore Database From Backup
Expand Down
2 changes: 0 additions & 2 deletions locales/container/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ en:
name: ManageIQ
advanced_settings:
menu_order:
- timezone
- dbrestore
- db_config
- db_replication
Expand All @@ -15,7 +14,6 @@ en:
- shutdown
- summary
- quit
timezone: Set Timezone
dbrestore: Restore Database From Backup
db_config: Configure Database
db_replication: Configure Database Replication
Expand Down
41 changes: 0 additions & 41 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -651,47 +651,6 @@
end
end

context "#set_time_zone" do
let(:timezone) { double("time zone") }
it "should set timezone" do
expect(subject).to receive(:say)
expect(ManageIQ::ApplianceConsole::TimezoneConfiguration).to receive(:new).with("Europe/Madrid").and_return(timezone)
expect(timezone).to receive(:new_timezone=).with("Europe/Madrid")
expect(timezone).to receive(:activate).and_return(true)
subject.parse(%w(--timezone Europe/Madrid)).run
end

it "should not set timezone" do
expect(subject).to receive(:say)
expect(ManageIQ::ApplianceConsole::TimezoneConfiguration).to receive(:new).with("ss/dd").and_return(timezone)
expect(timezone).to receive(:new_timezone=).with("ss/dd")
expect(timezone).to receive(:activate).and_return(false)
subject.parse(%w(--timezone ss/dd)).run
end
end

context "#set_date_time" do
let(:datetime) { ManageIQ::ApplianceConsole::DateTimeConfiguration.new }

before do
expect(ManageIQ::ApplianceConsole::DateTimeConfiguration).to receive(:new).and_return(datetime)
end

it "should set auto sync when datetime option is auto" do
expect(datetime).to receive(:activate).and_return(true)
subject.parse(%w(--datetime auto)).run
expect(datetime.manual_time_sync).to be_falsy
end

it "should set date time according to given date time" do
expect(datetime).to receive(:activate).and_return(true)
subject.parse(%w(--datetime 2017-06-08T09:00:00)).run
expect(datetime.manual_time_sync).to be_truthy
expect(datetime.new_date).to eq("2017-06-08")
expect(datetime.new_time).to eq("09:00:00")
end
end

context "#disk_from_string" do
before do
allow(LinuxAdmin::Disk).to receive_messages(:local => [
Expand Down
Loading

0 comments on commit 79360a8

Please sign in to comment.