Class: OsCtl::Image::Operations::Repository::AddImage
- Defined in:
- lib/osctl/image/operations/repository/add_image.rb
Instance Attribute Summary collapse
- #attrs ⇒ Hash readonly
- #images ⇒ Hash<Symbol, String> readonly
- #repo_dir ⇒ String readonly
- #tags ⇒ Array<String> readonly
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(repo_dir, images, attrs, tags) ⇒ AddImage
constructor
A new instance of AddImage.
Methods inherited from Base
Constructor Details
#initialize(repo_dir, images, attrs, tags) ⇒ AddImage
Returns a new instance of AddImage.
27 28 29 30 31 32 33 |
# File 'lib/osctl/image/operations/repository/add_image.rb', line 27 def initialize(repo_dir, images, attrs, ) super() @repo_dir = repo_dir @images = images @attrs = attrs @tags = end |
Instance Attribute Details
#attrs ⇒ Hash (readonly)
13 14 15 |
# File 'lib/osctl/image/operations/repository/add_image.rb', line 13 def attrs @attrs end |
#images ⇒ Hash<Symbol, String> (readonly)
10 11 12 |
# File 'lib/osctl/image/operations/repository/add_image.rb', line 10 def images @images end |
#repo_dir ⇒ String (readonly)
7 8 9 |
# File 'lib/osctl/image/operations/repository/add_image.rb', line 7 def repo_dir @repo_dir end |
#tags ⇒ Array<String> (readonly)
16 17 18 |
# File 'lib/osctl/image/operations/repository/add_image.rb', line 16 def @tags end |
Instance Method Details
#execute ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/osctl/image/operations/repository/add_image.rb', line 35 def execute repo = OsCtl::Repo::Local::Repository.new(repo_dir) unless repo.exist? raise OperationError, 'repository does not exist' end repo.add( attrs[:vendor], attrs[:variant], attrs[:arch], attrs[:distribution], attrs[:version], tags:, image: images ) end |