将 hadoop-plugin 与 hbase-master 关联时 adduser 失败

将 hadoop-plugin 与 hbase-master 关联时 adduser 失败

我正在尝试使用以下 charm 在 juju 中设置 Hbase:https://jujucharms.com/u/bigdata-dev/apache-hbase/trusty/19 当我尝试添加 hadoop-plugin 和 hbase-master 之间的关系时收到错误。

juju status 的输出:

hbase-master:
charm: cs:~bigdata-dev/trusty/apache-hbase-19
exposed: false
service-status:
  current: blocked
  message: Waiting for relation to apache-hadoop-plugin and apache-zookeeper
  since: 28 Feb 2016 05:01:52-08:00
relations:
  hadoop-plugin:
  - plugin
units:
  apache-hbase/0:
    workload-status:
      current: blocked
      message: Waiting for relation to apache-hadoop-plugin and apache-zookeeper
      since: 28 Feb 2016 05:01:52-08:00
    agent-status:
      current: idle
      since: 28 Feb 2016 05:46:55-08:00
      version: 1.25.3.1
    agent-state: started
    agent-version: 1.25.3.1
    machine: "6"
    public-address: 10.0.3.35
    subordinates:
      plugin/0:
        workload-status:
          current: error
          message: 'hook failed: "install"'
          since: 28 Feb 2016 05:23:41-08:00
        agent-status:
          current: idle
          since: 28 Feb 2016 05:23:41-08:00
          version: 1.25.3.1
        agent-state: error
        agent-state-info: 'hook failed: "install"'
        agent-version: 1.25.3.1
        upgrading-from: cs:trusty/apache-hadoop-plugin-10
        public-address: 10.0.3.35

检查插件/0 的日志:

    Creating user hdfs in primary group hadoop and secondary groups []
INFO install Traceback (most recent call last):
INFO install   File "/var/lib/juju/agents/unit-plugin-/charm/hooks/install", line 17, in <module>
INFO install     common.manage()
INFO install   File "/var/lib/juju/agents/unit-plugin-/charm/hooks/common.py", line 123, in manage
INFO install     manager.manage()
INFO install   File "/var/lib/juju/agents/unit-plugin-0/charm/.venv/lib/python2.7/site-packages/charmhelpers/core/charmframework/base.py", line 115, in manage
INFO install     self.run_callbacks()
INFO install   File "/var/lib/juju/agents/unit-plugin-0/charm/.venv/lib/python2.7/site-packages/charmhelpers/core/charmframework/base.py", line 159, in run_callbacks
INFO install     self.fire_event('callbacks', component)
2016-02-28 13:23:41 INFO install   File "/var/lib/juju/agents/unit-plugin-0/charm/.venv/lib/python2.7/site-packages/charmhelpers/core/charmframework/base.py", line 189, in fire_event
INFO install     callback()
INFO install   File "/var/lib/juju/agents/unit-plugin-0/charm/.venv/lib/python2.7/site-packages/jujubigdata/handlers.py", line 101, in install
INFO install     self.dist_config.add_users()
INFO install   File "/var/lib/juju/agents/unit-plugin-0/charm/.venv/lib/python2.7/site-packages/jujubigdata/utils.py", line 149, in add_users
INFO install     host.adduser(username, primary_group=primary_grp, secondary_groups=secondary_grps)
INFO install TypeError: adduser() got an unexpected keyword argument 'primary_group'
ERROR juju.worker.uniter.operation runhook.go:107 hook "install" failed: exit status 1

失败的代码:

def add_users(self):
    for group in self.groups:
        host.add_group(group)
    for username, details in self.users.items():
        primary_grp = None
        secondary_grps = None
        groups = details.get('groups', [])
        if groups:
            primary_grp = groups[0]
            secondary_grps = groups[1:]
        hookenv.log('Creating user {0} in primary group {1} and secondary groups {2}'
                    .format(username, primary_grp, secondary_grps))
        host.adduser(username, primary_group=primary_grp, secondary_groups=secondary_grps)

知道如何让它工作吗?

答案1

通过更改修复

host.adduser(username, primary_group=primary_grp, secondary_groups=secondary_grps)

host.adduser(username, group=primary_grp, groups=secondary_grps)

然后重试服务

juju resolved --retry servicename

相关内容