예제 #1
0
파일: routes.py 프로젝트: KuanYuChen/eNMS
def save_parameters():
    parameters = get_one('Parameters')
    remote_git = request.form['git_repository_automation']
    if parameters.git_repository_automation != remote_git:
        Repo.clone_from(remote_git, app.path / 'git' / 'automation')
    parameters.update(**request.form)
    database_filtering(fetch('Pool', id=request.form['pool']))
    db.session.commit()
    return True
예제 #2
0
 def trigger_active_parameters(self, app):
     for repository_type in ('configurations', 'automation'):
         try:
             repo = getattr(self, f'git_{repository_type}')
             if repo:
                 Repo.clone_from(repo, app.path / 'git' / repository_type)
         except Exception as e:
             info(f'Cannot clone {repository_type} git repo ({str(e)})')
     pool = fetch('Pool', name=self.pool_filter)
     if pool:
         database_filtering(pool)
예제 #3
0
파일: models.py 프로젝트: KuanYuChen/eNMS
 def compute_pool(self):
     self.devices = list(filter(self.object_match, Device.query.all()))
     self.links = []
     for link in Link.query.all():
         link.__dict__.update({
             'source': link.source,
             'destination': link.destination
         })
         if self.object_match(link):
             self.links.append(link)
     if get_one('Parameters').pool == self:
         database_filtering(self)
예제 #4
0
 def trigger_active_parameters(self, app: Flask) -> None:
     for repository_type in ("configurations", "automation"):
         try:
             repo = getattr(self, f"git_{repository_type}")
             local_path = app.path / "git" / repository_type
             for file in scandir(local_path):
                 if file.name == ".gitkeep":
                     remove(file)
             if repo:
                 Repo.clone_from(repo, local_path)
         except Exception as e:
             info(f"Cannot clone {repository_type} git repo ({str(e)})")
     pool = fetch("Pool", name=self.pool_filter)
     if pool:
         database_filtering(pool)