Ejemplo n.º 1
0
func (s *concreteApplier) setUpLogrotate(applySpec as.ApplySpec) error {
	err := s.logrotateDelegate.SetupLogrotate(
		boshsettings.VCAP_USERNAME,
		boshsettings.VCAP_BASE_DIR,
		applySpec.MaxLogFileSize(),
	)
	if err != nil {
		err = bosherr.WrapError(err, "Logrotate setup failed")
	}
	return err
}
Ejemplo n.º 2
0
func (a *concreteApplier) setUpLogrotate(applySpec as.ApplySpec) (err error) {
	err = a.logrotateDelegate.SetupLogrotate(
		boshsettings.VCAP_USERNAME,
		a.dirProvider.BaseDir(),
		applySpec.MaxLogFileSize(),
	)
	if err != nil {
		err = bosherr.WrapError(err, "Logrotate setup failed")
	}
	return
}
Ejemplo n.º 3
0
func (a *concreteApplier) setUpLogrotate(applySpec as.ApplySpec) error {
	err := a.logrotateDelegate.SetupLogrotate(
		boshsettings.VCAPUsername,
		a.dirProvider.BaseDir(),
		applySpec.MaxLogFileSize(),
	)
	if err != nil {
		return bosherr.WrapError(err, "Logrotate setup failed")
	}

	return nil
}
Ejemplo n.º 4
0
func (s *concreteApplier) Apply(applySpec as.ApplySpec) error {
	for _, job := range applySpec.Jobs() {
		err := s.applyJob(job)
		if err != nil {
			return err
		}
	}

	for _, pkg := range applySpec.Packages() {
		err := s.packageApplier.Apply(pkg)
		if err != nil {
			return err
		}
	}

	return s.setUpLogrotate(applySpec)
}
Ejemplo n.º 5
0
func (a *concreteApplier) Prepare(desiredApplySpec as.ApplySpec) error {
	for _, job := range desiredApplySpec.Jobs() {
		err := a.jobApplier.Prepare(job)
		if err != nil {
			return bosherr.WrapError(err, "Preparing job %s", job.Name)
		}
	}

	for _, pkg := range desiredApplySpec.Packages() {
		err := a.packageApplier.Prepare(pkg)
		if err != nil {
			return bosherr.WrapError(err, "Preparing package %s", pkg.Name)
		}
	}

	return nil
}
Ejemplo n.º 6
0
func (a *concreteApplier) Apply(applySpec as.ApplySpec) error {
	err := a.jobSupervisor.RemoveAllJobs()
	if err != nil {
		return bosherr.WrapError(err, "Removing all jobs")
	}

	jobs := applySpec.Jobs()
	for _, job := range jobs {
		err = a.jobApplier.Apply(job)
		if err != nil {
			return bosherr.WrapError(err, "Applying job %s", job.Name)
		}
	}

	for _, pkg := range applySpec.Packages() {
		err = a.packageApplier.Apply(pkg)
		if err != nil {
			return bosherr.WrapError(err, "Applying package %s", pkg.Name)
		}
	}

	for i := 0; i < len(jobs); i++ {
		job := jobs[len(jobs)-1-i]

		err = a.jobApplier.Configure(job, i)
		if err != nil {
			return bosherr.WrapError(err, "Configuring job %s", job.Name)
		}
	}

	err = a.jobSupervisor.Reload()
	if err != nil {
		return bosherr.WrapError(err, "Reloading jobSupervisor")
	}

	return a.setUpLogrotate(applySpec)
}
Ejemplo n.º 7
0
func (a *concreteApplier) Apply(applySpec as.ApplySpec) (err error) {
	jobs := applySpec.Jobs()
	for _, job := range jobs {
		err = a.jobApplier.Apply(job)
		if err != nil {
			err = bosherr.WrapError(err, "Applying job %s", job.Name)
			return
		}
	}

	for _, pkg := range applySpec.Packages() {
		err = a.packageApplier.Apply(pkg)
		if err != nil {
			err = bosherr.WrapError(err, "Applying package %s", pkg.Name)
			return
		}
	}

	for i := 0; i < len(jobs); i++ {
		job := jobs[len(jobs)-1-i]

		err = a.jobApplier.Configure(job, i)
		if err != nil {
			err = bosherr.WrapError(err, "Configuring job %s", job.Name)
			return
		}
	}

	err = a.monitor.Reload()
	if err != nil {
		err = bosherr.WrapError(err, "Reloading monitor")
		return
	}

	err = a.setUpLogrotate(applySpec)
	return
}