Example #1
0
 def test_install(self, minstall_group):
     minstall_group.return_value = False
     success = jujuresources._install(self.resources, None, 'mirror', 'dest', True)
     assert not success
     self.resources['valid'].install.assert_called_with('dest', True)
     assert not self.resources['py-valid'].install.called
     self.resources['invalid'].install.assert_called_with('dest', True)
     assert not self.resources['py-invalid'].install.called
     assert not self.resources['opt-invalid'].install.called
     minstall_group.assert_called_with(mock.ANY, 'mirror')
     self.assertItemsEqual(
         minstall_group.call_args_list[0][0][0],
         [self.resources['py-valid'], self.resources['py-invalid']])
     assert jujuresources._install(self.resources, 'valid', 'mirror', 'dest', True)
     assert not jujuresources._install(self.resources, ['valid', 'py-invalid'], 'mirror', 'dest', True)
     minstall_group.return_value = True
     assert jujuresources._install(self.resources, ['valid', 'py-valid'], 'mirror', 'dest', True)
Example #2
0
 def test_install(self, minstall_group):
     minstall_group.return_value = False
     success = jujuresources._install(self.resources, None, 'mirror',
                                      'dest', True)
     assert not success
     self.resources['valid'].install.assert_called_with('dest', True)
     assert not self.resources['py-valid'].install.called
     self.resources['invalid'].install.assert_called_with('dest', True)
     assert not self.resources['py-invalid'].install.called
     assert not self.resources['opt-invalid'].install.called
     minstall_group.assert_called_with(mock.ANY, 'mirror')
     self.assertItemsEqual(
         minstall_group.call_args_list[0][0][0],
         [self.resources['py-valid'], self.resources['py-invalid']])
     assert jujuresources._install(self.resources, 'valid', 'mirror',
                                   'dest', True)
     assert not jujuresources._install(
         self.resources, ['valid', 'py-invalid'], 'mirror', 'dest', True)
     minstall_group.return_value = True
     assert jujuresources._install(self.resources, ['valid', 'py-valid'],
                                   'mirror', 'dest', True)
Example #3
0
def install(opts):
    """
    Install one or more resources.
    """
    resources = _load(opts.resources, opts.output_dir)
    if opts.all:
        opts.resource_names = ALL
    success = _install(resources, opts.resource_names, opts.mirror_url,
                       opts.destination, opts.skip_top_level)
    if success:
        if not opts.quiet:
            print("All resources successfully installed")
        return 0
    else:
        if not opts.quiet:
            invalid = _invalid(resources, opts.resource_names)
            print("Unable to install some resources: {}".format(', '.join(invalid)))
        return 1
Example #4
0
def install(opts):
    """
    Install one or more resources.
    """
    resources = _load(opts.resources, opts.output_dir)
    if opts.all:
        opts.resource_names = ALL
    success = _install(resources, opts.resource_names, opts.mirror_url,
                       opts.destination, opts.skip_top_level)
    if success:
        if not opts.quiet:
            print("All resources successfully installed")
        return 0
    else:
        if not opts.quiet:
            invalid = _invalid(resources, opts.resource_names)
            print("Unable to install some resources: {}".format(
                ', '.join(invalid)))
        return 1