LINUX.ORG.RU

Сообщения chemtech

 

Как параметризовать значение в словаре в vars/main.yml в ansible-playbook?

Имеется vars/main.yml с:

postgresql_parameters:
  - { option: "archive_command",                     value: "cd ."    } # not doing anything yet with WAL-s

Как параметризовать значение в словаре в vars/main.yml в ansible-playbook?

Например, если wal_g_install == «true» то value будет «wal-g wal-push ‘%p’»

А если wal_g_install == «false», то ничего не менять.

 

chemtech
()

Rewriting paths in CSS & JS via nginx's sub_filter сайта mirror.centos.org

Пытаюсь через nginx перенаправить весь трафик на сайт mirror.centos.org

Если использовать location «/» и просто перенаправлять трафик на удаленный yum репозиторий, то все работает.

Но нужно сделать для каждого отдельного YUM репозитория отдельный location.

server {
    listen       443 ssl;
    server_name  yum-proxy.mycompany.ltd;

    location /mirror-centos-org/ {
        rewrite ^(/mirror-centos-org)$ $1/;
        rewrite ^/mirror-centos-org(.+) $1 break;

        sub_filter "yum-proxy.mycompany.ltd" "yum-proxy.mycompany.ltd/mirror-centos-org/";
        sub_filter "'/" "'/mirror-centos-org/";
        sub_filter '"/' '"/mirror-centos-org/';
        sub_filter_types text/html text/css text/javascript application/javascript;
        sub_filter_once on;

        proxy_redirect off;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host mirror.centos.org;
        proxy_set_header Connection "";
        proxy_http_version 1.1;
        proxy_pass http://mirror.centos.org/;
    }
}

Вроде конфиг верный, но CSS и HTML кое-где содержат «yum-proxy.mycompany.ltd» вместо "yum-proxy.mycompany.ltd/mirror-centos-org/

https://habrastorage.org/webt/fv/se/fx/fvsefx9j5wsu_7yr47xcvfjg-ik.png

Как сделать чтобы ко все «yum-proxy.mycompany.ltd» заменялись на "yum-proxy.mycompany.ltd/mirror-centos-org/ ?

 

chemtech
()

Error: Package Requires: python2-dateutil = 2.8.0 Installed: 1:python2-dateutil-2.8.0-1.el7.noarch

Имеется SPEC файл botocore-1.5.70.spec:

# Created by pyp2rpm-3.3.3
%global pypi_name botocore

Name:           python-%{pypi_name}
Version:        1.5.70
Release:        1%{?dist}
Summary:        Low-level, data-driven core of boto 3

License:        Apache License 2.0
URL:            https://github.com/boto/botocore
Source0:        https://files.pythonhosted.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
#BuildRequires:  python2-dateutil = 2.8.0

%description
 A low-level interface to a growing number of Amazon Web Services. The botocore
package is the foundation for the AWS CLI < as well as boto3 < Documentation -
Documentation for botocore can be found on Read the Docs <

%package -n     python2-%{pypi_name}
Summary:        Low-level, data-driven core of boto 3

Requires:       python2-dateutil == 2.8.0
%description -n python2-%{pypi_name}
 A low-level interface to a growing number of Amazon Web Services. The botocore
package is the foundation for the AWS CLI < as well as boto3 < Documentation -
Documentation for botocore can be found on Read the Docs <


%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

%build
%{__python2} setup.py build

%install
%{__python2} setup.py install --skip-build --root %{buildroot}

%files -n python2-%{pypi_name}
%doc README.rst tests/unit/response_parsing/README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info

%changelog
* Tue Mar 24 2020 Cloud User - 1.5.70-1
- Initial package.

Перед сборкой и установкой установил пакет

sudo yum install -y https://cbs.centos.org/kojifiles/packages/python-dateutil/2.8.0/1.el7/noarch/python2-dateutil-2.8.0-1.el7.noarch.rpm

LANG=C sudo yum install -y rpmbuild/RPMS/noarch/python2-botocore-1.5.70-1.el7.noarch.rpm
Loaded plugins: fastestmirror
Examining rpmbuild/RPMS/noarch/python2-botocore-1.5.70-1.el7.noarch.rpm: python2-botocore-1.5.70-1.el7.noarch
Marking rpmbuild/RPMS/noarch/python2-botocore-1.5.70-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package python2-botocore.noarch 0:1.5.70-1.el7 will be installed
--> Processing Dependency: python2-dateutil = 2.8.0 for package: python2-botocore-1.5.70-1.el7.noarch
Loading mirror speeds from cached hostfile
 * base: mirrors.xservers.ro
 * epel: fedora-mirror02.rbc.ru
 * extras: mirrors.xservers.ro
 * updates: mirrors.xservers.ro
--> Finished Dependency Resolution
Error: Package: python2-botocore-1.5.70-1.el7.noarch (/python2-botocore-1.5.70-1.el7.noarch)
           Requires: python2-dateutil = 2.8.0
           Installed: 1:python2-dateutil-2.8.0-1.el7.noarch (installed)
               python2-dateutil = 1:2.8.0-1.el7
           Available: python2-dateutil-1.5-0.el7.noarch (epel)
               python2-dateutil = 1.5-0.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Почему ошибка? Версия верная.

 

chemtech
()

как с автоматически добавить эту строку %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*.... ?

Собираю python пакеты в rpm. В sentry-sdk-0.14.1.spec после строки

%global pypi_name sentry-sdk

нужно добавить строку

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') 

для запрета перекомпиляции python файлов. Иначе будет ошибка.

как с автоматически добавить эту строку %global __os_install_post %(echo ‘%{__os_install_post}’ | sed -e ‘s!/usr/lib[^[:space:]]/brp-python-bytecompile[[:space:]].$!!g’) ?

Подробнее тут https://github.com/patsevanton/sentry-rpm

 ,

chemtech
()

AWX RPM Creating instance group tower Instance does not exist: awx-apatsev-2

Тестирую AWX RPM

AWX — это бесплатный open source проект, распространяющийся под лицензией Apache-2.0 и являющийся апстримом для коммерческого проекта Ansible Tower.

AWX это некий инструмент, который можно применять совместно с Ansible. Он никоим образом не дублирует и не копирует возможности Ansible - вместо действительно, когда плейбуки Ansible запускаются из AWX, сам выполняемый файл ansible-playbook остаётся за кулисами.

Запускаю:

ansible-playbook deploy_awx-rpm.yml

Пишет такую ошибку:

TASK [master_instance : Add instances to ‘tower’ instance group] *********************************************************************************************************************************************
fatal: [awx-apatsev-2]: FAILED! => {
    "changed": true, 
    "cmd": "scl enable rh-python36 rh-postgresql10 'awx-manage register_queue --queuename=tower --hostnames=\"awx-apatsev-2,awx-apatsev-3,awx-apatsev-4\"'", 
    "delta": "0:00:03.459911", 
    "end": "2020-03-03 07:25:25.053371", 
    "rc": 1, 
    "start": "2020-03-03 07:25:21.593460"
}

STDOUT:

Creating instance group tower
Instance does not exist: awx-apatsev-2


MSG:

non-zero return code

Инвентарь

[db]
awx-apatsev-1 ansible_host=172.26.9.187

[nodes]
awx-apatsev-2 ansible_host=172.26.9.186
awx-apatsev-3 ansible_host=172.26.9.19
awx-apatsev-4 ansible_host=172.26.9.189

Пытаюсь сделать вручную:

[centos@awx-apatsev-2 ~]$ sudo su -
[root@awx-apatsev-2 ~]# scl enable rh-python36 rh-postgresql10 'awx-manage register_queue --queuename=tower --hostnames=\"awx-apatsev-2,awx-apatsev-3,awx-apatsev-4\"'
Instance Group already registered tower
Instance does not exist: awx-apatsev-4"
[root@awx-apatsev-2 ~]# 

 ,

chemtech
()

rabbitmqctl join_cluster Error on AMQP «broker forced connection closure with reason 'shutdown'

Устанавливаю awx через ansible playbook https://github.com/nizarlazuardy/deploy_awx-rpm

Playbook валится с ошибкой:

TASK [nodes_join : Create RabbitMQ cluster] ******************************************************************************************************************************************************************
fatal: [172.26.9.173]: FAILED! => {
    "changed": true, 
    "cmd": "rabbitmqctl stop_app\nrabbitmqctl join_cluster rabbit@\"172.26.9.172\"\n", 
    "delta": "0:00:01.755605", 
    "end": "2020-03-02 10:01:41.939947", 
    "rc": 69, 
    "start": "2020-03-02 10:01:40.184342"
}

STDOUT:

Stopping rabbit application on node rabbit@awx-apatsev-3 ...
Clustering node rabbit@awx-apatsev-3 with rabbit@172.26.9.172


STDERR:

Error:
{:badrpc_multi, {:EXIT, {{:function_clause, [{:gen, :do_for_proc, [{:rex, {:error, {:node_name, :short}}}, #Function<0.131893493/1 in :gen.call/4>], [file: 'gen.erl', line: 220]}, {:gen_server, :call, 3, [file: 'gen_server.erl', line: 219]}, {:rpc, :do_call, 3, [file: 'rpc.erl', line: 327]}, {:lists, :foldl, 3, [file: 'lists.erl', line: 1263]}, {:rabbit_mnesia, :discover_cluster, 1, [file: 'src/rabbit_mnesia.erl', line: 744]}, {:rabbit_mnesia, :join_cluster, 2, [file: 'src/rabbit_mnesia.erl', line: 233]}, {:rpc, :"-handle_call_call/6-fun-0-", 5, [file: 'rpc.erl', line: 197]}]}, {:gen_server, :call, [{:rex, {:error, {:node_name, :short}}}, {:call, :rabbit_mnesia, :cluster_status_from_mnesia, [], #PID<0.62.0>}, :infinity]}}}, [error: {:node_name, :short}]}


MSG:

non-zero return code

fatal: [172.26.9.176]: FAILED! => {
    "changed": true, 
    "cmd": "rabbitmqctl stop_app\nrabbitmqctl join_cluster rabbit@\"172.26.9.172\"\n", 
    "delta": "0:00:01.792304", 
    "end": "2020-03-02 10:01:41.975966", 
    "rc": 69, 
    "start": "2020-03-02 10:01:40.183662"
}

STDOUT:

Stopping rabbit application on node rabbit@awx-apatsev-4 ...
Clustering node rabbit@awx-apatsev-4 with rabbit@172.26.9.172


STDERR:

Error:
{:badrpc_multi, {:EXIT, {{:function_clause, [{:gen, :do_for_proc, [{:rex, {:error, {:node_name, :short}}}, #Function<0.131893493/1 in :gen.call/4>], [file: 'gen.erl', line: 220]}, {:gen_server, :call, 3, [file: 'gen_server.erl', line: 219]}, {:rpc, :do_call, 3, [file: 'rpc.erl', line: 327]}, {:lists, :foldl, 3, [file: 'lists.erl', line: 1263]}, {:rabbit_mnesia, :discover_cluster, 1, [file: 'src/rabbit_mnesia.erl', line: 744]}, {:rabbit_mnesia, :join_cluster, 2, [file: 'src/rabbit_mnesia.erl', line: 233]}, {:rpc, :"-handle_call_call/6-fun-0-", 5, [file: 'rpc.erl', line: 197]}]}, {:gen_server, :call, [{:rex, {:error, {:node_name, :short}}}, {:call, :rabbit_mnesia, :cluster_status_from_mnesia, [], #PID<0.62.0>}, :infinity]}}}, [error: {:node_name, :short}]}


MSG:

non-zero return code

На ноде awx-apatsev-2 ошибок нет. На ноде awx-apatsev-4 ошибки такие же как и на awx-apatsev-3

Поиск ошибок в логах:

cat rabbit@awx-apatsev-3.log  | grep -A 1 error
2020-03-02 09:59:47.078 [error] <0.509.0> Error on AMQP connection <0.509.0> (127.0.0.1:45876 -> 127.0.0.1:5672, vhost: '/', user: 'guest', state: running), channel 0:
 operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"
2020-03-02 09:59:47.078 [error] <0.526.0> Error on AMQP connection <0.526.0> (127.0.0.1:45884 -> 127.0.0.1:5672, vhost: '/', user: 'guest', state: running), channel 0:
 operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"
2020-03-02 09:59:47.078 [error] <0.529.0> Error on AMQP connection <0.529.0> (127.0.0.1:45886 -> 127.0.0.1:5672, vhost: '/', user: 'guest', state: running), channel 0:
 operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"
--
2020-03-02 09:59:58.807 [error] <0.453.0> ** Connection attempt from disallowed node 'rabbitmqcli-19480-rabbit@awx-apatsev-3' ** 
2020-03-02 09:59:59.224 [error] <0.455.0> ** Connection attempt from disallowed node 'rabbitmqcli-19480-rabbit@awx-apatsev-3' ** 
2020-03-02 10:01:30.814 [info] <0.8.0> Log file opened with Lager
--
2020-03-02 10:01:41.094 [error] <0.416.0> Error on AMQP connection <0.416.0> (127.0.0.1:46218 -> 127.0.0.1:5672, vhost: '/', user: 'guest', state: running), channel 0:
 operation none caused a connection exception connection_forced: "broker forced connection closure with reason 'shutdown'"

Ошибки в логе /var/log/messages

2020-03-02 09:57:01,960 ERROR    awx.conf.settings Database settings are not available, using defaults.
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "conf_setting" does not exist
LINE 1: ...f_setting"."value", "conf_setting"."user_id" FROM "conf_sett...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/conf/settings.py", line 87, in _ctit_db_wrapper
yield
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/conf/settings.py", line 415, in __getattr__
value = self._get_local(name)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/conf/settings.py", line 331, in _get_local
self._preload_cache()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/conf/settings.py", line 293, in _preload_cache
for setting in Setting.objects.filter(key__in=settings_to_cache.keys(), user__isnull=True).order_by('pk'):
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/query.py", line 274, in __iter__
self._fetch_all()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1133, in execute_sql
cursor.execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "conf_setting" does not exist
LINE 1: ...f_setting"."value", "conf_setting"."user_id" FROM "conf_sett...

И вот еще ошибка из /var/log/messages

2020-03-02 10:02:01,191 WARNING  kombu.mixins Broker connection error, trying again in 10.0 seconds: ConnectionRefusedError(111, 'Connection refused').
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/amqp/transport.py", line 137, in _connect
host, port, family, socket.SOCK_STREAM, SOL_TCP)
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -9] Address family for hostname not supported
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/kombu/utils/functional.py", line 344, in retry_over_time
return fun(*args, **kwargs)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/kombu/connection.py", line 283, in connect
return self.connection
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/kombu/connection.py", line 839, in connection
self._connection = self._establish_connection()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/kombu/connection.py", line 794, in _establish_connection
conn = self.transport.establish_connection()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
conn.connect()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/amqp/connection.py", line 311, in connect
self.transport.connect()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/amqp/transport.py", line 77, in connect
self._connect(self.host, self.port, self.connect_timeout)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/amqp/transport.py", line 148, in _connect
"failed to resolve broker hostname"))
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/amqp/transport.py", line 161, in _connect
self.sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
Traceback (most recent call last):
File "/opt/rh/rh-python36/root/usr/bin/awx-manage", line 11, in <module>
load_entry_point('awx==9.2.0', 'console_scripts', 'awx-manage')()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/__init__.py", line 152, in manage
execute_from_command_line(sys.argv)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/management/commands/run_dispatcher.py", line 58, in handle
reaper.reap()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/dispatch/reaper.py", line 38, in reap
(changed, me) = Instance.objects.get_or_register()
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/managers.py", line 134, in get_or_register
return (False, self.me())
File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/main/managers.py", line 116, in me
raise RuntimeError("No instance found with the current cluster host id")
RuntimeError: No instance found with the current cluster host id

Как исправить ошибку?

Если попытатся ввести ноду в кластер rabbitmq вручную, то будет ошибка:

rabbitmqctl join_cluster rabbit@"172.26.9.172"
Clustering node rabbit@awx-apatsev-3 with rabbit@172.26.9.172
Error:
{:badrpc_multi, {:EXIT, {{:function_clause, [{:gen, :do_for_proc, [{:rex, {:error, {:node_name, :short}}}, #Function<0.131893493/1 in :gen.call/4>], [file: 'gen.erl', line: 220]}, {:gen_server, :call, 3, [file: 'gen_server.erl', line: 219]}, {:rpc, :do_call, 3, [file: 'rpc.erl', line: 327]}, {:lists, :foldl, 3, [file: 'lists.erl', line: 1263]}, {:rabbit_mnesia, :discover_cluster, 1, [file: 'src/rabbit_mnesia.erl', line: 744]}, {:rabbit_mnesia, :join_cluster, 2, [file: 'src/rabbit_mnesia.erl', line: 233]}, {:rpc, :"-handle_call_call/6-fun-0-", 5, [file: 'rpc.erl', line: 197]}]}, {:gen_server, :call, [{:rex, {:error, {:node_name, :short}}}, {:call, :rabbit_mnesia, :cluster_status_from_mnesia, [], #PID<0.62.0>}, :infinity]}}}, [error: {:node_name, :short}]}

Я добавил в файл hosts имена нод из инвентори. Ошибка ушла.

https://gist.github.com/glennswest/6e43aa88f3de0a0cf4ecf00749a91fa1

 

chemtech
()

Добавить в Python проект pyp2rpm опцию исключения сборки документации

https://github.com/fedora-python/pyp2rpm - по умолчанию делает пакеты doc - документацию.

Нужно добавить в Python проект pyp2rpm опцию исключения сборки документации.

цель чтобы не запускались всякие sphinx-build

+ PYTHONPATH=/home/centos/rpmbuild/BUILD/pytest-3.5.1
+ sphinx-build doc/en html
Making output directory...
Running Sphinx v1.1.3

https://freelance.habr.com/tasks/290300

 

chemtech
()

Группировка значений в grafana из базы Clickhouse

Есть Clickhouse запрос

SELECT
    1,
    request_time,
    count(*) AS Reqs
FROM $table
WHERE
    $timeFilter
    AND status IN ($multiple_choice_in_status)
    AND server_name = '$vhost'
    AND request_uri LIKE '$substring_in_request_uri' 
    AND request_method LIKE '$substring_in_request_method' 
    AND request_time > $var_request_time
GROUP BY request_time
ORDER BY request_time

В Grafana выбрал панель Graph и mode series.

Вид вот такой. https://habrastorage.org/webt/5y/5j/bl/5y5jbl0ww8ng-fai0_r0nncz_fu.png

https://habrastorage.org/webt/jo/54/lz/jo54lzke5p3owot_sbvk8mrivne.png

Как сгрупировать значения?

Например: показывать гистограмму 0-0.2;0.2-0.4;0.4-0.6 и так далее.

UPD. В Clickhouse гистограмма заработала. Но как ее показать в Grafana?

Скриншоты: https://habrastorage.org/webt/84/gr/vn/84grvn6q3svwt_zc5_jugfy1l2u.png

https://habrastorage.org/webt/qv/jq/o7/qvjqo72xzsfxtu_-aigkww5qhjc.png

 ,

chemtech
()

rpmbuild sentry Could not determine sentry version or build

Собираю sentry в rpm:

sudo setenforce 0
sudo yum install -y epel-release rpmdevtools mc
sudo yum install -y python-devel gcc gcc-c++ zlib-devel libjpeg-devel 
sudo yum install -y python34 python3-pip 
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
sudo yum install -y nodejs
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
pip3 install --user pyp2rpm

############ Install sentry by pip on Centos 7
pip install --upgrade pip
pip install requests==2.20.1 -U --ignore-installed
pip install PyYAML==3.11 -U --ignore-installed
pip install sentry==9.1.2
######### 

pyp2rpm sentry -t epel7 -b2 -p2 -v 9.1.2 > sentry-9.1.2.spec Удаляем из sentry-9.1.2.spec

< BuildConflicts: python2-configparser = 3.5.2
< BuildConflicts: python2-configparser = 3.5.3
< BuildConflicts: python2-configparser = 3.7.0
< BuildRequires:  python2-Babel
< BuildRequires:  python2-autopep8 < 1.4.0
< BuildRequires:  python2-autopep8 >= 1.3.5
< BuildRequires:  python2-docker < 3.8.0
< BuildRequires:  python2-docker >= 3.7.0
< BuildRequires:  python2-flake8 < 3.6.0
< BuildRequires:  python2-flake8 >= 3.5.0
< BuildRequires:  python2-isort < 4.4.0
< BuildRequires:  python2-isort >= 4.3.4
< BuildRequires:  python2-pycodestyle < 2.4.0
< BuildRequires:  python2-pycodestyle >= 2.3.1
< BuildRequires:  python2-sentry-flake8 >= 0.0.1
< BuildRequires:  python2-setuptools

Оставляем только 1 BuildRequires

BuildRequires:  python2-devel
BuildRequires:  nodejs
BuildRequires:  yarn

sudo yum-builddep sentry-9.1.2.spec LANG=C rpmbuild -bb sentry-9.1.2.spec

using node (v12.16.1) and yarn (1.21.1)
pulled version information from 'sentry' module
building assets for sentry v9.1.2 (build UNKNOWN)
Could not determine sentry version or build
error: Bad exit status from /var/tmp/rpm-tmp.MHlxLW (%build)

cd /home/centos/rpmbuild/BUILD/sentry-9.1.2

/usr/bin/python2 setup.py build
running build
running build_integration_docs
running build_assets
pulled version information from 'sentry' module
using node (v12.16.1) and yarn (1.21.1)
pulled version information from 'sentry' module
building assets for sentry v9.1.2 (build UNKNOWN)
Could not determine sentry version or build
cd /home/centos/rpmbuild/BUILD/sentry-9.1.2/
/usr/bin/python2 setup.py build

Ошибка та же самая. Как ее исправить? Спасибо

 ,

chemtech
()

pyp2rpm Installed (but unpackaged) file(s) found: /usr/bin/pybabel

Пытаюсь собрать Babel в rpm

cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)
pip install --user pyp2rpm
pyp2rpm Babel -t epel7 -b2 -p2 > Babel-2.8.0.spec

Babel-2.8.0.spec:

# Created by pyp2rpm-3.3.3
%global pypi_name Babel

Name:           python-%{pypi_name}
Version:        2.8.0
Release:        1%{?dist}
Summary:        Internationalization utilities

License:        BSD
URL:            http://babel.pocoo.org/
Source0:        https://files.pythonhosted.org/packages/source/B/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python2-pytz >= 2015.7
BuildRequires:  python2-setuptools
BuildRequires:  python2-sphinx

%description
A collection of tools for internationalizing Python applications.

%package -n     python2-%{pypi_name}
Summary:        Internationalization utilities

Requires:       python2-pytz >= 2015.7
%description -n python2-%{pypi_name}
A collection of tools for internationalizing Python applications.

%package -n python-%{pypi_name}-doc
Summary:        Babel documentation
%description -n python-%{pypi_name}-doc
Documentation for Babel

%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

%build
%{__python2} setup.py build
# generate html docs
PYTHONPATH=${PWD} sphinx-build docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%{__python2} setup.py install --skip-build --root %{buildroot}

%check
%{__python2} setup.py test

%files -n python2-%{pypi_name}
%doc README.rst
%{python2_sitelib}/babel
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info

%files -n python-%{pypi_name}-doc
%doc html
%license LICENSE docs/_themes/LICENSE docs/license.rst

%changelog
* Sat Feb 22 2020 Cloud User - 2.8.0-1
- Initial package.

https://gist.github.com/patsevanton/e437aa6fa89f9119d33a5e88c4b8dbd3

Как собрать Babel в rpm с помощью pyp2rpm?

 

chemtech
()

pyp2rpm pycodestyle ImportError: No module named sphinx_rtd_theme

CentOS 7 Собираю pycodestyle в rpm

pyp2rpm pycodestyle -t epel7 -b2 -p2 -v 2.5.0 > pycodestyle-2.5.0.spec
LANG=C rpmbuild -bb pycodestyle-2.5.0.spec

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.rmL3HJ
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ cd /home/centos/rpmbuild/BUILD
+ rm -rf pycodestyle-2.5.0
+ /usr/bin/gzip -dc /home/centos/rpmbuild/SOURCES/pycodestyle-2.5.0.tar.gz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd pycodestyle-2.5.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ rm -rf pycodestyle.egg-info
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.Xp3hZH
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ cd pycodestyle-2.5.0
+ /usr/bin/python2 setup.py build
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running build
running build_py
creating build
creating build/lib
copying pycodestyle.py -> build/lib
running egg_info
creating pycodestyle.egg-info
writing pycodestyle.egg-info/PKG-INFO
writing namespace_packages to pycodestyle.egg-info/namespace_packages.txt
writing top-level names to pycodestyle.egg-info/top_level.txt
writing dependency_links to pycodestyle.egg-info/dependency_links.txt
writing entry points to pycodestyle.egg-info/entry_points.txt
writing manifest file 'pycodestyle.egg-info/SOURCES.txt'
reading manifest file 'pycodestyle.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
no previously-included directories found matching 'docs/_build'
writing manifest file 'pycodestyle.egg-info/SOURCES.txt'
+ PYTHONPATH=/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0
+ sphinx-build docs html
Making output directory...
Running Sphinx v1.1.3

Exception occurred:
  File "/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/docs/conf.py", line 104, in <module>
    import sphinx_rtd_theme
ImportError: No module named sphinx_rtd_theme
The full traceback has been saved in /tmp/sphinx-err-dawvwG.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>,
or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
error: Bad exit status from /var/tmp/rpm-tmp.Xp3hZH (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.Xp3hZH (%build)

Как это исправить? Спасибо!

 

chemtech
()

pyp2rpm pycodestyle File not found python2.7/site-packages/pycodestyle

CentOS 7 Собираю pycodestyle в rpm

pyp2rpm pycodestyle -t epel7 -b2 -p2 -v 2.5.0 > pycodestyle-2.5.0.spec

LANG=C rpmbuild -bb pycodestyle-2.5.0.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.XRpa3I
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ cd /home/centos/rpmbuild/BUILD
+ rm -rf pycodestyle-2.5.0
+ /usr/bin/gzip -dc /home/centos/rpmbuild/SOURCES/pycodestyle-2.5.0.tar.gz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd pycodestyle-2.5.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ rm -rf pycodestyle.egg-info
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.XZXGDg
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ cd pycodestyle-2.5.0
+ /usr/bin/python2 setup.py build
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running build
running build_py
creating build
creating build/lib
copying pycodestyle.py -> build/lib
running egg_info
creating pycodestyle.egg-info
writing pycodestyle.egg-info/PKG-INFO
writing namespace_packages to pycodestyle.egg-info/namespace_packages.txt
writing top-level names to pycodestyle.egg-info/top_level.txt
writing dependency_links to pycodestyle.egg-info/dependency_links.txt
writing entry points to pycodestyle.egg-info/entry_points.txt
writing manifest file 'pycodestyle.egg-info/SOURCES.txt'
reading manifest file 'pycodestyle.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
no previously-included directories found matching 'docs/_build'
writing manifest file 'pycodestyle.egg-info/SOURCES.txt'
+ PYTHONPATH=/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0
+ sphinx-build docs html
Making output directory...
Running Sphinx v1.1.3
loading pickled environment... not yet created
No builder selected, using default: html
building [html]: targets for 5 source files that are out of date
updating environment: 5 added, 0 changed, 0 removed
reading sources... [100%] intro                                                                                                                 
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] intro                                                                                                                  
writing additional files... (1 module code pages) _modules/index
 genindex py-modindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded.
+ rm -rf html/.doctrees html/.buildinfo
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.vyLVOU
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ '[' /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64 '!=' / ']'
+ rm -rf /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64
++ dirname /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64
+ mkdir -p /home/centos/rpmbuild/BUILDROOT
+ mkdir /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64
+ cd pycodestyle-2.5.0
+ /usr/bin/python2 setup.py install --skip-build --root /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running install
running install_lib
creating /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr
creating /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib
creating /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7
creating /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7/site-packages
copying build/lib/pycodestyle.py -> /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7/site-packages
byte-compiling /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7/site-packages/pycodestyle.py to pycodestyle.pyc
running install_egg_info
running egg_info
writing pycodestyle.egg-info/PKG-INFO
writing namespace_packages to pycodestyle.egg-info/namespace_packages.txt
writing top-level names to pycodestyle.egg-info/top_level.txt
writing dependency_links to pycodestyle.egg-info/dependency_links.txt
writing entry points to pycodestyle.egg-info/entry_points.txt
reading manifest file 'pycodestyle.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
no previously-included directories found matching 'docs/_build'
writing manifest file 'pycodestyle.egg-info/SOURCES.txt'
Copying pycodestyle.egg-info to /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7/site-packages/pycodestyle-2.5.0-py2.7.egg-info
running install_scripts
Installing pycodestyle script to /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/bin
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/centos/rpmbuild/BUILD/pycodestyle-2.5.0
/usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 0 CRC32s did match.
find: 'debug': No such file or directory
+ '[' noarch = noarch ']'
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
Bytecompiling .py files below /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7 using /usr/bin/python2.7
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.hKyrLz
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ cd pycodestyle-2.5.0
+ /usr/bin/python2 setup.py test
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
  warnings.warn(msg)
running test
running egg_info
writing pycodestyle.egg-info/PKG-INFO
writing namespace_packages to pycodestyle.egg-info/namespace_packages.txt
writing top-level names to pycodestyle.egg-info/top_level.txt
writing dependency_links to pycodestyle.egg-info/dependency_links.txt
writing entry points to pycodestyle.egg-info/entry_points.txt
reading manifest file 'pycodestyle.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found under directory 'docs'
warning: no previously-included files matching '*.pyo' found under directory 'docs'
warning: no previously-included files matching '*.pyc' found under directory 'testsuite'
warning: no previously-included files matching '*.pyo' found under directory 'testsuite'
no previously-included directories found matching 'docs/_build'
writing manifest file 'pycodestyle.egg-info/SOURCES.txt'
running build_ext
test_checkers_testsuite (testsuite.test_all.PycodestyleTestCase) ... ok
test_doctest (testsuite.test_all.PycodestyleTestCase) ... ok
test_own_dog_food (testsuite.test_all.PycodestyleTestCase) ... /home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:122:66: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:294:46: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:355:41: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:367:54: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:371:50: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:372:58: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:394:24: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:395:30: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:396:45: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:630:61: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:678:25: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:679:67: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:686:65: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:763:39: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:764:26: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:765:31: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:766:64: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:768:60: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1136:41: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1137:41: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1264:66: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1265:35: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1298:69: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1299:28: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1300:35: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1334:55: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1598:51: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1681:46: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1685:46: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:1966:68: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:2311:50: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:2374:61: W504 line break after binary operator
/home/centos/rpmbuild/BUILD/pycodestyle-2.5.0/pycodestyle.py:2403:54: W504 line break after binary operator
ok
test_selftest (testsuite.test_all.PycodestyleTestCase) ... ok
test_check_nullbytes (testsuite.test_api.APITestCase) ... ok
test_check_unicode (testsuite.test_api.APITestCase) ... ok
test_register_ast_check (testsuite.test_api.APITestCase) ... ok
test_register_invalid_check (testsuite.test_api.APITestCase) ... ok
test_register_logical_check (testsuite.test_api.APITestCase) ... ok
test_register_physical_check (testsuite.test_api.APITestCase) ... ok
test_styleguide (testsuite.test_api.APITestCase) ... ok
test_styleguide_check_files (testsuite.test_api.APITestCase) ... ok
test_styleguide_checks (testsuite.test_api.APITestCase) ... ok
test_styleguide_continuation_line_outdented (testsuite.test_api.APITestCase) ... ok
test_styleguide_excluded (testsuite.test_api.APITestCase) ... ok
test_styleguide_ignore_code (testsuite.test_api.APITestCase) ... ok
test_styleguide_init_report (testsuite.test_api.APITestCase) ... ok
test_styleguide_options (testsuite.test_api.APITestCase) ... ok
test_styleguide_unmatched_triple_quotes (testsuite.test_api.APITestCase) ... ok
test_blank_line_between_decorator (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_blank_line_decorator (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_initial_lines_more_blank (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_initial_lines_one_blank (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_initial_lines_two_blanks (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_initial_no_blank (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_fewer_follow_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_less_blank_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_less_blank_lines_comment (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_more_blank_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_nested_fewer_follow_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_nested_less_class (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_method_nested_ok (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_top_level_fewer_blank_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_top_level_fewer_follow_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_top_level_fewer_follow_lines_comments (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_top_level_good_follow_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_top_level_more_blank_lines (testsuite.test_blank_lines.TestBlankLinesDefault) ... ok
test_initial_lines_one_blanks (testsuite.test_blank_lines.TestBlankLinesTwisted) ... ok
test_initial_lines_tree_blanks (testsuite.test_blank_lines.TestBlankLinesTwisted) ... ok
test_the_right_blanks (testsuite.test_blank_lines.TestBlankLinesTwisted) ... ok
test_top_level_fewer_blank_lines (testsuite.test_blank_lines.TestBlankLinesTwisted) ... ok
test_top_level_more_blank_lines (testsuite.test_blank_lines.TestBlankLinesTwisted) ... ok
test_multiline_ignore_parsing (testsuite.test_parser.ParserTestCase) ... ok
test_multiline_trailing_comma_ignore_parsing (testsuite.test_parser.ParserTestCase) ... ok
test_trailing_comma_ignore_parsing (testsuite.test_parser.ParserTestCase) ... ok
test_vanilla_ignore_parsing (testsuite.test_parser.ParserTestCase) ... ok
test_check_diff (testsuite.test_shell.ShellTestCase) ... ok
test_check_noarg (testsuite.test_shell.ShellTestCase) ... ok
test_check_non_existent (testsuite.test_shell.ShellTestCase) ... ok
test_check_simple (testsuite.test_shell.ShellTestCase) ... ok
test_check_stdin (testsuite.test_shell.ShellTestCase) ... ok
test_print_usage (testsuite.test_shell.ShellTestCase) ... ok
test_normalize_paths (testsuite.test_util.UtilTestCase) ... ok

----------------------------------------------------------------------
Ran 53 tests in 1.124s

OK
+ exit 0
Processing files: python2-pycodestyle-2.5.0-1.el7.noarch
error: File not found: /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7/site-packages/pycodestyle
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.N6Zuhi
+ umask 022
+ cd /home/centos/rpmbuild/BUILD
+ cd pycodestyle-2.5.0
+ DOCDIR=/home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/share/doc/python2-pycodestyle-2.5.0
+ export DOCDIR
+ /usr/bin/mkdir -p /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/share/doc/python2-pycodestyle-2.5.0
+ cp -pr README.rst /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/share/doc/python2-pycodestyle-2.5.0
+ exit 0


RPM build errors:
    File not found: /home/centos/rpmbuild/BUILDROOT/python-pycodestyle-2.5.0-1.el7.x86_64/usr/lib/python2.7/site-packages/pycodestyle

Как исправить? Спасибо

 

chemtech
()

Сборка rpm с помощью rpmvenv

Установка завивимостей

yum -y install epel-release
yum -y install libtool-ltdl-devel gcc libxslt-devel libxml2-devel xmlsec1-devel gcc-c++ mc python-devel python2-pip

Создал юзера rpmvenv

su - rpmvenv
mkdir /home/rpmvenv/venvs
cd venvs/
pip install -U pip
pip install  virtualenv rpmvenv
virtualenv sentry
. sentry/bin/activate
pip install sentry
pip freeze > requirements.txt
QA_SKIP_BUILD_ROOT=1 rpmvenv sentry.json

Выдает ошибку

Traceback (most recent call last):
  File "/home/rpmvenv/venvs/sentry/bin/rpmvenv", line 8, in <module>
    sys.exit(main())
  File "/home/rpmvenv/venvs/sentry/lib/python2.7/site-packages/rpmvenv/cli.py", line 142, in main
    args['verbose'],
  File "/home/rpmvenv/venvs/sentry/lib/python2.7/site-packages/rpmvenv/cli.py", line 77, in generate_rpm
    pkg = rpmbuild.build(specfile=specfile, top=top, verbose=verbose)
  File "/home/rpmvenv/venvs/sentry/lib/python2.7/site-packages/rpmvenv/rpmbuild.py", line 161, in build
    quiet_popen(cmd)
  File "/home/rpmvenv/venvs/sentry/lib/python2.7/site-packages/rpmvenv/rpmbuild.py", line 122, in quiet_popen
    stderr=subprocess.PIPE,
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Содержимое sentry.json

{
    "extensions": {
        "enabled": [
            "python_venv",
            "blocks"
        ]
    },
    "core": {
        "group": "Application/System",
        "license": "MIT",
        "name": "sentry",
        "summary": "Sentry summary",
        "version": "10.0.0"
    },
    "python_venv": {
	"require_setup_py": false,
        "name": "venv_sentry",
        "path": "/home/rpmvenv/venvs/sentry",
	"cmd": "virtualenv",
        "flags": ["--always-copy"],
        "requirements": ["requirements.txt"],
        "use_pip_install": true,
        "remove_pycache": true,
	"strip_binaries": true
    },
    "blocks": {
        "desc": [
            "some long package description",
            "each array element is a new line"
        ]
    }
}

Содержимое домашней директории пользователя rpmvenv

tree -L 3
.
├── requirements.txt
└── venvs
    ├── requirements.txt
    ├── sentry
    │   ├── bin
    │   ├── include
    │   ├── lib
    │   ├── lib64
    │   ├── LICENSE.txt
    │   ├── pyvenv.cfg
    │   ├── requirements.txt
    │   ├── sentry.json
    │   └── share
    └── sentry.json

 

chemtech
()

Как использовать like внутри custom переменной Grafana для запроса в Clickhouse?

Собрал связку Clickhouse + Grafana по этой статье https://habr.com/ru/post/484640/

Хотелось бы использовать один шаблон в Grafana, в котором можно было бы править переменные substring чтобы поменялась подстрока

AND request_uri LIKE '%моя подстрока в request_uri%'

чтобы весь дашборд подстроился под эту строку. Может быть есть альтернативное решение?

Есть запрос в Clickhouse:

SELECT 1, 
       request_uri, 
       status, 
       Count(*) AS cnt 
FROM   nginx.access_log 
WHERE  event_date >= Todate(1582262371) 
       AND event_datetime >= Todatetime(1582262371) 
       AND status NOT IN ( 200, 201 ) 
       AND server_name = 'мой vhost'
       AND request_uri LIKE '%моя подстрока в request_uri%'
GROUP  BY request_uri, 
          status 
ORDER  BY cnt DESC 
LIMIT  5;

В Clickhouse выполняется. Как использовать like внутри custom переменной Grafana для запроса в Clickhouse?

Скриншот https://habrastorage.org/webt/5e/4f/7b/5e4f7b87f2432520223568.png

 ,

chemtech
()

Как добавить чтение PGDATA из конфига .walg.json для проекта wal-g?

Вот проект https://github.com/wal-g/wal-g

Вот issue https://github.com/wal-g/wal-g/issues/549

Ошибка:

cat $HOME/.walg.json
{
"WALE_S3_PREFIX": "s3://pg-backups",
"AWS_ACCESS_KEY_ID": "minio",
"AWS_ENDPOINT": "http://172.26.9.241:9000",
"AWS_S3_FORCE_PATH_STYLE": "true",
"AWS_SECRET_ACCESS_KEY": "miniosecret",
"PGDATA": "/var/lib/pgsql/9.6/data/",
"PGHOST": "/var/run/postgresql/.s.PGSQL.5432",
"WALG_UPLOAD_CONCURRENCY": "2",
"WALG_DOWNLOAD_CONCURRENCY": "2",
"WALG_UPLOAD_DISK_CONCURRENCY": "2",
"WALG_DELTA_MAX_STEPS": "7",
"WALG_COMPRESSION_METHOD": "brotli"
}

Get error:

/usr/local/bin/wal-g backup-list
WARNING: 2020/02/02 12:33:32.793829 PGDATA is unknown
WARNING: 2020/02/02 12:33:32.793865 We found that some variables in your config file detected as 'Unknown'. 
If this is not right, please create issue https://github.com/wal-g/wal-g/issues/new
name last_modified wal_segment_backup_start

Я поправил internal/config.go

+++ b/internal/config.go
@@ -37,6 +37,7 @@ const (
PgPortSetting = "PGPORT"
PgUserSetting = "PGUSER"
PgHostSetting = "PGHOST"
+ PgDataSetting = "PGDATA"
PgPasswordSetting = "PGPASSWORD"
PgDatabaseSetting = "PGDATABASE"
PgSslModeSetting = "PGSSLMODE"
@@ -95,6 +96,7 @@ var (
PgPortSetting: true,
PgUserSetting: true,
PgHostSetting: true,
+ PgDataSetting: true,
PgPasswordSetting: true,
PgDatabaseSetting: true,
PgSslModeSetting: true,

Но сборка выдает ошибку

make pg_build
(cd main/pg && go build -mod vendor -tags "brotli lzo""" -o wal-g -ldflags "-s -w -X github.com/wal-g/wal-g/cmd/pg.BuildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd/pg.GitRevision=`git rev-parse --short HEAD` -X github.com/wal-g/wal-g/cmd/pg.WalgVersion=`git tag -l --points-at HEAD`")
# github.com/wal-g/wal-g/internal
../../internal/config.go:40:2: PgDataSetting redeclared in this block
previous declaration at ../../internal/config.go:35:33
Makefile:29: recipe for target 'pg_build' failed
make: *** [pg_build] Error 2

 

chemtech
()

invalid pseudo-version fatal: git fetch-pack: expected shallow list

Пытаюсь собирать https://github.com/wal-g/wal-g Но выдается ошибка.

cat /etc/redhat-release

CentOS Linux release 7.6.1810 (Core)

mkdir /root/go
export GOPATH=/root/go
go get github.com/wal-g/wal-g
package github.com/wal-g/wal-g: no Go files in /root/go/src/github.com/wal-g/wal-g

cd $GOPATH/src/github.com/wal-g/wal-g
make install
go get -u golang.org/x/lint/golint
go: github.com/golang/mock@v1.3.1-0.20190508161146-9fa652df1129: invalid pseudo-version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/e0a6dff9fb6c1f7c23e670e933cb00d791bc91d7acab4aef9d400ff3e9838f0b: exit status 128:
	fatal: git fetch-pack: expected shallow list
make: *** [install] Error 1

yum list golang
Installed Packages
golang.x86_64  1.13.3-1.el7 @epel

Как исправить?

 

chemtech
()

Error in pyp2rpm setup command: 'tests_require' must be a string or list of strings containing valid project/version requirement specifiers

Пытаюсь установить pyp2rpm на CentOS7.

Если устанавливать pyp2rpm из rpm пакета, то в нем не будет шаблона epel7. Поэтому устанавливаю через pip.

Если просто запустить установку через pip pip install pyp2rpm

то получу ошибку

setuptools_scm.version.SetuptoolsOutdatedWarning: your setuptools is too old (<12)

Обновляю setuptools до 12 версии pip install setuptools==12 Получаю ошибку

    Installed /tmp/pip-build-f3aMgP/pyp2rpm/.eggs/flexmock-0.10.4-py2.7.egg
    error in pyp2rpm setup command: 'tests_require' must be a string or list of strings containing valid project/version requirement specifiers
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-f3aMgP/pyp2rpm/

Обновление setuptools pip до последних версий

 pip install --upgrade setuptools pip
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/68/75/d1d7b7340b9eb6e0388bf95729e63c410b381eb71fe8875cdfd949d8f9ce/setuptools-45.2.0.zip (859kB)
    100% |████████████████████████████████| 860kB 1.1MB/s 
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 784kB/s 
Installing collected packages: setuptools, pip
  Found existing installation: setuptools 12.0
    Uninstalling setuptools-12.0:
      Successfully uninstalled setuptools-12.0
  Running setup.py install for setuptools ... done
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
Successfully installed pip-20.0.2 setuptools-45.2.0
``

pip install pyp2rpm

``
Collecting pyp2rpm
  Using cached pyp2rpm-3.3.3.tar.gz (2.6 MB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-OkyYAa/pyp2rpm/setup.py'"'"'; __file__='"'"'/tmp/pip-install-OkyYAa/pyp2rpm/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-OkyYAa/pyp2rpm/pip-egg-info
         cwd: /tmp/pip-install-OkyYAa/pyp2rpm/
    Complete output (70 lines):
    /usr/lib/python2.7/site-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
    ************************************************************
    You are running Setuptools on Python 2, which is no longer
    supported and
    >>> SETUPTOOLS WILL STOP WORKING <<<
    in a subsequent release (no sooner than 2020-04-20).
    Please ensure you are installing
    Setuptools using pip 9.x or later or pin to `setuptools<45`
    in your environment.
    If you have done those things and are still encountering
    this message, please comment in
    https://github.com/pypa/setuptools/issues/1458
    about the steps that led to this unsupported combination.
    ************************************************************
      sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
    WARNING: The wheel package is not available.
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    WARNING: The wheel package is not available.
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    WARNING: The wheel package is not available.
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-7_s7_K/flexmock/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-7_s7_K/flexmock/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-r4_mot
           cwd: /tmp/pip-wheel-7_s7_K/flexmock/
      Complete output (21 lines):
      /usr/lib/python2.7/site-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
      ************************************************************
      You are running Setuptools on Python 2, which is no longer
      supported and
      >>> SETUPTOOLS WILL STOP WORKING <<<
      in a subsequent release (no sooner than 2020-04-20).
      Please ensure you are installing
      Setuptools using pip 9.x or later or pin to `setuptools<45`
      in your environment.
      If you have done those things and are still encountering
      this message, please comment in
      https://github.com/pypa/setuptools/issues/1458
      about the steps that led to this unsupported combination.
      ************************************************************
        sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
      usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
         or: setup.py --help [cmd1 cmd2 ...]
         or: setup.py --help-commands
         or: setup.py cmd --help
    
      error: invalid command 'bdist_wheel'
      ----------------------------------------
      ERROR: Failed building wheel for flexmock
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-OkyYAa/pyp2rpm/setup.py", line 53, in <module>
        'Topic :: System :: Software Distribution',
      File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 143, in setup
        _install_setup_requires(attrs)
      File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 783, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
      File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1078, in obtain
        return installer(requirement)
      File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/usr/lib/python2.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/usr/bin/python2', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpTKN0L9', '--quiet', 'flexmock>=0.9.3']' returned non-zero exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

 , ,

chemtech
()

Написать SPEC файл для сборки RPM sentry для локального использования

Есть проект https://github.com/getsentry/sentry. У sentry отсутствует rpm для локального использования.

Необходимо написать SPEC файл для сборки RPM (CentOS 7) sentry для локального использования.

Подробности https://freelance.habr.com/tasks/287294

 ,

chemtech
()

Доработать поддержку NAT сети в terraform-provider-virtualbox

Есть terraform провайдер для virtualbox https://github.com/terra-farm/terraform-provider-virtualbox

В нем отсутствует поддержка Сети NAT. Вот ссылки на документацию сети NAT для virtualbox https://www.virtualbox.org/manual/ch06.html#network_nat_service https://www.virtualbox.org/sdkref/interface_i_network_adapter.html#a7cdb4cf56cb04b1b31f36e57bb15c3fe https://www.virtualbox.org/manual/ch08.html#vboxmanage-natnetwork

Часть кода уже написали. Но Pull Request https://github.com/terra-farm/terraform-provider-virtualbox/pull/82 не приняли. Нужно Доработать код из этого Pull request https://github.com/terra-farm/terraform-provider-virtualbox/pull/82 чтобы приняли в upstream:

Вот ответ разработчиков terraform-provider-virtualbox The thing is, in NAT Network, we cannot connect to the VM directly. But, usually terraform provisioners require a network connection to control it. Is there any work-around? Like providing a port forward resource and using it as connection?

Подробности тут https://freelance.habr.com/tasks/285878

 , ,

chemtech
()

screen для ruby -rwebrick для запуска статического сервера на текущей директории

Есть проект для примера https://gitlab.com/anton_patsev/screen_current_dir

Пытаюсь запустить статический сервер ruby -rwebrick на текущей директории в screen

    - mkdir temp
    - cd temp
    - touch 1.apk
    - ls
    - export MYDIR=`pwd`
    - screen -dmS rubyserver bash -c "cd $MYDIR && ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'"
    - screen -list
    - url=$(hostname)
    - curl "http://$url:8000"
    - curl "http://$url:8000/1.apk"

Как запустить статический сервер ruby -rwebrick на текущей директории в screen ?

 ,

chemtech
()

RSS подписка на новые темы