smart_proxy_abrt 0.0.1 → 0.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.
- checksums.yaml +4 -4
- data/Rakefile +1 -12
- data/bin/smart-proxy-abrt-send +5 -2
- data/extra/foreman-proxy-abrt-send.cron +1 -1
- data/lib/smart_proxy_abrt/abrt_lib.rb +7 -7
- data/lib/smart_proxy_abrt/abrt_version.rb +1 -1
- data/test/test_helper.rb +6 -8
- metadata +17 -4
- data/extra/rubygem-smart_proxy_abrt.spec +0 -110
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4dc83a2f1040df307420e2e75ee192c56901628
|
4
|
+
data.tar.gz: 13e7f426850a904b6cdf1b5156a215995bf3171f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84210dcc4ca882d2f42c1142fd6673a2411f1c5a71e306ae6435f24fed311d8f6d94c8ed11658f45fd4b969179e7f72723de79788757d1c9f7c2e2a288b52b6d
|
7
|
+
data.tar.gz: 939ebb9cf9d2b801da774a04132091b2afd70cfa3a556f252755d2e4552903723eaa5537d508c5c67918d70163414e31460b66f8c6e1379217245875b12f09a4
|
data/Rakefile
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
3
|
|
4
|
-
# Test for 1.9
|
5
|
-
if (RUBY_VERSION.split('.').map{|s|s.to_i} <=> [1,9,0]) > 0 then
|
6
|
-
PLATFORM = RUBY_PLATFORM
|
7
|
-
end
|
8
|
-
|
9
4
|
desc 'Default: run unit tests.'
|
10
5
|
task :default => :test
|
11
6
|
|
@@ -14,12 +9,6 @@ Rake::TestTask.new(:test) do |t|
|
|
14
9
|
t.libs << '.'
|
15
10
|
t.libs << 'lib'
|
16
11
|
t.libs << 'test'
|
17
|
-
|
18
|
-
if PLATFORM =~ /mingw/
|
19
|
-
files = FileList['test/**/server_ms_test*']
|
20
|
-
else
|
21
|
-
files = FileList['test/**/*_test.rb'].delete_if{|f| f =~ /_ms_/}
|
22
|
-
end
|
23
|
-
t.test_files = files
|
12
|
+
t.test_files = FileList['test/**/*_test.rb']
|
24
13
|
t.verbose = true
|
25
14
|
end
|
data/bin/smart-proxy-abrt-send
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# XXX I can't think of a sane way to not hardcode the paths: the RPM package of
|
4
|
+
# smart-proxy does not contain a gem so the gem machinery cannot be used. And
|
5
|
+
# we can't have it in the config because we need smart_proxy to read it ...
|
6
|
+
$LOAD_PATH.unshift '/usr/share/foreman-proxy/lib'
|
7
|
+
$LOAD_PATH.unshift '/usr/share/foreman-proxy/modules'
|
5
8
|
|
6
9
|
# We rely on the main smart_proxy module to initialize the plugins so that we
|
7
10
|
# can access our module's settings. Also used from smart-proxy code: global
|
@@ -1,2 +1,2 @@
|
|
1
|
-
# Send collected ABRT reports once every
|
1
|
+
# Send collected ABRT reports once every 30 minutes
|
2
2
|
*/30 * * * * foreman-proxy smart-proxy-abrt-send
|
@@ -4,21 +4,21 @@ require 'uri'
|
|
4
4
|
require 'time'
|
5
5
|
require 'fileutils'
|
6
6
|
|
7
|
+
require 'openssl'
|
8
|
+
|
7
9
|
require 'proxy/log'
|
8
10
|
require 'proxy/request'
|
9
11
|
|
10
12
|
module Proxy::Abrt
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
length.times { result << base[rand(base.size)] }
|
15
|
-
result
|
13
|
+
# Returns hex representation of random bytes-long number
|
14
|
+
def self.random_hex_string(nbytes)
|
15
|
+
OpenSSL::Random.random_bytes(nbytes).unpack('H*').join
|
16
16
|
end
|
17
17
|
|
18
18
|
# Generate multipart boundary separator
|
19
19
|
def self.suggest_separator
|
20
20
|
separator = "-"*28
|
21
|
-
separator + self.
|
21
|
+
separator + self.random_hex_string(16)
|
22
22
|
end
|
23
23
|
|
24
24
|
# It seems that Net::HTTP does not support multipart/form-data - this function
|
@@ -220,7 +220,7 @@ module Proxy::Abrt
|
|
220
220
|
end
|
221
221
|
|
222
222
|
def self.unique_filename(prefix)
|
223
|
-
File.join(HostReport.spooldir, prefix + Proxy::Abrt::
|
223
|
+
File.join(HostReport.spooldir, prefix + Proxy::Abrt::random_hex_string(8))
|
224
224
|
end
|
225
225
|
|
226
226
|
def self.with_unique_filename(prefix)
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'test/unit'
|
2
|
+
require 'mocha/setup'
|
3
|
+
require 'rack/test'
|
3
4
|
|
4
|
-
|
5
|
-
logdir = File.join(File.dirname(__FILE__), '..', 'logs')
|
6
|
-
FileUtils.mkdir_p(logdir) unless File.exists?(logdir)
|
5
|
+
require 'smart_proxy_for_testing'
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
APP_ROOT = File.join(File.dirname(__FILE__), '..')
|
7
|
+
# create log directory in our (not smart-proxy) directory
|
8
|
+
FileUtils.mkdir_p File.dirname(Proxy::SETTINGS.log_file)
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_abrt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Milata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
12
|
-
dependencies:
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: satyr
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
13
27
|
description: This smart proxy plugin, together with a Foreman plugin, add the capability
|
14
28
|
to send ABRT micro-reports from your managed hosts to Foreman.
|
15
29
|
email: mmilata@redhat.com
|
@@ -36,7 +50,6 @@ files:
|
|
36
50
|
- test/abrt_test.rb
|
37
51
|
- test/abrt_api_test.rb
|
38
52
|
- extra/foreman-proxy-abrt-send.cron
|
39
|
-
- extra/rubygem-smart_proxy_abrt.spec
|
40
53
|
- README
|
41
54
|
- LICENSE
|
42
55
|
- Rakefile
|
@@ -1,110 +0,0 @@
|
|
1
|
-
%global gem_name smart_proxy_abrt
|
2
|
-
|
3
|
-
%global foreman_proxy_bundlerd_dir /usr/share/foreman-proxy/bundler.d
|
4
|
-
%global foreman_proxy_pluginconf_dir /etc/foreman-proxy/settings.d
|
5
|
-
%global spool_dir /var/spool/foreman-proxy-abrt
|
6
|
-
|
7
|
-
Name: rubygem-%{gem_name}
|
8
|
-
Version: 0.0.1
|
9
|
-
Release: 1%{?dist}
|
10
|
-
Summary: Automatic Bug Reporting Tool plugin for Foreman's smart proxy
|
11
|
-
Group: Applications/Internet
|
12
|
-
License: GPLv3
|
13
|
-
URL: http://github.com/abrt/smart-proxy-abrt
|
14
|
-
Source0: https://fedorahosted.org/released/abrt/%{gem_name}-%{version}.gem
|
15
|
-
Requires: ruby(release)
|
16
|
-
Requires: ruby(rubygems)
|
17
|
-
Requires: rubygem(ffi)
|
18
|
-
Requires: foreman-proxy >= 1.6.0
|
19
|
-
Requires: crontabs
|
20
|
-
## does not exist in repository yet
|
21
|
-
#Requires: rubygem-satyr
|
22
|
-
BuildRequires: ruby(release)
|
23
|
-
BuildRequires: rubygems-devel
|
24
|
-
BuildRequires: ruby
|
25
|
-
BuildRequires: rubygem(ffi)
|
26
|
-
BuildRequires: rubygem(minitest)
|
27
|
-
BuildArch: noarch
|
28
|
-
Provides: rubygem(%{gem_name}) = %{version}
|
29
|
-
|
30
|
-
%description
|
31
|
-
This smart proxy plugin, together with a Foreman plugin, add the capability to
|
32
|
-
send ABRT micro-reports from your managed hosts to Foreman.
|
33
|
-
|
34
|
-
%package doc
|
35
|
-
Summary: Documentation for %{name}
|
36
|
-
Group: Documentation
|
37
|
-
Requires:%{name} = %{version}-%{release}
|
38
|
-
|
39
|
-
%description doc
|
40
|
-
Documentation for %{name}
|
41
|
-
|
42
|
-
%prep
|
43
|
-
gem unpack %{SOURCE0}
|
44
|
-
%setup -q -D -T -n %{gem_name}-%{version}
|
45
|
-
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
|
46
|
-
|
47
|
-
%build
|
48
|
-
# Create the gem as gem install only works on a gem file
|
49
|
-
gem build %{gem_name}.gemspec
|
50
|
-
|
51
|
-
# %%gem_install compiles any C extensions and installs the gem into ./%gem_dir
|
52
|
-
# by default, so that we can move it into the buildroot in %%install
|
53
|
-
%gem_install
|
54
|
-
|
55
|
-
%install
|
56
|
-
# Packaging guidelines say: Do not ship tests
|
57
|
-
rm -r .%{gem_instdir}/test .%{gem_instdir}/Rakefile
|
58
|
-
rm .%{gem_instdir}/extra/*.spec
|
59
|
-
|
60
|
-
mkdir -p %{buildroot}%{gem_dir}
|
61
|
-
cp -a .%{gem_dir}/* \
|
62
|
-
%{buildroot}%{gem_dir}/
|
63
|
-
|
64
|
-
# executables
|
65
|
-
mkdir -p %{buildroot}%{_bindir}
|
66
|
-
cp -a .%{_bindir}/* \
|
67
|
-
%{buildroot}%{_bindir}
|
68
|
-
|
69
|
-
# bundler file
|
70
|
-
mkdir -p %{buildroot}%{foreman_proxy_bundlerd_dir}
|
71
|
-
mv %{buildroot}%{gem_instdir}/bundler.d/abrt.rb \
|
72
|
-
%{buildroot}%{foreman_proxy_bundlerd_dir}
|
73
|
-
|
74
|
-
# sample config
|
75
|
-
mkdir -p %{buildroot}%{foreman_proxy_pluginconf_dir}
|
76
|
-
mv %{buildroot}%{gem_instdir}/settings.d/abrt.yml.example \
|
77
|
-
%{buildroot}%{foreman_proxy_pluginconf_dir}/
|
78
|
-
|
79
|
-
# crontab
|
80
|
-
mkdir -p %{buildroot}%{_sysconfdir}/cron.d/
|
81
|
-
mv %{buildroot}%{gem_instdir}/extra/foreman-proxy-abrt-send.cron \
|
82
|
-
%{buildroot}%{_sysconfdir}/cron.d/%{name}
|
83
|
-
|
84
|
-
# create spool directory
|
85
|
-
mkdir -p %{buildroot}%{spool_dir}
|
86
|
-
|
87
|
-
#%check
|
88
|
-
#testrb -Ilib test
|
89
|
-
|
90
|
-
%files
|
91
|
-
%dir %{gem_instdir}
|
92
|
-
%{gem_libdir}
|
93
|
-
%exclude %{gem_cache}
|
94
|
-
%{gem_spec}
|
95
|
-
%{gem_instdir}/bin
|
96
|
-
|
97
|
-
%dir %attr(0755, foreman-proxy, foreman-proxy) %{spool_dir}
|
98
|
-
%{foreman_proxy_bundlerd_dir}/abrt.rb
|
99
|
-
%{_bindir}/smart-proxy-abrt-send
|
100
|
-
%doc %{foreman_proxy_pluginconf_dir}/abrt.yml.example
|
101
|
-
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
|
102
|
-
|
103
|
-
%files doc
|
104
|
-
%{gem_docdir}
|
105
|
-
%{gem_instdir}/README
|
106
|
-
%{gem_instdir}/LICENSE
|
107
|
-
|
108
|
-
%changelog
|
109
|
-
* Tue Jul 15 2014 Martin Milata <mmilata@redhat.com> - 0.0.1-1
|
110
|
-
- Initial package
|