问题描述
我正在寻找将yum-s3-iam实用程序https://github.com/seporaitis/yum-s3-iam/blob/master/s3iam.py转换为DNF的方法,并且可以帮助您添加自定义回购配置。原始实用程序具有以下内容:
yum.config.RepoConf.s3_enabled = yum.config.BoolOption(False)
yum.config.RepoConf.region = yum.config.Option()
我无法在文档https://dnf.readthedocs.io/en/latest/api_repos.html中找到它,但它看起来像dnf.conf。RepoConf可以解决这个问题,但运气不好: https://github.com/rpm-software-management/dnf/blob/master/dnf/conf/config.py#L470
def config_hook(self):
dnf.conf.RepoConf.s3_enabled = dnf.conf.BoolOption(False)
dnf.conf.RepoConf.region = dnf.conf.Option()
self.region = dnf.conf.RepoConf.Option()
if __name__ == '__main__':
"""Plugin initialization hook. Setup the S3 repositories."""
base = dnf.Base()
conf = base.conf
base.read_all_repos()
repos = base.repos
config_hook(conf)
config_hook(repos)
[root@ip dnf-plugins]# python3 s3iam.py
Traceback (most recent call last):
File "s3iam.py",line 543,in <module>
config_hook(conf)
File "s3iam.py",line 78,in config_hook
dnf.conf.RepoConf.s3_enabled = dnf.conf.BoolOption(False)
AttributeError: module 'dnf.conf' has no attribute 'BoolOption'
[root@ip dnf-plugins]# python3 s3iam.py
Traceback (most recent call last):
File "s3iam.py",line 542,line 77,in config_hook
dnf.conf.RepoConf.region = dnf.conf.Option()
AttributeError: module 'dnf.conf' has no attribute 'Option'
[root@ip dnf-plugins]# python3 s3iam.py
Traceback (most recent call last):
File "s3iam.py",in config_hook
self.region = dnf.conf.RepoConf.Option()
AttributeError: type object 'RepoConf' has no attribute 'Option'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)