Class: Leap::Platform
Class Attribute Summary collapse
-
.compatible_cli ⇒ Object
Returns the value of attribute compatible_cli.
-
.default_puppet_tags ⇒ Object
Returns the value of attribute default_puppet_tags.
-
.facts ⇒ Object
Returns the value of attribute facts.
-
.files_dir ⇒ Object
Returns the value of attribute files_dir.
-
.hiera_path ⇒ Object
Returns the value of attribute hiera_path.
-
.init_path ⇒ Object
Returns the value of attribute init_path.
-
.leap_dir ⇒ Object
Returns the value of attribute leap_dir.
-
.monitor_username ⇒ Object
Returns the value of attribute monitor_username.
-
.node_files ⇒ Object
Returns the value of attribute node_files.
-
.paths ⇒ Object
Returns the value of attribute paths.
-
.reserved_usernames ⇒ Object
Returns the value of attribute reserved_usernames.
-
.version ⇒ Object
configuration.
Class Method Summary collapse
-
.compatible_with_cli?(cli_version) ⇒ Boolean
return true if the cli_version is compatible with this platform.
- .define(&block) ⇒ Object
- .major_version ⇒ Object
- .method_missing(method, *args) ⇒ Object
-
.version_in_range?(range) ⇒ Boolean
return true if the platform version is within the specified range.
Class Attribute Details
.compatible_cli ⇒ Object
Returns the value of attribute compatible_cli.
10 11 12 |
# File 'lib/leap/platform.rb', line 10 def compatible_cli @compatible_cli end |
.default_puppet_tags ⇒ Object
Returns the value of attribute default_puppet_tags.
22 23 24 |
# File 'lib/leap/platform.rb', line 22 def @default_puppet_tags end |
.facts ⇒ Object
Returns the value of attribute facts.
11 12 13 |
# File 'lib/leap/platform.rb', line 11 def facts @facts end |
.files_dir ⇒ Object
Returns the value of attribute files_dir.
18 19 20 |
# File 'lib/leap/platform.rb', line 18 def files_dir @files_dir end |
.hiera_path ⇒ Object
Returns the value of attribute hiera_path.
17 18 19 |
# File 'lib/leap/platform.rb', line 17 def hiera_path @hiera_path end |
.init_path ⇒ Object
Returns the value of attribute init_path.
20 21 22 |
# File 'lib/leap/platform.rb', line 20 def init_path @init_path end |
.leap_dir ⇒ Object
Returns the value of attribute leap_dir.
19 20 21 |
# File 'lib/leap/platform.rb', line 19 def leap_dir @leap_dir end |
.monitor_username ⇒ Object
Returns the value of attribute monitor_username.
14 15 16 |
# File 'lib/leap/platform.rb', line 14 def monitor_username @monitor_username end |
.node_files ⇒ Object
Returns the value of attribute node_files.
13 14 15 |
# File 'lib/leap/platform.rb', line 13 def node_files @node_files end |
.paths ⇒ Object
Returns the value of attribute paths.
12 13 14 |
# File 'lib/leap/platform.rb', line 12 def paths @paths end |
.reserved_usernames ⇒ Object
Returns the value of attribute reserved_usernames.
15 16 17 |
# File 'lib/leap/platform.rb', line 15 def reserved_usernames @reserved_usernames end |
.version ⇒ Object
configuration
9 10 11 |
# File 'lib/leap/platform.rb', line 9 def version @version end |
Class Method Details
.compatible_with_cli?(cli_version) ⇒ Boolean
return true if the cli_version is compatible with this platform.
51 52 53 54 |
# File 'lib/leap/platform.rb', line 51 def compatible_with_cli?(cli_version) cli_version = Gem::Version.new(cli_version) cli_version >= @minimum_cli_version && cli_version <= @maximum_cli_version end |
.define(&block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/leap/platform.rb', line 24 def define(&block) # some defaults: @reserved_usernames = [] @hiera_path = '/etc/leap/hiera.yaml' @leap_dir = '/srv/leap' @files_dir = '/srv/leap/files' @init_path = '/srv/leap/initialized' @default_puppet_tags = [] self.instance_eval(&block) @version ||= Gem::Version.new("0.0") end |
.major_version ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/leap/platform.rb', line 68 def major_version if @version.segments.first == 0 @version.segments[0..1].join('.') else @version.segments.first end end |
.method_missing(method, *args) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/leap/platform.rb', line 76 def method_missing(method, *args) puts puts "WARNING:" puts " leap_cli is out of date and does not understand `#{method}`." puts " called from: #{caller.first}" puts " please upgrade to a newer leap_cli" end |
.version_in_range?(range) ⇒ Boolean
return true if the platform version is within the specified range.
59 60 61 62 63 64 65 66 |
# File 'lib/leap/platform.rb', line 59 def version_in_range?(range) if range.is_a? String range = range.split('..') end minimum_platform_version = Gem::Version.new(range.first) maximum_platform_version = Gem::Version.new(range.last) @version >= minimum_platform_version && @version <= maximum_platform_version end |