cem_acpt 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cem_acpt/platform/gcp/cmd.rb +3 -11
- data/lib/cem_acpt/utils.rb +4 -2
- data/lib/cem_acpt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b36c525ca6904813988ad305cc4a89607dff2edcdc8d749e347660047174b37
|
4
|
+
data.tar.gz: ed7e418fbcfadd8773f25f026afa0341119ab28c5e3cc91976f46c42e83af5aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee9ccfe1841b755c0f8df1937d66d0e04e62efe29326f16df33af5d9d66fe47441177098a2ffaffd1f843397d19d2f5cf95dcb1b4e536568d0d52cc5848aa052
|
7
|
+
data.tar.gz: c1c4f2b3a96134009552f9d464b407b64abef6d37f19df28f99b18b17445a492872a77116e924164c38aa65d1b8a96cb089ae7eff58f7414fbc5d7376f24e5cc
|
data/Gemfile.lock
CHANGED
@@ -337,17 +337,9 @@ module CemAcpt::Platform::Gcp
|
|
337
337
|
|
338
338
|
# This function returns the currently authenticated user's name sanitized for use in SSH
|
339
339
|
def authenticated_user_name
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
rescue RuntimeError
|
344
|
-
auth_json = local_exec('auth list')
|
345
|
-
uname = auth_json.find { |x| x['status'] == 'ACTIVE' }['account']
|
346
|
-
end
|
347
|
-
|
348
|
-
raise 'failed to find authenticated user name' unless uname
|
349
|
-
|
350
|
-
uname.gsub(/[^a-zA-Z0-9_]/, '_')
|
340
|
+
local_exec('compute os-login describe-profile', project_flag: false)['posixAccounts'][0]['username']
|
341
|
+
rescue StandardError => e
|
342
|
+
raise "failed to find authenticated user name from os-login profile: #{e.message}"
|
351
343
|
end
|
352
344
|
end
|
353
345
|
end
|
data/lib/cem_acpt/utils.rb
CHANGED
@@ -82,10 +82,12 @@ module CemAcpt
|
|
82
82
|
# SSH-related utilities
|
83
83
|
module SSH
|
84
84
|
def self.ssh_keygen
|
85
|
-
bin_path =
|
85
|
+
bin_path = `#{ENV['SHELL']} -c 'command -v ssh-keygen'`.chomp
|
86
86
|
raise 'Cannot find ssh-keygen! Install it and verify PATH' unless bin_path
|
87
87
|
|
88
88
|
bin_path
|
89
|
+
rescue StandardError => e
|
90
|
+
raise "Cannot find ssh-keygen! Install it and verify PATH. Orignal error: #{e}"
|
89
91
|
end
|
90
92
|
|
91
93
|
def self.default_keydir
|
@@ -98,7 +100,7 @@ module CemAcpt
|
|
98
100
|
def self.ephemeral_ssh_key(type: 'rsa', bits: '4096', comment: nil, keydir: default_keydir)
|
99
101
|
raise ArgumentError, 'keydir does not exist' unless ::File.directory?(keydir)
|
100
102
|
|
101
|
-
keyfile = ::File.join(keydir,
|
103
|
+
keyfile = ::File.join(keydir, 'acpt_test_key')
|
102
104
|
keygen_cmd = [ssh_keygen, "-t #{type}", "-b #{bits}", "-f #{keyfile}", '-N ""']
|
103
105
|
keygen_cmd << "-C \"#{comment}\"" if comment
|
104
106
|
_, stderr, status = Open3.capture3(keygen_cmd.join(' '))
|
data/lib/cem_acpt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cem_acpt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|