Erreur Python sur un script Ruby
Bonjour,
Pour info, j'ai un soucis avec un role Ansible, mais ici ce n'est pas le sujet....
Après quelques heures de troubleshooting, j'ai remarqué que le problème ce situe sur un script Ruby.
J'ai donc démarré ce script directement depuis le shell et j'obtiens une erreur. Je ne connais pas le langage Ruby mais je n'arrive pas à comprendre pourquoi je reçois une erreur Python. Ce n'est pas normal? ou bien?
Voici l'erreur:
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| # ./foreman_scap_client_facts.rb
Fatal Python error: Py_Initialize: Unable to get the locale encoding
Traceback (most recent call last):
File "/usr/lib64/python3.6/encodings/__init__.py", line 33, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 780, in get_code
File "<frozen importlib._bootstrap_external>", line 832, in get_data
PermissionError: [Errno 1] Operation not permitted: '/usr/lib64/python3.6/encodings/aliases.py'{}
# |
Et voici le script:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| #!/usr/bin/ruby
require 'rubygems' if RUBY_VERSION.start_with? '1.8'
require 'json'
def subscription_manager_cert_paths
certificates = {}
certificate_end_path = '/cert.pem'
private_key_end_path = '/key.pem'
data = nil
begin
data = `subscription-manager config`
rescue Errno::ENOENT => e
return certificates
end
return certificates unless $?.success? && data
data = data.gsub("\n", "").gsub(/[\[\]]/, "")
data_array = data.scan(/(\S+)\s*=\s* ([^ ]+)/)
data_hash = Hash[*data_array.flatten]
consumer_cert_dir = data_hash["consumercertdir"]
certificates[:rh_ca_cert_path] = data_hash["repo_ca_cert"]
certificates[:rh_consumer_cert_path] = consumer_cert_dir + certificate_end_path
certificates[:rh_consumer_private_key_path] = consumer_cert_dir + private_key_end_path
certificates
end
print subscription_manager_cert_paths.to_json |
Quelqu'un a-t-il une idée?