Use Swift venv Python interpreter
The use of activate_this to access the venv libraries means that the system site packages are also included when the scripts swift_rings.py and swift_rings_check.py are run. This commit updates the interpreter directive for those scripts, when Swift is deployed in a venv, to use the venv's interpreter. Change-Id: I3ff0bf60c9ca695cddc28b05a8e8cc67d5f240e5 Closes-bug: 1538993
This commit is contained in:
parent
9004e12ec5
commit
a82e4821fd
@ -51,7 +51,7 @@
|
||||
- swift-rings-contents
|
||||
|
||||
- name: "build rings for account/container from contents files"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item }}.contents"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item }}.contents"
|
||||
with_items:
|
||||
- account
|
||||
- container
|
||||
@ -65,7 +65,7 @@
|
||||
- swift-rings-build
|
||||
|
||||
- name: "build rings for account/container from contents files"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||
with_nested:
|
||||
- [ 'account', 'container' ]
|
||||
- "{{ swift_managed_regions }}"
|
||||
@ -79,7 +79,7 @@
|
||||
- swift-rings-build
|
||||
|
||||
- name: "build rings for storage policies from contents files"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item.policy.index }}.contents"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item.policy.index }}.contents"
|
||||
with_items:
|
||||
- "{{ swift.storage_policies }}"
|
||||
when: swift_managed_regions is not defined
|
||||
@ -92,7 +92,7 @@
|
||||
- swift-rings-build
|
||||
|
||||
- name: "build rings for storage policies from contents files"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||
with_nested:
|
||||
- "{{ swift.storage_policies }}"
|
||||
- "{{ swift_managed_regions }}"
|
||||
|
@ -44,7 +44,7 @@
|
||||
- swift-rings-scripts
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for account/container"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item }}.contents"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item }}.contents"
|
||||
with_items:
|
||||
- account
|
||||
- container
|
||||
@ -58,7 +58,7 @@
|
||||
- swift-rings-check
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for account/container"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents -r {{ item[1] }}"
|
||||
with_nested:
|
||||
- [ 'account', 'container' ]
|
||||
- "{{ swift_managed_regions }}"
|
||||
@ -72,7 +72,7 @@
|
||||
- swift-rings-check
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for storage policies"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item.policy.index }}.contents"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item.policy.index }}.contents"
|
||||
with_items:
|
||||
- "{{ swift.storage_policies }}"
|
||||
when: swift_managed_regions is not defined
|
||||
@ -85,7 +85,7 @@
|
||||
- swift-rings-check
|
||||
|
||||
- name: "Ensure contents file matches ring after ring sync for storage policies"
|
||||
command: "/usr/bin/python /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||
command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents -r {{ item[1] }}"
|
||||
with_nested:
|
||||
- "{{ swift.storage_policies }}"
|
||||
- "{{ swift_managed_regions }}"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!{{ swift_venv_enabled | bool | ternary(swift_venv_bin + "/", "/usr/bin/env ") }}python
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,13 +19,6 @@ from os.path import exists
|
||||
|
||||
import os
|
||||
|
||||
{% if swift_venv_enabled | bool %}
|
||||
|
||||
activate_this = os.path.expanduser("{{ swift_venv_bin }}/activate_this.py")
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
{% endif %}
|
||||
|
||||
from swift.cli.ringbuilder import main as rb_main
|
||||
|
||||
import json
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!{{ swift_venv_enabled | bool | ternary(swift_venv_bin + "/", "/usr/bin/env ") }}python
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,13 +19,6 @@ from os.path import exists
|
||||
|
||||
import os
|
||||
|
||||
{% if swift_venv_enabled | bool %}
|
||||
|
||||
activate_this = os.path.expanduser("{{ swift_venv_bin }}/activate_this.py")
|
||||
execfile(activate_this, dict(__file__=activate_this))
|
||||
|
||||
{% endif %}
|
||||
|
||||
import json
|
||||
import pickle
|
||||
import sys
|
||||
|
Loading…
x
Reference in New Issue
Block a user