Class: Kitchen::Driver::VmpoolStores::GitlabSnippetStore

Inherits:
GitlabBaseStore show all
Defined in:
lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb

Instance Attribute Summary collapse

Attributes inherited from FileBaseStore

#pool_data

Instance Method Summary collapse

Methods inherited from FileBaseStore

#cleanup, #read, #reread, #take_pool_member

Methods inherited from BaseStore

#cleanup, #take_pool_member

Constructor Details

#initialize(options = nil) ⇒ GitlabSnippetStore

Returns a new instance of GitlabSnippetStore.

Parameters:

  • project_id (Hash)

    a customizable set of options

  • snippet_id (Hash)

    a customizable set of options

  • pool_file (Hash)

    a customizable set of options

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 13

def initialize(options = nil)
  options ||= { project_id: nil, snippet_id: nil, pool_file: 'vmpool'}
  raise ArgumentError.new("You must pass the project_id option") unless options['project_id'].to_i > 0
  @snippet_id = options['snippet_id']  #ie. 34422
  @project_id = options['project_id']  #ie. 89
  @pool_file = options['pool_file']
end

Instance Attribute Details

#pool_fileObject (readonly)

Returns the value of attribute pool_file.



8
9
10
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 8

def pool_file
  @pool_file
end

#project_idObject

Returns the value of attribute project_id.



7
8
9
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 7

def project_id
  @project_id
end

#snippet_idObject

Returns the value of attribute snippet_id.



7
8
9
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 7

def snippet_id
  @snippet_id
end

Instance Method Details

#createObject



27
28
29
30
31
32
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 27

def create
  #info("Creating new vmpool data snippet")
  snippet = create_snippet
  @snippet_id = snippet.id
  read
end

#saveObject



34
35
36
37
38
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 34

def save
  #info("Saving vmpool data")
  update_snippet
  read
end

#update(content = nil) ⇒ Object



21
22
23
24
25
# File 'lib/kitchen/driver/vmpool_stores/gitlab_snippet_store.rb', line 21

def update(content = nil)
  #info("Updating vmpool data")
  update_snippet
  read
end