Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from pathlib import Path
- import fileinput
- import git
- def relate_to_git():
- print("Currently working on: " + os.getcwd())
- repo = git.Repo(repos)
- print(repo.git.branch('-a'))
- print(repo.git.checkout("master"))
- print(repo.git.pull())
- filename = Path(os.getcwd() + '/provision/k8s/new-production/deployment.yaml')
- if filename.is_file():
- filename = Path(os.getcwd() + '/provision/k8s/new-production/deployment.yaml')
- else:
- filename = Path(os.getcwd() + '/provision/k8s/production/deployment.yaml')
- old = "targetAverageValue"
- new = " targetAverageUtilization: 90"
- for line in fileinput.input(filename, inplace=1):
- line = line.rstrip()
- if old in line:
- line = new
- print(line)
- try:
- repo.git.add(update=True)
- repo.git.commit('-m', 'Adjust request and limit on source')
- # repo.git.push('origin', 'master')
- except:
- print("Should be ignored")
- repo.git.push('origin', 'master')
- full = ('frontend', 'backend')
- for seperate in full:
- os.chdir("/Users/luanvn/logistic-" + seperate)
- if seperate == "backend":
- currentDirectory = os.getcwd()
- for sub_dir in os.listdir(currentDirectory):
- if sub_dir != "consumer":
- repos = os.chdir("/Users/luanvn/logistic-backend/" + sub_dir)
- relate_to_git()
- else:
- os.chdir("/Users/luanvn/logistic-backend/consumer")
- currentDirectory = os.getcwd()
- for sub_dir in os.listdir(currentDirectory):
- repos = os.chdir("/Users/luanvn/logistic-backend/consumer/" + sub_dir)
- relate_to_git()
- else:
- currentDirectory = os.getcwd()
- for sub_dir in os.listdir(currentDirectory):
- repos = os.chdir("/Users/luanvn/logistic-frontend/" + sub_dir)
- relate_to_git()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement