def _update_manager_blueprint(self):
        security_settings = self.get_security_settings()
        with util.YamlPatcher(self.test_manager_types_path) as patch:
            for key, value in security_settings.items():
                patch.set_value(key, value)

        props = self.get_manager_blueprint_additional_props_override()
        with util.YamlPatcher(self.test_manager_blueprint_path) as patch:
            for key, value in props.items():
                patch.set_value(key, value)
示例#2
0
 def _add_description_field_to_openstack_security_groups(self):
     # updating 'description' field in security groups - this has become
     # mandatory in Openstack security groups (see CFY-2834). since we're
     # using an old Openstack plugin, we have to explicitly add support
     # for this in the blueprint itself
     with util.YamlPatcher(self.blueprint_yaml) as patch:
         patch.set_value('node_templates.nodecellar_security_group.'
                         'properties.security_group.description',
                         'nodecellar security group')
         patch.set_value('node_templates.mongod_security_group.'
                         'properties.security_group.description',
                         'mongod security group')
def _modify_blueprint(blueprint_path):
    with util.YamlPatcher(blueprint_path) as patcher:
        # Remove security group
        patcher.delete_property('node_templates.security_group')
        # Remove the webserver node
        patcher.delete_property('node_templates.http_web_server')
        # Remove the output
        patcher.delete_property('outputs', 'http_endpoint')
        # Remove vm to security_group relationships
        blueprint = util.get_yaml_as_dict(blueprint_path)
        vm_relationships = blueprint['node_templates']['vm']['relationships']
        vm_relationships = [
            r for r in vm_relationships if r['target'] != 'security_group'
        ]
        patcher.set_value('node_templates.vm.relationships', vm_relationships)
        # Remove vm interfaces - this is needed because it contains
        # a get_attribute with a reference to the deleted security group node.
        patcher.delete_property('node_templates.vm.interfaces')
def _modify_blueprint(blueprint_path):
    groups = {
        'autohealing_group': {
            'members': ['nodejs_host'],
            'policies': {
                'simple_autoheal_policy': {
                    'type': 'cloudify.policies.types.host_failure',
                    'properties': {
                        'service': ['cpu.total.system']
                    },
                    'triggers': {
                        'auto_heal_trigger': {
                            'type':
                            'cloudify.policies.triggers.execute_workflow',
                            'parameters': {
                                'workflow': 'heal',
                                'workflow_parameters': {
                                    'node_instance_id': {
                                        'get_property': ['SELF', 'node_id']
                                    },
                                    'diagnose_value': {
                                        'get_property': ['SELF', 'diagnose']
                                    },
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    outputs = {
        'nodejs_host_id': {
            'value': {
                'get_attribute': ['nodejs_host', 'external_id']
            }
        }
    }
    with util.YamlPatcher(blueprint_path) as patcher:
        patcher.merge_obj('groups', groups)
        patcher.merge_obj('outputs', outputs)
 def _update_manager_blueprint(self):
     src_plugin_dir = util.get_plugin_path('mock-rest-plugin')
     shutil.copytree(src_plugin_dir,
                     self.test_manager_blueprint_path.dirname() /
                     'mock-rest-plugin')
     plugins = {
         'plugin1': {
             # testing plugin installation from remote url
             'source': 'https://github.com/cloudify-cosmo/'
                       'cloudify-plugin-template/archive/{0}.zip'
                       .format(os.environ.get('BRANCH_NAME_CORE',
                                              'master'))
         },
         'plugin2': {
             # testing plugin installation in manager blueprint directory
             'source': 'mock-rest-plugin',
             # testing install_args, without the following, plugin
             # installation should fail
             'install_args': "--install-option='--do-not-fail'"
         }
     }
     plugins_path = 'node_templates.manager.properties.cloudify.plugins'
     with util.YamlPatcher(self.test_manager_blueprint_path) as patch:
         patch.set_value(plugins_path, plugins)
 def _update_userstore_file(self):
     userstore_settings = self.get_userstore_settings()
     with util.YamlPatcher(self.test_userstore_file_path) as patch:
         for key, value in userstore_settings.items():
             patch.set_value(key, value)
示例#7
0
 def _update_manager_blueprint(self):
     inputs_props = self.get_manager_blueprint_inputs_override()
     with util.YamlPatcher(self.test_inputs_path) as patch:
         for key, value in inputs_props.items():
             patch.set_value(key, value)
示例#8
0
 def _update_manager_blueprint(self):
     props = self.get_manager_blueprint_additional_props_override()
     with util.YamlPatcher(self.test_manager_blueprint_path) as patch:
         patch.set_value(SECURITY_PROP_PATH, self.get_security_settings())
         for key, value in props.items():
             patch.set_value(key, value)