imagemaster3000 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -25
- data/lib/imagemaster3000/verification/hash.rb +8 -25
- data/lib/imagemaster3000/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6915095a20c1e095d889f8f2223bfbfe5413dc
|
4
|
+
data.tar.gz: 83e53f574c23f6ae55d127d04e93e02d37a685c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
31
|
-
--
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
49
|
-
|
50
|
-
[--logging-file=LOGGING-FILE]
|
51
|
-
|
52
|
-
[--debug], [--no-debug]
|
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
|
-
"
|
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
|
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
|
-
|
27
|
-
|
28
|
-
logger.debug "
|
29
|
-
|
30
|
-
found_lines
|
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
|
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.
|
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-
|
11
|
+
date: 2017-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|