Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Central de ajuda/ Elastic Cloud Server/ Perguntas frequentes/ Passwords and Key Pairs/ Key Pairs/ What Should I Do If Cloud-Init Does Not Work After Python Is Upgraded?
Atualizado em 2025-01-23 GMT+08:00

What Should I Do If Cloud-Init Does Not Work After Python Is Upgraded?

Symptom

Take an ECS running CentOS 6.8 as an example. After Python was upgraded from 2.6 to 2.7, Cloud-Init did not work. Data, such as the login password, key, and hostname could not be imported to the ECS using Cloud-Init.

After the cloud-init -v command was executed to view the Cloud-Init version, the system displayed errors, as shown in Figura 1.

Figura 1 Improper running of Cloud-Init

Possible Causes

The Python version used by Cloud-Init was incorrect.

Solution

Change the Python version used by Cloud-Init to the source version. To do so, change the environment variable value of /usr/bin/cloud-init from the default value #!/usr/bin/python to #!/usr/bin/python2.6.

Figura 2 Changing the Python version