当前位置: 首页>>代码示例>>Python>>正文


Python harden.harden方法代码示例

本文整理汇总了Python中charmhelpers.contrib.hardening.harden.harden方法的典型用法代码示例。如果您正苦于以下问题:Python harden.harden方法的具体用法?Python harden.harden怎么用?Python harden.harden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在charmhelpers.contrib.hardening.harden的用法示例。


在下文中一共展示了harden.harden方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: install_percona_xtradb_cluster

# 需要导入模块: from charmhelpers.contrib.hardening import harden [as 别名]
# 或者: from charmhelpers.contrib.hardening.harden import harden [as 别名]
def install_percona_xtradb_cluster():
    '''Attempt PXC install based on seeding of passwords for users'''
    if pxc_installed():
        log('MySQL already installed, skipping')
        return

    _root_password = root_password()
    _sst_password = sst_password()
    if not _root_password or not _sst_password:
        log('Passwords not seeded, unable to install MySQL at this'
            ' point so deferring installation')
        return
    configure_mysql_root_password(_root_password)

    apt_install(determine_packages(), fatal=True)

    configure_sstuser(_sst_password)
    if config('harden') and 'mysql' in config('harden'):
        run_mysql_checks() 
开发者ID:openstack,项目名称:charm-percona-cluster,代码行数:21,代码来源:percona_hooks.py

示例2: test_harden

# 需要导入模块: from charmhelpers.contrib.hardening import harden [as 别名]
# 或者: from charmhelpers.contrib.hardening.harden import harden [as 别名]
def test_harden(self, mock_host, mock_ssh, mock_mysql, mock_apache):
        mock_host.__name__ = 'host'
        mock_ssh.__name__ = 'ssh'
        mock_mysql.__name__ = 'mysql'
        mock_apache.__name__ = 'apache'

        @harden.harden(overrides=['ssh', 'mysql'])
        def foo(arg1, kwarg1=None):
            return "done."

        self.assertEqual(foo('anarg', kwarg1='akwarg'), "done.")
        self.assertTrue(mock_ssh.called)
        self.assertTrue(mock_mysql.called)
        self.assertFalse(mock_apache.called)
        self.assertFalse(mock_host.called) 
开发者ID:juju,项目名称:charm-helpers,代码行数:17,代码来源:test_harden.py


注:本文中的charmhelpers.contrib.hardening.harden.harden方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。