httpd_configmap_generator 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 269f3519101488e9580699f67f1fa479f1db78f6
4
- data.tar.gz: 3224b233aedc0c5ae68cb0299d2438e165b2b7f5
3
+ metadata.gz: 97e1e062ab6b1f55d36ffe1de318f82892c78d8e
4
+ data.tar.gz: 7a88bb96641736bb254238122b722547b61c5ec2
5
5
  SHA512:
6
- metadata.gz: a0d1935e46028b58c93d019e38b1133d2653414ae77d4bc0e33182a7d1d1230c43bdf12dd5cccd233c381bf6aa8c9fe3a632c37bd220dd3a2ec8cc820b3d1301
7
- data.tar.gz: 7d85650f7f2b59dc7db1345e48e0486687fea752482232d3d1cccbde9b20e273b455003cbc45eaadff9bbd62a58b11d243abed5f23debcd57374b35da60f987e
6
+ metadata.gz: a2476f19b3e2ec40ce2a14cee8946850db609d2dbd5e215129fed1981d807cf34985bf13bc37c31277c0214ce3f97b10761ec4d13b17fb6ac757909acf9777d8
7
+ data.tar.gz: 2b34b65675ab369a0821723e08259d06efa1619b168a3e80d019f696eb091dd8301e910454d14afe06611b6202afbdbfd884fe91360ffdbf128c0f584ed8dc05
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Dockerfile.devel
1
2
  .rubocop-*
2
3
  /bundle/
3
4
  /.bundle/
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - '2.3.5'
3
+ - '2.3.1'
4
4
  - '2.4.2'
5
5
  sudo: false
6
6
  cache: bundler
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  # Leverage the httpd_configmap_generator.gemspec
4
4
  gemspec
5
+
6
+ # Load other additional Gemfiles
7
+ # Developers can create a file ending in .rb under bundler.d/ to specify additional development dependencies
8
+ Dir.glob(File.join(__dir__, 'bundler.d/*.rb')).each { |f| eval_gemfile(File.expand_path(f, __dir__)) }
@@ -8,21 +8,17 @@ by joining an Active Directory domain.
8
8
 
9
9
  ```
10
10
  $ httpd_configmap_generator active-directory --help
11
- httpd_configmap_generator 0.1.0 - External Authentication Configuration script
12
-
13
- Usage: httpd_configmap_generator auth_type | update | export [--help | options]
14
-
15
- httpd_configmap_generator options are:
16
- -V, --version Version of the httpd_configmap_generator command
17
- -h, --host=<s> Application Domain (default: )
18
- -o, --output=<s> Configuration map file to create (default: )
19
- -a, --ad-domain=<s> Active Directory Domain (default: )
20
- -u, --ad-server=<s> Active Directory User (default: )
21
- -p, --ad-password=<s> Active Directory Password (default: )
22
- -f, --force Force configuration if configured already
23
- -d, --debug Enable debugging
24
- -r, --ad-realm=<s> Active Directory Realm (default: )
25
- -e, --help Show this message
11
+ Options:
12
+ -h, --host=<s> Application Domain
13
+ -o, --output=<s> Configuration map file to create
14
+ -a, --ad-domain=<s> Active Directory Domain
15
+ -u, --ad-user=<s> Active Directory User
16
+ -p, --ad-password=<s> Active Directory Password
17
+ -f, --force Force configuration if configured already
18
+ -d, --debug Enable debugging
19
+ -r, --ad-realm=<s> Active Directory Realm
20
+ -s, --ad-server=<s> Active Directory Server
21
+ -e, --help Show this message
26
22
  ```
27
23
 
28
24
  ### Example:
data/README-ipa.md CHANGED
@@ -8,21 +8,16 @@ for an IPA server.
8
8
 
9
9
  ```
10
10
  $ httpd_configmap_generator ipa --help
11
- httpd_configmap_generator 0.1.0 - External Authentication Configuration script
12
-
13
- Usage: httpd_configmap_generator auth_type | update | export [--help | options]
14
-
15
- httpd_configmap_generator options are:
16
- -V, --version Version of the httpd_configmap_generator command
17
- -h, --host=<s> Application Domain (default: )
18
- -o, --output=<s> Configuration map file to create (default: )
19
- -i, --ipa-server=<s> IPA Server Fqdn (default: )
20
- -p, --ipa-password=<s> IPA Server Password (default: )
11
+ Options:
12
+ -h, --host=<s> Application Domain
13
+ -o, --output=<s> Configuration map file to create
14
+ -i, --ipa-server=<s> IPA Server FQDN
15
+ -p, --ipa-password=<s> IPA Server Password
21
16
  -f, --force Force configuration if configured already
22
17
  -d, --debug Enable debugging
23
18
  -a, --ipa-principal=<s> IPA Server Principal (default: admin)
24
- -m, --ipa-domain=<s> Domain of IPA Server (default: )
25
- -r, --ipa-realm=<s> Realm of IPA Server (default: )
19
+ -m, --ipa-domain=<s> Domain of IPA Server
20
+ -r, --ipa-realm=<s> Realm of IPA Server
26
21
  -e, --help Show this message
27
22
  ```
28
23
 
data/README-saml.md CHANGED
@@ -6,19 +6,14 @@ This documents how to run the httpd\_configmap\_generator tool to configure the
6
6
 
7
7
  ```
8
8
  $ httpd_configmap_generator saml --help
9
- httpd_configmap_generator 0.1.0 - External Authentication Configuration script
10
-
11
- Usage: httpd_configmap_generator auth_type | update | export [--help | options]
12
-
13
- httpd_configmap_generator options are:
14
- -V, --version Version of the httpd_configmap_generator command
15
- -h, --host=<s> Application Domain (default: )
16
- -o, --output=<s> Configuration map file to create (default: )
9
+ Options:
10
+ -h, --host=<s> Application Domain
11
+ -o, --output=<s> Configuration map file to create
17
12
  -f, --force Force configuration if configured already
18
13
  -d, --debug Enable debugging
19
14
  -k, --keycloak-add-metadata Download and add the Keycloak metadata file
20
- -e, --keycloak-server=<s> Keycloak Server Fqdn or IP (default: )
21
- -y, --keycloak-realm=<s> Keycloak Realm for this client (default: )
15
+ -e, --keycloak-server=<s> Keycloak Server FQDN or IP
16
+ -y, --keycloak-realm=<s> Keycloak Realm for this client
22
17
  -l, --help Show this message
23
18
  ```
24
19
 
data/README.md CHANGED
@@ -23,10 +23,16 @@ gem install httpd_configmap_generator
23
23
  Generating an auth-config map can be done by running the httpd\_configmap\_generator tool
24
24
 
25
25
  ```
26
- $ httpd_configmap_generator
26
+ $ httpd_configmap_generator --help
27
+ httpd_configmap_generator 0.1.1 - External Authentication Configuration script
27
28
 
28
29
  Usage: httpd_configmap_generator auth_type | update | export [--help | options]
29
- Supported auth_type: active-directory, ipa, saml
30
+
31
+ supported auth_type: active-directory, ipa, saml
32
+
33
+ httpd_configmap_generator options are:
34
+ -V, --version Version of the httpd_configmap_generator command
35
+ -h, --help Show this message
30
36
  ```
31
37
 
32
38
  Showing the usage for each authentication type or sub-command as follows:
@@ -53,17 +59,12 @@ map as per the following usage:
53
59
 
54
60
  ```
55
61
  $ httpd_configmap_generator update --help
56
- httpd_configmap_generator 0.1.0 - External Authentication Configuration script
57
-
58
- Usage: httpd_configmap_generator auth_type | update | export [--help | options]
59
-
60
- httpd_configmap_generator options are:
61
- -V, --version Version of the httpd_configmap_generator command
62
- -i, --input=<s> Input config map file (default: )
63
- -o, --output=<s> Output config map file (default: )
62
+ Options:
63
+ -i, --input=<s> Input config map file
64
+ -o, --output=<s> Output config map file
64
65
  -f, --force Force configuration if configured already
65
66
  -d, --debug Enable debugging
66
- -a, --add-file=<s> Add file to config map (default: )
67
+ -a, --add-file=<s> Add file to config map
67
68
  -h, --help Show this message
68
69
  ```
69
70
 
@@ -143,15 +144,10 @@ map as per the following usage:
143
144
 
144
145
  ```
145
146
  $ httpd_configmap_generator export --help
146
- httpd_configmap_generator 0.1.0 - External Authentication Configuration script
147
-
148
- Usage: httpd_configmap_generator auth_type | update | export [--help | options]
149
-
150
- httpd_configmap_generator options are:
151
- -V, --version Version of the httpd_configmap_generator command
152
- -i, --input=<s> Input config map file (default: )
153
- -l, --file=<s> Config map file to export (default: )
154
- -o, --output=<s> The output file being exported (default: )
147
+ Options:
148
+ -i, --input=<s> Input config map file
149
+ -l, --file=<s> Config map file to export
150
+ -o, --output=<s> The output file being exported
155
151
  -f, --force Force configuration if configured already
156
152
  -d, --debug Enable debugging
157
153
  -h, --help Show this message
@@ -7,7 +7,7 @@
7
7
  # -o filename: for the generated auth-config map.
8
8
  #
9
9
 
10
- require "bundler/setup"
10
+ Dir.chdir(__dir__) { require "bundler/setup" }
11
11
  require "trollop"
12
12
  require "httpd_configmap_generator"
13
13
 
@@ -20,62 +20,63 @@ end
20
20
 
21
21
  module HttpdConfigmapGenerator
22
22
  class Cli
23
- def parse_arguments(auth_config)
24
- opts = Trollop.options do
23
+ SUB_COMMANDS = [HttpdConfigmapGenerator.supported_auth_types] | %w(update export)
24
+
25
+ def run
26
+ Trollop.options do
25
27
  version("#{CMD} #{HttpdConfigmapGenerator::VERSION} - External Authentication Configuration script")
26
28
  banner <<-EOS
27
29
  #{version}
28
30
 
29
31
  Usage: #{CMD} auth_type | update | export [--help | options]
30
32
 
33
+ supported auth_type: #{HttpdConfigmapGenerator.supported_auth_types.join(', ')}
34
+
31
35
  #{CMD} options are:
32
36
  EOS
33
37
  opt :version, "Version of the #{CMD} command",
34
38
  :default => false, :short => "-V"
35
- auth_config.required_options.each do |key, key_options|
36
- opt key, key_options[:description], HttpdConfigmapGenerator::Cli.options_for(key_options, true)
37
- end
38
- auth_config.optional_options.each do |key, key_options|
39
- opt key, key_options[:description], HttpdConfigmapGenerator::Cli.options_for(key_options)
40
- end
41
- end
42
- opts
43
- end
44
-
45
- def run_configure(auth_type)
46
- begin
47
- auth_config = HttpdConfigmapGenerator.new_config(auth_type)
48
- rescue => err
49
- error_msg(err.to_s)
39
+ stop_on(SUB_COMMANDS)
50
40
  end
51
41
 
52
- auth_config.run_configure(parse_arguments(auth_config))
53
- end
42
+ auth_type = ARGV.shift
43
+ Trollop.die "Must specify an authentication type" if auth_type.nil?
54
44
 
55
- def run_update
56
45
  begin
57
- auth_config = HttpdConfigmapGenerator::Update.new
46
+ auth_config =
47
+ case auth_type
48
+ when "update" then HttpdConfigmapGenerator::Update.new
49
+ when "export" then HttpdConfigmapGenerator::Export.new
50
+ else HttpdConfigmapGenerator.new_config(auth_type)
51
+ end
58
52
  rescue => err
59
53
  error_msg(err.to_s)
60
54
  end
61
55
 
62
- auth_config.update(parse_arguments(auth_config))
63
- end
64
-
65
- def run_export
66
- begin
67
- auth_config = HttpdConfigmapGenerator::Export.new
68
- rescue => err
69
- error_msg(err.to_s)
56
+ params = Trollop.options do
57
+ auth_config.required_options.each do |key, key_options|
58
+ opt key, key_options[:description], HttpdConfigmapGenerator::Cli.options_for(key_options, true)
59
+ end
60
+ auth_config.optional_options.each do |key, key_options|
61
+ opt key, key_options[:description], HttpdConfigmapGenerator::Cli.options_for(key_options)
62
+ end
70
63
  end
71
64
 
72
- auth_config.export(parse_arguments(auth_config))
65
+ case auth_type
66
+ when "update" then auth_config.update(params)
67
+ when "export" then auth_config.export(params)
68
+ else auth_config.run_configure(params)
69
+ end
73
70
  end
74
71
 
75
72
  def self.options_for(key_options, required = false)
76
73
  options = {}
77
- options[:default] = key_options.key?(:default) ? key_options[:default] : ""
78
- options[:required] = true if required
74
+ if key_options[:default].nil?
75
+ options[:type] = key_options[:type] || :string
76
+ else
77
+ options[:default] = key_options[:default]
78
+ end
79
+ options[:required] = required
79
80
  options[:short] = key_options[:short] if key_options[:short]
80
81
  options[:multi] = key_options[:multi] if key_options[:multi]
81
82
  options
@@ -83,19 +84,4 @@ Usage: #{CMD} auth_type | update | export [--help | options]
83
84
  end
84
85
  end
85
86
 
86
- if ARGV.empty?
87
- error_msg("
88
- Usage: #{CMD} auth_type | update | export [--help | options]
89
- Supported auth_type: #{HttpdConfigmapGenerator.supported_auth_types.join(', ')}
90
- ")
91
- else
92
- auth_type = ARGV.shift
93
- case auth_type
94
- when "update"
95
- HttpdConfigmapGenerator::Cli.new.run_update
96
- when "export"
97
- HttpdConfigmapGenerator::Cli.new.run_export
98
- else
99
- HttpdConfigmapGenerator::Cli.new.run_configure(auth_type)
100
- end
101
- end
87
+ HttpdConfigmapGenerator::Cli.new.run
@@ -9,7 +9,7 @@ module HttpdConfigmapGenerator
9
9
 
10
10
  def required_options
11
11
  super.merge(
12
- :ipa_server => { :description => "IPA Server Fqdn" },
12
+ :ipa_server => { :description => "IPA Server FQDN" },
13
13
  :ipa_password => { :description => "IPA Server Password" }
14
14
  )
15
15
  end
@@ -17,7 +17,7 @@ module HttpdConfigmapGenerator
17
17
  super.merge(
18
18
  :keycloak_add_metadata => { :description => "Download and add the Keycloak metadata file",
19
19
  :default => false },
20
- :keycloak_server => { :description => "Keycloak Server Fqdn or IP" },
20
+ :keycloak_server => { :description => "Keycloak Server FQDN or IP" },
21
21
  :keycloak_realm => { :description => "Keycloak Realm for this client"}
22
22
  )
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module HttpdConfigmapGenerator
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.1.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpd_configmap_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Httpd Auth Config Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codeclimate-test-reporter
@@ -172,7 +172,6 @@ files:
172
172
  - lib/httpd_configmap_generator/base/sssd.rb
173
173
  - lib/httpd_configmap_generator/export.rb
174
174
  - lib/httpd_configmap_generator/ipa.rb
175
- - lib/httpd_configmap_generator/options.rb
176
175
  - lib/httpd_configmap_generator/saml.rb
177
176
  - lib/httpd_configmap_generator/update.rb
178
177
  - lib/httpd_configmap_generator/version.rb
@@ -1,13 +0,0 @@
1
- module HttpdConfigmapGenerator
2
- def self.required_options
3
- {
4
- :host => { :description => "Application Domain" }
5
- }
6
- end
7
-
8
- def self.optional_options
9
- {
10
- :force => { :description => "Force configuration if configured already", :default => false }
11
- }
12
- end
13
- end