sle2docker 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +6 -0
- data/Gemfile +4 -0
- data/README.md +13 -6
- data/bin/sle2docker +2 -6
- data/lib/sle2docker.rb +1 -0
- data/lib/sle2docker/cli.rb +79 -66
- data/lib/sle2docker/version.rb +1 -1
- data/sle2docker.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ba4bc4ef832b69bf18ec9d3ba0fd0b5518ae3d6
|
4
|
+
data.tar.gz: 712d2fb95e42161a359a2eb0286f2922f22ae054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adf5fa4931a457bcfd3e2d284ed61632f5289fd7a97940b1e9bf68bf21a31773e5b903727ad242374777ffd4053cd221117284d5fdf189647e0de2919cd8d10a
|
7
|
+
data.tar.gz: e4ccfa007af3e0c836261cd659a7f1a92c1a32de21b792990978d06c539ec0c89c183f870927e320722b1f84f5009f1bcc0559d11c05b7f82996d7edb457fd4a
|
data/Changelog
CHANGED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -62,13 +62,20 @@ system.
|
|
62
62
|
To build a template just use the following command:
|
63
63
|
|
64
64
|
```
|
65
|
-
sle2docker
|
65
|
+
sle2docker build TEMPLATE
|
66
66
|
```
|
67
67
|
|
68
68
|
A list of the available templates can be obtained by running:
|
69
69
|
|
70
70
|
```
|
71
|
-
sle2docker
|
71
|
+
sle2docker list
|
72
|
+
```
|
73
|
+
|
74
|
+
A templated rendered with user provided data can be printed by using the
|
75
|
+
following command:
|
76
|
+
|
77
|
+
```
|
78
|
+
sle2docker show TEMPLATE
|
72
79
|
```
|
73
80
|
|
74
81
|
## SUSE Customer Center integration
|
@@ -79,7 +86,7 @@ his credentials. It is possible to start a build in a non interactive way by
|
|
79
86
|
using the following command:
|
80
87
|
|
81
88
|
```
|
82
|
-
sle2docker -u USERNAME -p PASSWORD TEMPLATE_NAME
|
89
|
+
sle2docker build -u USERNAME -p PASSWORD TEMPLATE_NAME
|
83
90
|
```
|
84
91
|
|
85
92
|
|
@@ -89,7 +96,7 @@ It is possible to download all the reuiqred packages from a local
|
|
89
96
|
Subscription Management Tool (SMT) instance:
|
90
97
|
|
91
98
|
```
|
92
|
-
sle2docker -s SMT_SERVER_HOSTNAME
|
99
|
+
sle2docker build -s SMT_SERVER_HOSTNAME TEMPLATE
|
93
100
|
```
|
94
101
|
|
95
102
|
By default sle2docker assumes the contents of the SMT server are served over
|
@@ -97,7 +104,7 @@ HTTPS. To force the retrieval of the package over plain HTTP use the
|
|
97
104
|
following command:
|
98
105
|
|
99
106
|
```
|
100
|
-
sle2docker -s SMT_SERVER_HOSTNAME --disable-https
|
107
|
+
sle2docker build -s SMT_SERVER_HOSTNAME --disable-https TEMPLATE
|
101
108
|
```
|
102
109
|
|
103
110
|
By default sle2docker expects the SMT instance to not require any form of
|
@@ -105,7 +112,7 @@ authentication. However it is possible to specify the access credentials by
|
|
105
112
|
using the following command:
|
106
113
|
|
107
114
|
```
|
108
|
-
sle2docker -s SMT_SERVER_HOSTNAME -u USERNAME -p PASSWORD
|
115
|
+
sle2docker build -s SMT_SERVER_HOSTNAME -u USERNAME -p PASSWORD TEMPLATE
|
109
116
|
```
|
110
117
|
|
111
118
|
|
data/bin/sle2docker
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require_relative '../lib/sle2docker'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
puts " docker import - <desired image name> < #{container}"
|
7
|
-
puts "\nThen the '#{File.expand_path(File.join(File.dirname(container), '..'))}' directory and all its contents can be removed."
|
8
|
-
puts "Note well: KIWI created some of these files while running as root user, " +
|
9
|
-
"hence root privileges are required to remove them."
|
4
|
+
Sle2Docker::Cli.start(ARGV)
|
5
|
+
|
data/lib/sle2docker.rb
CHANGED
data/lib/sle2docker/cli.rb
CHANGED
@@ -1,83 +1,96 @@
|
|
1
1
|
module Sle2Docker
|
2
2
|
|
3
|
-
class Cli
|
3
|
+
class Cli < Thor
|
4
|
+
|
5
|
+
#def initialize
|
6
|
+
# @options, @template_dir = parse_options()
|
7
|
+
#end
|
8
|
+
|
9
|
+
#def start
|
10
|
+
# builder = Builder.new(@options)
|
11
|
+
# builder.create(@template_dir)
|
12
|
+
#rescue ConfigNotFoundError => e
|
13
|
+
# $stderr.printf(e.message + "\n")
|
14
|
+
# exit(1)
|
15
|
+
#end
|
16
|
+
|
17
|
+
desc "list", "List the available templates"
|
18
|
+
def list
|
19
|
+
puts "Available templates:"
|
20
|
+
Template.list.each {|template| puts " - #{template}"}
|
21
|
+
end
|
4
22
|
|
5
|
-
|
6
|
-
|
23
|
+
map "-v" => :version
|
24
|
+
desc "version", "Display version"
|
25
|
+
def version
|
26
|
+
puts Sle2Docker::VERSION
|
7
27
|
end
|
8
28
|
|
9
|
-
|
10
|
-
|
11
|
-
|
29
|
+
desc "show TEMPLATE", "Print the rendered TEMPLATE"
|
30
|
+
method_option :username, :aliases => "-u", :type => :string,
|
31
|
+
:default => nil,
|
32
|
+
:desc => "Username required to access repositories"
|
33
|
+
method_option :password, :aliases => "-p", :type => :string,
|
34
|
+
:default => "",
|
35
|
+
:desc => "Password required to access repositories"
|
36
|
+
method_option :smt_host, :aliases => ["-s", "--smt-host"], :type => :string,
|
37
|
+
:default => nil,
|
38
|
+
:desc => "SMT machine hosting the repositories"
|
39
|
+
method_option :disable_https, :aliases => ["--disable-https"],
|
40
|
+
:type => :boolean,
|
41
|
+
:default => false,
|
42
|
+
:desc => "Do not use HTTPS when accessing repositories"
|
43
|
+
def show(template_name)
|
44
|
+
template_dir = Template.template_dir(template_name)
|
45
|
+
builder = Builder.new(options)
|
46
|
+
template_file = builder.find_template_file(template_dir)
|
47
|
+
if template_file.end_with?('.erb')
|
48
|
+
template = builder.render_template(template_file)
|
49
|
+
puts "\n\n"
|
50
|
+
puts template
|
51
|
+
end
|
12
52
|
rescue ConfigNotFoundError => e
|
13
53
|
$stderr.printf(e.message + "\n")
|
14
54
|
exit(1)
|
55
|
+
rescue TemplateNotFoundError => ex
|
56
|
+
$stderr.printf(ex.message + "\n")
|
57
|
+
$stderr.printf("To list the available templates use:\n")
|
58
|
+
$stderr.printf(" sle2docker list\n")
|
59
|
+
exit(1)
|
15
60
|
end
|
16
61
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
options[:disable_https] = false
|
44
|
-
opts.on('--disable-https',
|
45
|
-
'Do not use HTTPS when accessing repositories' ) do
|
46
|
-
options[:disable_https] = true
|
47
|
-
end
|
48
|
-
|
49
|
-
opts.on('-l', '--list-templates', 'List the available templates' ) do
|
50
|
-
puts "Available templates:"
|
51
|
-
Template.list.each {|template| puts " - #{template}"}
|
52
|
-
exit
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
opts.on('-h', '--help', 'Display this screen' ) do
|
57
|
-
puts opts
|
58
|
-
exit
|
59
|
-
end
|
60
|
-
|
61
|
-
opts.on('-v', '--version', 'Display version' ) do
|
62
|
-
puts Sle2Docker::VERSION
|
63
|
-
exit
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
optparse.parse!
|
69
|
-
|
70
|
-
if ARGV.count != 1
|
71
|
-
$stderr.printf("Template not provided\n")
|
72
|
-
exit(1)
|
73
|
-
end
|
74
|
-
|
75
|
-
[options, Template.template_dir(ARGV[0])]
|
62
|
+
desc "build TEMPLATE", "Use TEMPLATE to build a SLE Docker image"
|
63
|
+
method_option :username, :aliases => "-u", :type => :string,
|
64
|
+
:default => nil,
|
65
|
+
:desc => "Username required to access repositories"
|
66
|
+
method_option :password, :aliases => "-p", :type => :string,
|
67
|
+
:default => "",
|
68
|
+
:desc => "Password required to access repositories"
|
69
|
+
method_option :smt_host, :aliases => ["-s", "--smt-host"], :type => :string,
|
70
|
+
:default => nil,
|
71
|
+
:desc => "SMT machine hosting the repositories"
|
72
|
+
method_option :disable_https, :aliases => ["--disable-https"],
|
73
|
+
:type => :boolean,
|
74
|
+
:default => false,
|
75
|
+
:desc => "Do not use HTTPS when accessing repositories"
|
76
|
+
def build(template_name)
|
77
|
+
template_dir = Template.template_dir(template_name)
|
78
|
+
builder = Builder.new(options)
|
79
|
+
container = builder.create(template_dir)
|
80
|
+
puts "Container created, it can be imported by running the following command:"
|
81
|
+
puts " docker import - <desired image name> < #{container}"
|
82
|
+
puts "\nThen the '#{File.expand_path(File.join(File.dirname(container), '..'))}' directory and all its contents can be removed."
|
83
|
+
puts "Note well: KIWI created some of these files while running as root user, " +
|
84
|
+
"hence root privileges are required to remove them."
|
85
|
+
rescue ConfigNotFoundError => e
|
86
|
+
$stderr.printf(e.message + "\n")
|
87
|
+
exit(1)
|
76
88
|
rescue TemplateNotFoundError => ex
|
77
89
|
$stderr.printf(ex.message + "\n")
|
78
90
|
$stderr.printf("To list the available templates use:\n")
|
79
|
-
$stderr.printf(" sle2docker
|
91
|
+
$stderr.printf(" sle2docker list\n")
|
80
92
|
exit(1)
|
81
93
|
end
|
94
|
+
|
82
95
|
end
|
83
96
|
end
|
data/lib/sle2docker/version.rb
CHANGED
data/sle2docker.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sle2docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flavio Castelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -55,6 +69,7 @@ extra_rdoc_files: []
|
|
55
69
|
files:
|
56
70
|
- .gitignore
|
57
71
|
- Changelog
|
72
|
+
- Gemfile
|
58
73
|
- LICENSE
|
59
74
|
- README.md
|
60
75
|
- Rakefile
|