Exemplo n.º 1
0
 def _run(self, persona, component_order, instances):
     dependency_handler_class = self.distro.dependency_handler_class
     dependency_handler = dependency_handler_class(self.distro,
                                                   self.root_dir,
                                                   instances.values(),
                                                   self.cli_opts)
     removals = states.reverts("download")
     self._run_phase(
         action.PhaseFunctors(start=lambda i: LOG.info(
             'Downloading %s.', colorizer.quote(i.name)),
                              run=lambda i: i.download(),
                              end=lambda i, result: LOG.info(
                                  "Performed %s downloads.", len(result))),
         component_order, instances, "download", *removals)
     removals.extend(states.reverts("download-patch"))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Post-download patching %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.patch("download"),
             end=None,
         ), component_order, instances, "download-patch", *removals)
     dependency_handler.package_start()
     removals.extend(states.reverts("package"))
     try:
         self._run_phase(
             action.PhaseFunctors(
                 start=lambda i: LOG.info("Packaging %s.",
                                          colorizer.quote(i.name)),
                 run=dependency_handler.package_instance,
                 end=None,
             ), component_order, instances, "package", *removals)
     finally:
         dependency_handler.package_finish()
Exemplo n.º 2
0
 def _run(self, persona, component_order, instances):
     dependency_handler_class = self.distro.dependency_handler_class
     dependency_handler = dependency_handler_class(self.distro,
                                                   self.root_dir,
                                                   instances.values(),
                                                   self.cli_opts)
     removals = states.reverts("unconfigure")
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Unconfiguring %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.unconfigure(),
             end=None,
         ), component_order, instances, 'unconfigure', *removals)
     removals.extend(states.reverts('pre-uninstall'))
     self._run_phase(
         action.PhaseFunctors(
             start=None,
             run=lambda i: i.pre_uninstall(),
             end=None,
         ), component_order, instances, 'pre-uninstall', *removals)
     removals.extend(states.reverts("package-uninstall"))
     general_package = "general"
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info("Uninstalling packages"),
             run=lambda i: dependency_handler.uninstall(),
             end=None,
         ), [general_package],
         {general_package: instances[general_package]}, "package-uninstall",
         *removals)
Exemplo n.º 3
0
 def _run(self, persona, component_order, instances):
     removals = states.reverts("pre-start")
     self._run_phase(
         action.PhaseFunctors(
             start=None,
             run=lambda i: i.pre_start(),
             end=None,
         ), component_order, instances, "pre-start", *removals)
     removals.extend(states.reverts('start'))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Starting %s.', colorizer.quote(i.name
                                                                      )),
             run=lambda i: i.start(),
             end=lambda i, result: LOG.info("Started %s application(s).",
                                            colorizer.quote(result)),
         ), component_order, instances, "start", *removals)
     removals.extend(states.reverts('post-start'))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Post-starting %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.post_start(),
             end=None,
         ), component_order, instances, "post-start", *removals)
Exemplo n.º 4
0
 def _run(self, persona, component_order, instances):
     dependency_handler_class = self.distro.dependency_handler_class
     dependency_handler = dependency_handler_class(self.distro,
                                                   self.root_dir,
                                                   instances.values(),
                                                   self.cli_opts)
     removals = states.reverts("pre-install")
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Preinstalling %s.', colorizer.quote(i.name)),
             run=lambda i: i.pre_install(),
             end=None,
         ),
         component_order,
         instances,
         "pre-install",
         *removals
     )
     removals.extend(states.reverts("package-install"))
     general_package = "general"
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info("Installing packages"),
             run=dependency_handler.install,
             end=None,
         ),
         [general_package],
         {general_package: instances[general_package]},
         "package-install",
         *removals
     )
     removals.extend(states.reverts("configure"))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Configuring %s.', colorizer.quote(i.name)),
             run=lambda i: i.configure(),
             end=None,
         ),
         component_order,
         instances,
         "configure",
         *removals
     )
     removals.extend(states.reverts("post-install"))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Post-installing %s.', colorizer.quote(i.name)),
             run=lambda i: i.post_install(),
             end=None
         ),
         component_order,
         instances,
         "post-install",
         *removals
     )
Exemplo n.º 5
0
 def _run(self, persona, groups):
     prior_groups = []
     for group, instances in groups:
         LOG.info("Preparing group %s...", colorizer.quote(group))
         dependency_handler_class = self.distro.dependency_handler_class
         dependency_handler = dependency_handler_class(self.distro,
                                                       self.root_dir,
                                                       instances.values(),
                                                       self.cli_opts,
                                                       group, prior_groups)
         removals = states.reverts("download")
         self._run_phase(
             action.PhaseFunctors(
                 start=lambda i: LOG.info('Downloading %s.', colorizer.quote(i.name)),
                 run=lambda i: i.download(),
                 end=lambda i, result: LOG.info("Performed %s downloads.", len(result))
             ),
             group,
             instances,
             "download",
             *removals
         )
         removals.extend(states.reverts("download-patch"))
         self._run_phase(
             action.PhaseFunctors(
                 start=lambda i: LOG.info('Post-download patching %s.', colorizer.quote(i.name)),
                 run=lambda i: i.patch("download"),
                 end=None,
             ),
             group,
             instances,
             "download-patch",
             *removals
         )
         dependency_handler.package_start()
         removals.extend(states.reverts("package"))
         try:
             self._run_phase(
                 action.PhaseFunctors(
                     start=lambda i: LOG.info("Packaging %s.", colorizer.quote(i.name)),
                     run=dependency_handler.package_instance,
                     end=None,
                 ),
                 group,
                 instances,
                 "package",
                 *removals
             )
         finally:
             dependency_handler.package_finish()
         prior_groups.append((group, instances))
Exemplo n.º 6
0
 def _run(self, persona, component_order, instances):
     dependency_handler_class = self.distro.dependency_handler_class
     dependency_handler = dependency_handler_class(self.distro,
                                                   self.root_dir,
                                                   instances.values(),
                                                   self.cli_opts)
     removals = states.reverts("package-install-all-deps")
     general_package = "general"
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info("Installing packages"),
             run=lambda i: dependency_handler.install_all_deps(),
             end=None,
         ),
         [general_package],
         {general_package: instances[general_package]},
         "package-install-all-deps",
         *removals
     )
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Running tests of component %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.run_tests(),
             end=None,
         ),
         component_order,
         instances,
         None,
     )
Exemplo n.º 7
0
 def _run(self, persona, component_order, instances):
     dependency_handler_class = self.distro.dependency_handler_class
     dependency_handler = dependency_handler_class(self.distro,
                                                   self.root_dir,
                                                   instances.values(),
                                                   self.cli_opts)
     removals = states.reverts("package-install-all-deps")
     general_package = "general"
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info("Installing packages"),
             run=lambda i: dependency_handler.install_all_deps(),
             end=None,
         ), [general_package],
         {general_package: instances[general_package]},
         "package-install-all-deps", *removals)
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Running tests of component %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.run_tests(),
             end=None,
         ),
         component_order,
         instances,
         None,
     )
Exemplo n.º 8
0
 def _run(self, persona, groups):
     prior_groups = []
     for group, instances in groups:
         LOG.info("Preparing group %s...", colorizer.quote(group))
         dependency_handler_class = self.distro.dependency_handler_class
         dependency_handler = dependency_handler_class(
             self.distro, self.root_dir, instances.values(), self.cli_opts,
             group, prior_groups)
         removals = states.reverts("download")
         self._run_phase(
             action.PhaseFunctors(
                 start=lambda i: LOG.info('Downloading %s.',
                                          colorizer.quote(i.name)),
                 run=lambda i: i.download(),
                 end=lambda i, result: LOG.info("Performed %s downloads.",
                                                len(result))), group,
             instances, "download", *removals)
         removals.extend(states.reverts("download-patch"))
         self._run_phase(
             action.PhaseFunctors(
                 start=lambda i: LOG.info('Post-download patching %s.',
                                          colorizer.quote(i.name)),
                 run=lambda i: i.patch("download"),
                 end=None,
             ), group, instances, "download-patch", *removals)
         dependency_handler.package_start()
         removals.extend(states.reverts("package"))
         if not hasattr(dependency_handler, 'package_instances'):
             self._run_phase(
                 action.PhaseFunctors(
                     start=lambda i: LOG.info("Packaging %s.",
                                              colorizer.quote(i.name)),
                     run=dependency_handler.package_instance,
                     end=None,
                 ), group, instances, "package", *removals)
         else:
             self._run_many_phase(
                 action.PhaseFunctors(
                     start=lambda i: LOG.info("Packaging %s.",
                                              colorizer.quote(i.name)),
                     run=dependency_handler.package_instances,
                     end=None,
                 ), group, instances, "package", *removals)
         dependency_handler.package_finish()
         prior_groups.append((group, instances))
Exemplo n.º 9
0
 def _run(self, persona, component_order, instances):
     super(RemoveAction, self)._run(persona, component_order, instances)
     dependency_handler_class = self.distro.dependency_handler_class
     dependency_handler = dependency_handler_class(self.distro,
                                                   self.root_dir,
                                                   instances.values(),
                                                   self.cli_opts)
     removals = states.reverts("package-destroy")
     general_package = "general"
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info("Destroying packages"),
             run=lambda i: dependency_handler.destroy(),
             end=None,
         ),
         [general_package],
         {general_package: instances[general_package]},
         "package-destroy",
         *removals
     )
     removals.extend(states.reverts('uninstall'))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Uninstalling %s.', colorizer.quote(i.name)),
             run=lambda i: i.uninstall(),
             end=None,
         ),
         component_order,
         instances,
         'uninstall',
         *removals
     )
     removals.extend(states.reverts('post-uninstall'))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Post-uninstalling %s.', colorizer.quote(i.name)),
             run=lambda i: i.post_uninstall(),
             end=None,
         ),
         component_order,
         instances,
         'post-uninstall',
         *removals
     )
Exemplo n.º 10
0
 def _run(self, persona, component_order, instances):
     removals = states.reverts("pre-start")
     self._run_phase(
         action.PhaseFunctors(
             start=None,
             run=lambda i: i.pre_start(),
             end=None,
         ),
         component_order,
         instances,
         "pre-start",
         *removals
     )
     removals.extend(states.reverts('start'))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Starting %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.start(),
             end=lambda i, result: LOG.info("Started %s application(s).",
                                            colorizer.quote(result)),
         ),
         component_order,
         instances,
         "start",
         *removals
     )
     removals.extend(states.reverts('post-start'))
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Post-starting %s.',
                                      colorizer.quote(i.name)),
             run=lambda i: i.post_start(),
             end=None,
         ),
         component_order,
         instances,
         "post-start",
         *removals
     )
Exemplo n.º 11
0
 def _run(self, persona, component_order, instances):
     removals = states.reverts("stopped")
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info("Stopping %s.", colorizer.quote(i.name)),
             run=lambda i: i.stop(),
             end=lambda i, result: LOG.info("Stopped %s application(s).", colorizer.quote(result)),
         ),
         component_order,
         instances,
         "stopped",
         *removals
     )
Exemplo n.º 12
0
 def _run(self, persona, component_order, instances):
     removals = states.reverts("stopped")
     self._run_phase(
         action.PhaseFunctors(
             start=lambda i: LOG.info('Stopping %s.', colorizer.quote(i.name)),
             run=lambda i: i.stop(),
             end=lambda i, result: LOG.info("Stopped %s application(s).",
                                            colorizer.quote(result)),
         ),
         component_order,
         instances,
         "stopped",
         *removals
     )