imagemaster3000 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aca6a562b884c32fe727aea3f82fd5d4ff370524
4
- data.tar.gz: 2f95e621cee42e6cfa9886672173dd4bf85fe18a
3
+ metadata.gz: 6f6915095a20c1e095d889f8f2223bfbfe5413dc
4
+ data.tar.gz: 83e53f574c23f6ae55d127d04e93e02d37a685c1
5
5
  SHA512:
6
- metadata.gz: 882f848abfc0e3a7dc4194e90ccab8149f04902e87ed64d1405ca66f46ed6350262d36369f89500d9ac7e531f6a09eca20fb5ca2e86e7c72832a35f8ac67de93
7
- data.tar.gz: cce26a9e491ad3067d5cec5a7ac20187ad51d0895a2c75e3f3dc967e4df1327fef8b079e285cdbf2a9fb1193834341c16d06087f0a8b8e9b7660d461c14f32ae
6
+ metadata.gz: aa73318b9a5b260232e58e5f01ec87d5ace579652cdcb3a642a5fabf0590a57a461b51dc47ec96a697a777684f07b932e0fa1137286aabc01fe63b3466de7ed3
7
+ data.tar.gz: b4365e0e6797959420bddebe5638e86571bd7dcf89058a6b0c4c1d94cdd5c690b40abb8ce774685452304157769c262b58b7888ced28813c63a4c6398e6c0edc
data/README.md CHANGED
@@ -21,35 +21,35 @@ bundle exec rake spec
21
21
  ```
22
22
 
23
23
  ## Usage
24
-
25
- ```bash
24
+ ```
26
25
  Usage:
27
- imagemaster3000 start --binaries-guestfish=BINARIES-GUESTFISH --binaries-virt-copy-in=BINARIES-VIRT-COPY-IN --certificate=CERTIFICATE --endpoint=ENDPOINT --group=GROUP --image-dir=IMAGE-DIR --image-list=IMAGE-LIST --key=KEY
26
+ imagemaster3000 start --binaries-guestfish=BINARIES-GUESTFISH --binaries-virt-copy-in=BINARIES-VIRT-COPY-IN --certificate=CERTIFICATE --definitions-repository=DEFINITIONS-REPOSITORY --endpoint=ENDPOINT --group=GROUP --image-dir=IMAGE-DIR --image-list=IMAGE-LIST --key=KEY
28
27
 
29
28
  Options:
30
- [--definitions-dir=DEFINITIONS-DIR] # If set, definitions in this direcotry are used to download and modify images
31
- --image-dir=IMAGE-DIR # Directory where to temporarily store images
32
- # Default: /var/spool/imagemaster3000/images/
33
- --group=GROUP # Group, images will be uploaded to
34
- # Default: imagemaster3000
35
- --image-list=IMAGE-LIST # Name and path of generated image list
36
- # Default: /var/spool/imagemaster3000/image-list/imagemaster3000.list
37
- --endpoint=ENDPOINT # Endpoint where image list will be available
38
- # Default: http://localhost/
39
- --certificate=CERTIFICATE # Certificate to sign image list with
40
- # Default: /etc/grid-security/cert.pem
41
- --key=KEY # Key to sign image list with
42
- # Default: /etc/grid-security/key.pem
43
- --binaries-virt-copy-in=BINARIES-VIRT-COPY-IN # Path to binary needed for 'copy' action
44
- # Default: /usr/bin/virt-copy-in
45
- --binaries-guestfish=BINARIES-GUESTFISH # Path to binary needed for 'remove' action
46
- # Default: /usr/bin/guestfish
29
+ --definitions-repository=DEFINITIONS-REPOSITORY # Repository from which image definitions will be downloaded
30
+ [--definitions-branch=DEFINITIONS-BRANCH] # Repository branch that will be used
31
+ --image-dir=IMAGE-DIR # Directory where to temporarily store images
32
+ # Default: /var/spool/imagemaster3000/images/
33
+ --group=GROUP # Group, images will be uploaded to
34
+ # Default: imagemaster3000
35
+ --image-list=IMAGE-LIST # Name and path of generated image list
36
+ # Default: /var/spool/imagemaster3000/image-list/imagemaster3000.list
37
+ --endpoint=ENDPOINT # Endpoint where image list will be available
38
+ # Default: http://localhost/
39
+ --certificate=CERTIFICATE # Certificate to sign image list with
40
+ # Default: /etc/grid-security/cert.pem
41
+ --key=KEY # Key to sign image list with
42
+ # Default: /etc/grid-security/key.pem
43
+ --binaries-virt-copy-in=BINARIES-VIRT-COPY-IN # Path to binary needed for 'copy' action
44
+ # Default: /usr/bin/virt-copy-in
45
+ --binaries-guestfish=BINARIES-GUESTFISH # Path to binary needed for 'remove' action
46
+ # Default: /usr/bin/guestfish
47
47
  --logging-level=LOGGING-LEVEL
48
- # Default: ERROR
49
- # Possible values: DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN
50
- [--logging-file=LOGGING-FILE] # File to write logs to
51
- # Default: /var/log/imagemaster3000/imagemaster3000.log
52
- [--debug], [--no-debug] # Runs in debug mode
48
+ # Default: ERROR
49
+ # Possible values: DEBUG, INFO, WARN, ERROR, FATAL, UNKNOWN
50
+ [--logging-file=LOGGING-FILE] # File to write logs to
51
+ # Default: /var/log/imagemaster3000/imagemaster3000.log
52
+ [--debug], [--no-debug] # Runs in debug mode
53
53
  ```
54
54
 
55
55
  ## Contributing
@@ -3,42 +3,25 @@ module Imagemaster3000
3
3
  module Hash
4
4
  def verify_hash!
5
5
  logger.debug 'Verifying checksum'
6
- checksum = find_checksum!
7
6
  computed_checksum = verification[:hash][:function].file(local_filename).hexdigest
8
-
9
- if checksum == computed_checksum
7
+ if checksum_present? computed_checksum
10
8
  verification[:hash][:checksum] = ::Digest::SHA512.file(local_filename).hexdigest
11
9
  return
12
10
  end
13
11
 
14
12
  raise Imagemaster3000::Errors::VerificationError,
15
- "Checksum mismatch for file #{local_filename}: expected: #{checksum}, was: #{computed_checksum}"
13
+ "Not exactly one checksum found for file #{local_filename}: expected: #{computed_checksum}"
16
14
  end
17
15
 
18
16
  private
19
17
 
20
- def find_checksum!
21
- split_checksum find_checksum_line
22
- end
23
-
24
- def find_checksum_line
18
+ def checksum_present?(checksum)
25
19
  checksum_list = verification[:hash][:list]
26
- filename = remote_filename
27
-
28
- logger.debug "Looking for filename #{filename.inspect} in list \n#{checksum_list}"
29
-
30
- found_lines = checksum_list.lines.grep(/\s+\*?#{filename}\s*$/)
31
- raise Imagemaster3000::Errors::VerificationError, "Cannot identify checksum for file #{filename.inspect}" \
32
- unless found_lines.count == 1
33
-
34
- checksum_line = found_lines.first
35
- logger.debug "Found matching line #{checksum_line.inspect}"
36
-
37
- checksum_line
38
- end
39
-
40
- def split_checksum(checksum_line)
41
- checksum_line.split.first
20
+ logger.debug "Looking for hash #{checksum.inspect} in list \n#{checksum_list}"
21
+ found_lines = checksum_list.lines.grep(/^#{checksum}\s+/)
22
+ logger.debug "#{found_lines.count} checksum matches"
23
+ logger.debug " List of matching lines: #{found_lines.inspect}" if found_lines.count > 0
24
+ found_lines.count == 1
42
25
  end
43
26
  end
44
27
  end
@@ -1,3 +1,3 @@
1
1
  module Imagemaster3000
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imagemaster3000
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kimle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-19 00:00:00.000000000 Z
11
+ date: 2017-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler