iam-veeramalla / iam-veeramalla/python-for-devops

The file operation program is not updating

Abierto
#23 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
4.8k
Forks
10.3k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

def update_server_config(file_path, key, value):
# Read the existing content of the server configuration file
with open(file_path, 'r') as file:
lines = file.readlines()

# Update the configuration value for the specified key
with open(file_path, 'w') as file:
for line in lines:
# Check if the line starts with the specified key
if key in line:
# Update the line with the new value
file.write(key + "=" + value + "\n")
print("File update successfully")
else:
# Keep the existing line as it is
file.write(line)
print("No change done")

# Path to the server configuration file
server_config_file = 'server.conf'

# Key and new value for updating the server configuration
key_to_update = 'PORT'
new_value = '9000' # New maximum connections allowed

# Update the server configuration file
update_server_config(server_config_file, key_to_update, new_value)

This program is running but it is not updating to new value.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start with update_server_config in the issue body and inspect the referenced server.conf to compare its contents with the key and value passed to the function. Run the program against that file and verify that the PORT setting contains 9000 afterward. The issue does not include the configuration file or an error, so reproduce the behavior before narrowing the cause.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
devops
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.