Module: Percheron::Unit::ImageHelper
- Included in:
- Percheron::Unit
- Defined in:
- lib/percheron/unit/image_helper.rb
Instance Method Summary collapse
- #image_exists? ⇒ Boolean
- #image_name ⇒ Object
- #image_repo ⇒ Object
- #image_size ⇒ Object
- #image_version ⇒ Object
Instance Method Details
#image_exists? ⇒ Boolean
28 29 30 |
# File 'lib/percheron/unit/image_helper.rb', line 28 def image_exists? image.nil? ? false : true end |
#image_name ⇒ Object
4 5 6 |
# File 'lib/percheron/unit/image_helper.rb', line 4 def image_name '%s:%s' % [ image_repo, image_version.to_s ] if image_repo && image_version end |
#image_repo ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/percheron/unit/image_helper.rb', line 8 def image_repo if !buildable? unit_config.docker_image.split(':')[0] elsif pseudo? pseudo_full_name else full_name end end |
#image_size ⇒ Object
32 33 34 |
# File 'lib/percheron/unit/image_helper.rb', line 32 def image_size image.nil? ? nil : '%s MB' % [ image.info['VirtualSize'] / 1_048_576 ] end |
#image_version ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/percheron/unit/image_helper.rb', line 18 def image_version if buildable? unit_config.version elsif !unit_config.docker_image.nil? unit_config.docker_image.split(':')[1] || 'latest' else fail Errors::UnitInvalid, 'Cannot determine image version' end end |