simp-cli 1.0.17 → 1.0.18

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: c00f1a66b228c83d906fc95be29996b521bb4bc2
4
- data.tar.gz: 288f511795f8e390be8299c28bde9cf86650d8a9
3
+ metadata.gz: f73cedf68b3a0ad91e56b00711650ddd2fec1d85
4
+ data.tar.gz: 1cba90ed78d3fe2286c4f71de53cc40fcea9218f
5
5
  SHA512:
6
- metadata.gz: 3e3d45b70867323215dd05c5c2b43325c55976f63b7bf039876ed86356eb92eccadf7e66c79cc7b8a0d4cebe71090fad79b8998a483c6ac2635def9785064e71
7
- data.tar.gz: 791d38e9d4bca5aa79e3426f39eee29e2aa48a1be50d98c61a74e67accdbf358e91b8c7dc89d31057656cb0dee56c9f3bfcb33ced90aea49e18937ccd0077030
6
+ metadata.gz: f40381772269c7bda63ea7d9a39c7d2eb6a8fb842ad43ce7cf0cad0c6c40e465da6347b33730ad92285941ef259afc9391cb0c2080ac08e94da42a840ebd0e50
7
+ data.tar.gz: 589d187a88c732ba76b2e671d73b402929b1834308a2d0625097238067a968743a1dcad4a69e8a3a5c30a887d2c55757d3c63f8e54a4550944b20c8fe6797f61
@@ -5,7 +5,7 @@ module Simp; end
5
5
 
6
6
  # namespace for SIMP CLI commands
7
7
  class Simp::Cli
8
- VERSION = '1.0.17'
8
+ VERSION = '1.0.18'
9
9
 
10
10
  require 'optparse'
11
11
  require 'simp/cli/lib/utils'
@@ -3,7 +3,6 @@ module Simp::Cli::Commands; end
3
3
  class Simp::Cli::Commands::Passgen < Simp::Cli
4
4
  require 'fileutils'
5
5
 
6
- @target_dir = '/etc/puppet/modules/site/files/gen_passwd'
7
6
  @show_list = false
8
7
  @show_users = Array.new
9
8
  @set_users = Array.new
@@ -41,6 +40,15 @@ class Simp::Cli::Commands::Passgen < Simp::Cli
41
40
  puts opts
42
41
  exit 0
43
42
  end
43
+
44
+ unless @target_dir
45
+ env_path = %x(puppet config print environmentpath).strip
46
+ if File.directory?(env_path)
47
+ @target_dir = File.join(env_path, 'simp/simp_autofiles/gen_passwd')
48
+ else
49
+ raise(OptionParser::ParseError, 'Could not find a target passgen directory, please specify one with the `-d` option')
50
+ end
51
+ end
44
52
  end
45
53
 
46
54
  def self.run(args = Array.new)
@@ -51,8 +59,9 @@ class Simp::Cli::Commands::Passgen < Simp::Cli
51
59
 
52
60
  begin
53
61
  Dir.chdir(@target_dir) do
54
- @user_names = Dir.glob("*").map { |x| x = File.basename(x, '.last') }.sort.uniq.select do |name|
55
- File.ftype("#{@target_dir}/#{name}").eql?("file")
62
+ #File.ftype("#{@target_dir}/#{name}").eql?("file")
63
+ @user_names = Dir.glob("*").select do |x|
64
+ File.file?(x) && (x !~ /\..+$/)
56
65
  end
57
66
  end
58
67
  rescue => err
@@ -75,7 +84,7 @@ class Simp::Cli::Commands::Passgen < Simp::Cli
75
84
  if File.exists?(last_password_file)
76
85
  last_password = File.open(last_password_file, 'r').gets
77
86
  end
78
- puts " Previous: #{lass_password}" if last_password
87
+ puts " Previous: #{last_password}" if last_password
79
88
  end
80
89
  else
81
90
  raise "Invalid username '#{user}' selected.\n\n Valid: #{@user_names.join(', ')}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Vaughan
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2016-06-24 00:00:00.000000000 Z
16
+ date: 2016-07-18 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: highline