當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。