mongoid 7.2.0 → 7.2.4

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 (70) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +1 -1
  5. data/lib/mongoid/attributes.rb +8 -1
  6. data/lib/mongoid/criteria/queryable/selector.rb +0 -4
  7. data/lib/mongoid/document.rb +3 -2
  8. data/lib/mongoid/errors/mongoid_error.rb +1 -1
  9. data/lib/mongoid/interceptable.rb +3 -1
  10. data/lib/mongoid/matcher.rb +19 -43
  11. data/lib/mongoid/matcher/elem_match.rb +2 -1
  12. data/lib/mongoid/matcher/expression.rb +5 -14
  13. data/lib/mongoid/matcher/field_expression.rb +4 -5
  14. data/lib/mongoid/matcher/field_operator.rb +7 -11
  15. data/lib/mongoid/reloadable.rb +5 -0
  16. data/lib/mongoid/validatable/associated.rb +1 -1
  17. data/lib/mongoid/validatable/presence.rb +3 -3
  18. data/lib/mongoid/validatable/uniqueness.rb +1 -1
  19. data/lib/mongoid/version.rb +1 -1
  20. data/lib/rails/generators/mongoid/config/config_generator.rb +8 -1
  21. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +1 -1
  22. data/spec/integration/app_spec.rb +174 -84
  23. data/spec/integration/callbacks_models.rb +49 -0
  24. data/spec/integration/callbacks_spec.rb +216 -0
  25. data/spec/integration/document_spec.rb +21 -0
  26. data/spec/integration/matcher_operator_data/elem_match.yml +46 -0
  27. data/spec/integration/matcher_operator_data/gt_types.yml +63 -0
  28. data/spec/integration/matcher_operator_data/gte_types.yml +15 -0
  29. data/spec/integration/matcher_operator_data/implicit_traversal.yml +96 -0
  30. data/spec/integration/matcher_operator_data/lt_types.yml +15 -0
  31. data/spec/integration/matcher_operator_data/lte_types.yml +15 -0
  32. data/spec/integration/matcher_operator_data/ne_types.yml +15 -0
  33. data/spec/lite_spec_helper.rb +3 -4
  34. data/spec/mongoid/association/embedded/embedded_in/proxy_spec.rb +50 -0
  35. data/spec/mongoid/atomic/paths_spec.rb +41 -0
  36. data/spec/mongoid/attributes_spec.rb +241 -0
  37. data/spec/mongoid/contextual/atomic_spec.rb +17 -4
  38. data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +36 -0
  39. data/spec/mongoid/document_fields_spec.rb +26 -0
  40. data/spec/mongoid/document_query_spec.rb +51 -0
  41. data/spec/mongoid/errors/mongoid_error_spec.rb +20 -8
  42. data/spec/mongoid/matcher/extract_attribute_data/numeric_keys.yml +104 -0
  43. data/spec/mongoid/matcher/extract_attribute_data/traversal.yml +68 -88
  44. data/spec/mongoid/matcher/extract_attribute_spec.rb +3 -13
  45. data/spec/mongoid/persistable/settable_spec.rb +30 -0
  46. data/spec/mongoid/persistable_spec.rb +2 -2
  47. data/spec/shared/bin/get-mongodb-download-url +17 -0
  48. data/spec/shared/bin/s3-copy +45 -0
  49. data/spec/shared/bin/s3-upload +69 -0
  50. data/spec/shared/lib/mrss/cluster_config.rb +226 -0
  51. data/spec/shared/lib/mrss/constraints.rb +71 -6
  52. data/spec/shared/lib/mrss/docker_runner.rb +271 -0
  53. data/spec/shared/lib/mrss/lite_constraints.rb +16 -0
  54. data/spec/shared/lib/mrss/server_version_registry.rb +115 -0
  55. data/spec/shared/lib/mrss/spec_organizer.rb +32 -2
  56. data/spec/shared/lib/mrss/utils.rb +15 -0
  57. data/spec/shared/share/Dockerfile.erb +322 -0
  58. data/spec/shared/share/haproxy-1.conf +16 -0
  59. data/spec/shared/share/haproxy-2.conf +17 -0
  60. data/spec/shared/shlib/distro.sh +73 -0
  61. data/spec/shared/shlib/server.sh +317 -0
  62. data/spec/shared/shlib/set_env.sh +131 -0
  63. data/spec/spec_helper.rb +1 -1
  64. data/spec/support/models/customer.rb +11 -0
  65. data/spec/support/models/customer_address.rb +12 -0
  66. data/spec/support/models/dictionary.rb +6 -0
  67. data/spec/support/models/mop.rb +10 -0
  68. data/spec/support/spec_config.rb +8 -0
  69. metadata +554 -508
  70. metadata.gz.sig +3 -2
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ module Mrss
5
+ module Utils
6
+
7
+ module_function def print_backtrace(dest=STDERR)
8
+ begin
9
+ hello world
10
+ rescue => e
11
+ dest.puts e.backtrace.join("\n")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,322 @@
1
+ # Python toolchain as of this writing is available on rhel62, debian92 and
2
+ # ubuntu1604.
3
+ #
4
+ # To run rhel62 in docker, host system must be configured to emulate syscalls:
5
+ # https://github.com/CentOS/sig-cloud-instance-images/issues/103
6
+
7
+ <%
8
+
9
+ python_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-python-driver-toolchain/#{distro}/ba92de2700c04ee2d4f82c3ffdfc33105140cb04/mongo_python_driver_toolchain_#{distro.gsub('-', '_')}_ba92de2700c04ee2d4f82c3ffdfc33105140cb04_19_11_14_15_33_33.tar.gz"
10
+ server_version = '4.3.3'
11
+ server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
12
+ server_archive_basename = File.basename(server_url)
13
+ server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
14
+
15
+ toolchain_upper='291ba4a4e8297f142796e70eee71b99f333e35e1'
16
+
17
+ ruby_toolchain_url = "http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/ruby-toolchain-#{distro}-#{toolchain_upper}.tar.xz"
18
+ #ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{toolchain_upper}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{toolchain_upper}_#{toolchain_lower}.tar.gz"
19
+
20
+ %>
21
+
22
+ FROM <%= base_image %>
23
+
24
+ <% if debian? %>
25
+
26
+ ENV DEBIAN_FRONTEND=noninteractive
27
+
28
+ <% else %>
29
+
30
+ RUN echo assumeyes=1 |tee -a /etc/yum.conf
31
+
32
+ <% end %>
33
+
34
+ <% if ruby_head? %>
35
+
36
+ # To use current versions of mlaunch, Python 3.6+ is required.
37
+ # Most distros ship with older Pythons, therefore we need to install
38
+ # a newer Python from somewhere. This section installs the Python
39
+ # toolhcain which comes with recent Pythons.
40
+ # Alternatively, Ruby toolchain compiles its own copy of Python 3 but
41
+ # this is currently incomplete in that on older distros with old OpenSSL,
42
+ # the built Python has no ssl module and hence practically is unusable.
43
+ # Currently Ruby driver uses mtools-legacy which supports Python 2,
44
+ # avoiding this entire issue for the time being.
45
+
46
+ #RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
47
+ #RUN tar -xC /opt -zf python-toolchain.tar.gz
48
+
49
+ <% end %>
50
+
51
+ <% if debian? %>
52
+
53
+ # zsh is not required for any scripts but it is a better interactive shell
54
+ # than bash.
55
+ # Ruby runtime dependencies: libyaml-0-2
56
+ # Compiling ruby libraries: gcc make
57
+ # Compiling pyhton packages: python2.7-dev
58
+ # JRuby: openjdk-8-jre-headless
59
+ # Server dependencies: libsnmp30 libcurl3/libcurl4
60
+ # Determining OS we are running on: lsb-release
61
+ # Load balancer testing: haproxy
62
+ # Kerberos testing: krb5-user
63
+ # Local Kerberos server: krb5-kdc krb5-admin-server
64
+ # Installing mlaunch from git: git
65
+ # ruby-head archive: bzip2
66
+ # nio4r on JRuby: libgmp-dev
67
+ # Snappy compression: libsnappy-dev
68
+ # nokogiri: zlib1g-dev
69
+ # Mongoid testing: tzdata shared-mime-info
70
+ # Mongoid application testing: nodejs (8.x or newer)
71
+ #
72
+ # We currently use Python 2-compatible version of mtools, which
73
+ # is installable via pip (which uses Python 2). All of the MongoDB
74
+ # distros have pip installed (but none as of this writing have pip3)
75
+ # therefore install python-pip in all configurations here.
76
+
77
+ <% packages = %w(
78
+ lsb-release bzip2 curl zsh
79
+ git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
80
+ krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
81
+ haproxy
82
+ python3-pip
83
+ tzdata shared-mime-info
84
+ ) %>
85
+
86
+ <% if distro =~ /ubuntu1404/ %>
87
+ # For building python & setuptools
88
+ <% packages += %w(libssl-dev unzip) %>
89
+ <% end %>
90
+
91
+ <% if distro !~ /ubuntu2004/ %>
92
+ <% packages += %w(python2.7-dev) %>
93
+ <% end %>
94
+
95
+ <% if distro =~ /ubuntu2004/ %>
96
+ <% packages << 'libsnmp35' %>
97
+ <% else %>
98
+ <% packages << 'libsnmp30' %>
99
+ <% end %>
100
+
101
+ <% if distro !~ /ubuntu2004/ %>
102
+ <% packages << 'python-pip' %>
103
+ <% end %>
104
+
105
+ <% if distro =~ /debian10/ %>
106
+ <% packages << 'openjdk-11-jre-headless' %>
107
+ <% elsif distro =~ /ubuntu1404/ %>
108
+ # Ubuntu 14.04 only has openjdk 7, this is too old to be useful
109
+ <% else %>
110
+ <% packages << 'openjdk-8-jre-headless' %>
111
+ <% end %>
112
+
113
+ # ubuntu1404, ubuntu1604: libcurl3
114
+ # ubuntu1804, ubuntu2004, debian10: libcurl4
115
+ <% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
116
+ <% packages << 'libcurl4' %>
117
+ <% else %>
118
+ <% packages << 'libcurl3' %>
119
+ <% end %>
120
+
121
+ <% if distro =~ /ubuntu1804/ %>
122
+ <% packages << 'nodejs' %>
123
+ <% end %>
124
+
125
+ <% if distro =~ /ubuntu2004/ %>
126
+ <% packages += %w(ruby ruby2.7 bundler python2 python2-dev) %>
127
+ <% end %>
128
+
129
+ RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
130
+ <% else %>
131
+
132
+ <% if distro =~ /rhel6/ %>
133
+
134
+ # CentOS 6 is dead - to use it retrieve the packages from vault:
135
+ # https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
136
+
137
+ <%
138
+
139
+ cfg = <<-CFG
140
+ [base]
141
+ name=CentOS-$releasever - Base
142
+ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
143
+ #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
144
+ baseurl=http://vault.centos.org/6.10/os/x86_64/
145
+ gpgcheck=1
146
+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
147
+ CFG
148
+
149
+ %>
150
+
151
+ RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
152
+
153
+ <% end %>
154
+
155
+ # Enterprise server: net-snmp
156
+ # lsb_release: redhat-lsb-core
157
+ # our runner scripts: which
158
+ # Ruby dependency: libyaml
159
+ # compiling python packages: gcc python-devel
160
+ # Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
161
+ # mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
162
+ # Local Kerberos server: krb5-server
163
+ # JRuby: java-1.8.0-openjdk
164
+ #
165
+ # Note: lacking cyrus-sasl-gssapi produces a cryptic message
166
+ # "SASL(-4): no mechanism available: No worthy mechs found"
167
+ # https://github.com/farorm/python-ad/issues/10
168
+
169
+ RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
170
+ krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
171
+ net-snmp python3
172
+
173
+ <% if distro =~ /rhel6/ %>
174
+
175
+ # RHEL 6 ships with Python 2.6.
176
+
177
+ RUN yum install -y centos-release-scl && \
178
+ yum install -y python27-python python27-python-devel
179
+ ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
180
+ LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
181
+
182
+ <% else %>
183
+
184
+ RUN yum install -y python-devel
185
+
186
+ <% end %>
187
+
188
+ <% end %>
189
+
190
+ <% if preload? %>
191
+
192
+ <% if distro =~ /ubuntu1404/ %>
193
+
194
+ # I couldn't find a prebuilt package of anything more recent than 2.7.6
195
+ # for 14.04.
196
+ RUN curl --retry 3 -fL https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz | \
197
+ tar xfJ - && \
198
+ cd Python-2.7.16 && \
199
+ ./configure && \
200
+ nice make -j4 && \
201
+ make install && \
202
+ cd .. && rm -rf Python-2.7.16
203
+
204
+ ENV PATH=/usr/local/bin:$PATH
205
+
206
+ RUN curl --retry 3 -fL -o setuptools-44.1.1.zip https://files.pythonhosted.org/packages/b2/40/4e00501c204b457f10fe410da0c97537214b2265247bc9a5bc6edd55b9e4/setuptools-44.1.1.zip && \
207
+ unzip setuptools-44.1.1.zip && \
208
+ cd setuptools-44.1.1 && \
209
+ python setup.py install && \
210
+ cd .. && rm -rf setuptools-44.1.1
211
+
212
+ <% end%>
213
+
214
+ <% if true || distro =~ /rhel|ubuntu1604/ %>
215
+
216
+ # Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
217
+ #
218
+ # Ubuntu 16.04 apparently also ships a pip that does not work:
219
+ # https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
220
+ # Potentially this only affects environments with less than ideal
221
+ # connectivity (or, perhaps, when python package registry is experiencing
222
+ # availability issues) when pip must retry to install packages.
223
+ #
224
+ # rhel apparently does not package pip at all in core repoitories,
225
+ # therefore install it the manual way.
226
+ #
227
+ # https://pip.pypa.io/en/stable/installing/
228
+ RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
229
+
230
+ <% end %>
231
+
232
+ # Current virtualenv fails with
233
+ # https://github.com/pypa/virtualenv/issues/1630
234
+ <% if distro =~ /ubuntu2004/ %>
235
+ RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
236
+ <% else %>
237
+ RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
238
+ <% end %>
239
+
240
+ RUN pip --version && \
241
+ pip install mtools-legacy[mlaunch]
242
+
243
+ <% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
244
+ # ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
245
+ # as specified by dependencies, causing OCSP mock to not work.
246
+ RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
247
+ <% end %>
248
+
249
+ <% unless ruby_head? || system_ruby? %>
250
+
251
+ RUN curl --retry 3 -fL <%= ruby_toolchain_url %> |tar -xC /opt -Jf -
252
+ ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
253
+ USE_OPT_TOOLCHAIN=1
254
+ #ENV PATH=/opt/rubies/python/3/bin:$PATH
255
+
256
+ <% end %>
257
+
258
+ RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
259
+ mv mongo*/ /opt/mongodb
260
+ ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
261
+
262
+ <% end %>
263
+
264
+ <% if distro =~ /debian|ubuntu/ %>
265
+ # mkdir was moved from /usr/bin to /bin and MongoDB's distros
266
+ # apparently keep using the old location.
267
+ # This definitely affects debian10.
268
+ # https://stackoverflow.com/questions/64653051/make-usr-bin-mkdir-command-not-found-during-gem-install-nokogiri-in-ubuntu
269
+ RUN test -f /usr/bin/mkdir || ln -s /bin/mkdir /usr/bin/mkdir
270
+ <% end %>
271
+
272
+ WORKDIR /app
273
+
274
+ <% if preload? && !ruby_head? %>
275
+
276
+ COPY Gemfile .
277
+ COPY gemfiles gemfiles
278
+ COPY *.gemspec .
279
+ COPY lib/<%= project_lib_subdir %>/version.rb lib/<%= project_lib_subdir %>/version.rb
280
+ RUN bundle install
281
+ COPY .evergreen/patch-debuggers .evergreen/patch-debuggers
282
+ <% if system_ruby? %>
283
+ # Running under docker with root access
284
+ RUN .evergreen/patch-debuggers /var/lib/gems
285
+ <% else %>
286
+ RUN .evergreen/patch-debuggers /opt/rubies
287
+ <% end %>
288
+
289
+ <% end %>
290
+
291
+ <% if fle? %>
292
+ RUN curl --retry 3 -fLo libmongocrypt-all.tar.gz "https://s3.amazonaws.com/mciuploads/libmongocrypt/all/master/latest/libmongocrypt-all.tar.gz"
293
+ RUN tar xf libmongocrypt-all.tar.gz
294
+
295
+ <%= "ENV LIBMONGOCRYPT_PATH #{libmongocrypt_path}" %>
296
+ <% end %>
297
+
298
+ ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
299
+ PROJECT_DIRECTORY=/app \
300
+ <%= @env.map { |k, v| %Q`#{k}="#{v.gsub('$', "\\$").gsub('"', "\\\"")}"` }.join(" \\\n ") %>
301
+
302
+ <% if interactive? %>
303
+ ENV INTERACTIVE=1
304
+ <% end %>
305
+
306
+ COPY . .
307
+
308
+ <% if expose? %>
309
+
310
+ <% ports = [] %>
311
+
312
+ <% 0.upto(num_exposed_ports-1) do |i| %>
313
+ <% ports << 27017 + i %>
314
+ <% end %>
315
+
316
+ <% if @env['OCSP_ALGORITHM'] %>
317
+ <% ports << 8100 %>
318
+ <% end %>
319
+
320
+ EXPOSE <%= ports.map(&:to_s).join(' ') %>
321
+
322
+ <% end %>
@@ -0,0 +1,16 @@
1
+ # Modeled after
2
+ # https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
3
+
4
+ defaults
5
+ mode tcp
6
+ timeout connect 7s
7
+ timeout client 55s
8
+ timeout server 55s
9
+
10
+ frontend mongos_frontend
11
+ bind *:27017
12
+ use_backend mongos_backend
13
+
14
+ backend mongos_backend
15
+ mode tcp
16
+ server mongos_one 127.0.0.1:27117 check
@@ -0,0 +1,17 @@
1
+ # Modeled after
2
+ # https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
3
+
4
+ defaults
5
+ mode tcp
6
+ timeout connect 7s
7
+ timeout client 55s
8
+ timeout server 55s
9
+
10
+ frontend mongos_frontend
11
+ bind *:27017
12
+ use_backend mongos_backend
13
+
14
+ backend mongos_backend
15
+ mode tcp
16
+ server mongos_one 127.0.0.1:27117 check
17
+ server mongos_two 127.0.0.1:27118 check
@@ -0,0 +1,73 @@
1
+ detected_distro=
2
+
3
+ host_distro() {
4
+ if test -z "$detected_distro"; then
5
+ detected_distro=`_detect_distro`
6
+ fi
7
+ echo "$detected_distro"
8
+ }
9
+
10
+ _detect_distro() {
11
+ local distro
12
+ distro=
13
+ if test -f /etc/debian_version; then
14
+ # Debian or Ubuntu
15
+ if test "`uname -m`" = aarch64; then
16
+ distro=ubuntu1604-arm
17
+ elif lsb_release -is |grep -q Debian; then
18
+ release=`lsb_release -rs |tr -d .`
19
+ # In docker, release is something like 9.11.
20
+ # In evergreen, release is 9.2.
21
+ release=`echo $release |sed -e 's/^9.*/92/'`
22
+ distro="debian$release"
23
+ elif lsb_release -is |grep -q Ubuntu; then
24
+ if test "`uname -m`" = ppc64le; then
25
+ release=`lsb_release -rs |tr -d .`
26
+ distro="ubuntu$release-ppc"
27
+ else
28
+ release=`lsb_release -rs |tr -d .`
29
+ distro="ubuntu$release"
30
+ fi
31
+ else
32
+ echo 'Unknown Debian flavor' 1>&2
33
+ exit 1
34
+ fi
35
+ elif lsb_release -is |grep -qi suse; then
36
+ if test "`uname -m`" = s390x; then
37
+ release=`lsb_release -rs |sed -e 's/\..*//'`
38
+ distro="suse$release-s390x"
39
+ else
40
+ echo 'Unknown Suse arch' 1>&2
41
+ exit 1
42
+ fi
43
+ elif test -f /etc/redhat-release; then
44
+ # RHEL or CentOS
45
+ if test "`uname -m`" = s390x; then
46
+ distro=rhel72-s390x
47
+ elif test "`uname -m`" = ppc64le; then
48
+ distro=rhel71-ppc
49
+ elif lsb_release >/dev/null 2>&1; then
50
+ if lsb_release -is |grep -q RedHat; then
51
+ release=`lsb_release -rs |tr -d .`
52
+ distro="rhel$release"
53
+ elif lsb_release -is |grep -q CentOS; then
54
+ release=`lsb_release -rs |cut -c 1 |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
55
+ distro="rhel$release"
56
+ else
57
+ echo 'Unknown RHEL flavor' 1>&2
58
+ exit 1
59
+ fi
60
+ else
61
+ echo lsb_release missing, using /etc/redhat-release 1>&2
62
+ release=`grep -o 'release [0-9]' /etc/redhat-release |awk '{print $2}'`
63
+ release=`echo $release |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
64
+ distro=rhel$release
65
+ fi
66
+ else
67
+ lsb_release -a
68
+ echo 'Unknown distro' 1>&2
69
+ exit 1
70
+ fi
71
+ echo "Detected distro: $distro" 1>&2
72
+ echo $distro
73
+ }