Class: ConfCtl::Generation::Host
- Inherits:
-
Object
- Object
- ConfCtl::Generation::Host
- Defined in:
- lib/confctl/generation/host.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#toplevel ⇒ Object
readonly
Returns the value of attribute toplevel.
Instance Method Summary collapse
- #approx_name ⇒ Object
- #destroy ⇒ Object
-
#initialize(host, profile, id, toplevel, date, current: false, mc: nil) ⇒ Host
constructor
A new instance of Host.
Constructor Details
#initialize(host, profile, id, toplevel, date, current: false, mc: nil) ⇒ Host
Returns a new instance of Host.
11 12 13 14 15 16 17 18 19 |
# File 'lib/confctl/generation/host.rb', line 11 def initialize(host, profile, id, toplevel, date, current: false, mc: nil) @host = host @profile = profile @id = id @toplevel = toplevel @date = date @current = current @mc = mc end |
Instance Attribute Details
#current ⇒ Object (readonly)
Returns the value of attribute current.
3 4 5 |
# File 'lib/confctl/generation/host.rb', line 3 def current @current end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
3 4 5 |
# File 'lib/confctl/generation/host.rb', line 3 def date @date end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/confctl/generation/host.rb', line 3 def host @host end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/confctl/generation/host.rb', line 3 def id @id end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
3 4 5 |
# File 'lib/confctl/generation/host.rb', line 3 def profile @profile end |
#toplevel ⇒ Object (readonly)
Returns the value of attribute toplevel.
3 4 5 |
# File 'lib/confctl/generation/host.rb', line 3 def toplevel @toplevel end |
Instance Method Details
#approx_name ⇒ Object
21 22 23 |
# File 'lib/confctl/generation/host.rb', line 21 def approx_name @approx_name ||= date.strftime('%Y-%m-%d--%H-%M-%S') end |
#destroy ⇒ Object
25 26 27 28 29 |
# File 'lib/confctl/generation/host.rb', line 25 def destroy raise 'machine control not available' if mc.nil? mc.execute('nix-env', '-p', profile, '--delete-generations', id.to_s) end |