Class: Bixby::Provision::NTP

Inherits:
Base
  • Object
show all
Defined in:
lib/bixby/provision/dsl/ntp.rb

Constant Summary collapse

EXPORTS =
[]
DEFAULT_NTP_POOL =
"ntp.ubuntu.com"

Constants inherited from Base

Base::PATH

Instance Attribute Summary

Attributes inherited from Base

#manifest, #proxy

Instance Method Summary collapse

Methods inherited from Base

#get_gid, #get_group, #get_uid, #get_user, #tap, #tempfile

Methods included from Util::File

#chmod, #chown, #sha256sum, #which

Constructor Details

#initialize(*args) ⇒ NTP

Returns a new instance of NTP.



11
12
13
14
15
16
17
18
# File 'lib/bixby/provision/dsl/ntp.rb', line 11

def initialize(*args)
  super
  @service = if ubuntu? then
      "ntp"
    elsif centos? or amazon? then
      "ntpd"
    end
end

Instance Method Details

#set(server = DEFAULT_NTP_POOL) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/bixby/provision/dsl/ntp.rb', line 20

def set(server=DEFAULT_NTP_POOL)
  logger.info "ntp.set using #{server}"
  sys.package "ntpdate"
  stop
  logged_sudo("ntpdate #{server}", :env => { "PATH" => PATH } )
  start
end

#startObject



28
29
30
# File 'lib/bixby/provision/dsl/ntp.rb', line 28

def start
  service.start @service
end

#stopObject



32
33
34
# File 'lib/bixby/provision/dsl/ntp.rb', line 32

def stop
  service.stop @service
end