Beispiel #1
0
  def configureResourcesCalled(self):
    self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-logfeeder',
                              create_parents=True,
                              cd_access='a',
                              mode=0755
                              )
    self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-logfeeder',
                              create_parents=True,
                              cd_access='a',
                              mode=0755
                              )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
                              create_parents=True,
                              cd_access='a',
                              mode=0755
                              )

    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder',
                              create_parents=True,
                              recursive_ownership=True,
                              cd_access='a',
                              mode=0755
                              )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-logfeeder/conf',
                              create_parents=True,
                              recursive_ownership=True,
                              cd_access='a',
                              mode=0755
                              )

    self.assertResourceCalled('File', '/var/log/ambari-logsearch-logfeeder/logfeeder.out',
                              mode=0644,
                              content=''
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/logfeeder.properties',
                              content=Template('logfeeder.properties.j2')
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
                              mode=0755,
                              content=InlineTemplate(self.getConfig()['configurations']['logfeeder-env']['content'])
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/log4j.xml',
                              content=InlineTemplate(self.getConfig()['configurations']['logfeeder-log4j']['content'])
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/grok-patterns',
                              content=Template('grok-patterns.j2'),
                              encoding='utf-8'
                              )

    logfeeder_supported_services = ['accumulo', 'ambari', 'ams', 'atlas', 'falcon', 'flume', 'hbase', 'hdfs', 'hive', 'hst', 'kafka',
                                    'knox', 'logsearch', 'nifi', 'oozie', 'ranger', 'spark', 'spark2', 'storm', 'yarn', 'zeppelin', 'zookeeper']

    logfeeder_config_file_names = ['global.config.json', 'output.config.json'] + ['input.config-%s.json' % (tag) for tag
                                                                                  in logfeeder_supported_services]

    for file_name in logfeeder_config_file_names:
      self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/' + file_name,
                                content=Template(file_name + ".j2")
                                )
Beispiel #2
0
    def __asserts_for_hawq_check(self, expectedCommand):

        self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR +
                           '/scripts/hawqmaster.py',
                           classname='HawqMaster',
                           command='run_hawq_check',
                           config_dict=self.config_dict,
                           stack_version=self.STACK_VERSION,
                           target=RMFTestCase.TARGET_COMMON_SERVICES)

        self.assertResourceCalled(
            'File',
            "/usr/local/hawq/etc/hawq_hosts",
            content=InlineTemplate(
                "{% for host in hawq_all_hosts %}{{host}}\n{% endfor %}"),
            group=self.GPADMIN,
            owner=self.GPADMIN,
            mode=0644)

        self.assertResourceCalled('Execute',
                                  expectedCommand,
                                  logoutput=True,
                                  not_if=None,
                                  only_if=None,
                                  user=self.GPADMIN,
                                  timeout=900)

        self.assertNoMoreResources()
Beispiel #3
0
    def configureResourcesCalled(self):
        self.assertResourceCalled('Directory',
                                  '/var/log/ambari-logsearch-logfeeder',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/var/run/ambari-logsearch-logfeeder',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled(
            'Directory',
            '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
            create_parents=True,
            cd_access='a',
            mode=0755)

        self.assertResourceCalled('Directory',
                                  '/usr/lib/ambari-logsearch-logfeeder',
                                  create_parents=True,
                                  recursive_ownership=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/etc/ambari-logsearch-logfeeder/conf',
                                  create_parents=True,
                                  recursive_ownership=True,
                                  cd_access='a',
                                  mode=0755)

        self.assertResourceCalled(
            'File',
            '/var/log/ambari-logsearch-logfeeder/logfeeder.out',
            mode=0644,
            content='')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/keys/ks_pass.txt',
            action=['delete'])
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/keys/ts_pass.txt',
            action=['delete'])
        self.assertResourceCalled(
            'PropertiesFile',
            '/etc/ambari-logsearch-logfeeder/conf/logfeeder.properties',
            properties={
                'hadoop.security.credential.provider.path':
                'jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks',
                'logfeeder.checkpoint.folder':
                '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
                'logfeeder.config.files':
                'output.config.json,input.config-ambari.json,global.config.json,input.config-logsearch.json,input.config-zookeeper.json',
                'logfeeder.metrics.collector.hosts':
                '',
                'logfeeder.metrics.collector.path':
                '/ws/v1/timeline/metrics',
                'logfeeder.metrics.collector.port':
                '',
                'logfeeder.metrics.collector.protocol':
                '',
                'logfeeder.solr.core.config.name':
                'history',
                'logfeeder.solr.zk_connect_string':
                'c6401.ambari.apache.org:2181/infra-solr'
            })
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
            mode=0755,
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logfeeder-env']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/log4j.xml',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logfeeder-log4j']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/grok-patterns',
            content=InlineTemplate('GP'),
            encoding='utf-8')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/input.config-ambari.json',
            content=InlineTemplate('ambari-grok-filter'),
            encoding='utf-8')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/output.config.json',
            content=InlineTemplate('output-grok-filter'),
            encoding='utf-8')

        logfeeder_supported_services = ['logsearch']

        logfeeder_config_file_names = ['global.config.json'] + \
                                      ['input.config-%s.json' % (tag) for tag in logfeeder_supported_services]

        for file_name in logfeeder_config_file_names:
            self.assertResourceCalled('File',
                                      '/etc/ambari-logsearch-logfeeder/conf/' +
                                      file_name,
                                      content=Template(file_name + ".j2"))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/input.config-logfeeder-custom.json',
            action=['delete'])
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-logfeeder/conf/input.config-zookeeper.json',
            content=InlineTemplate("pattern content"))
Beispiel #4
0
    def asserts_for_configure(self):

        self.assertResourceCalled('Group', self.GPADMIN, ignore_failures=True)

        self.assertResourceCalled('User',
                                  self.GPADMIN,
                                  gid=self.GPADMIN,
                                  groups=[self.GPADMIN, u'hadoop'],
                                  ignore_failures=True,
                                  password=crypt.crypt(
                                      self.config_dict['configurations']
                                      ['hawq-env']['hawq_password'],
                                      "$1$salt$"))

        self.assertResourceCalled('Group', self.POSTGRES, ignore_failures=True)

        self.assertResourceCalled('User',
                                  self.POSTGRES,
                                  gid=self.POSTGRES,
                                  groups=[self.POSTGRES, u'hadoop'],
                                  ignore_failures=True)

        self.assertResourceCalled('Execute',
                                  'chown -R gpadmin:gpadmin /usr/local/hawq/',
                                  timeout=600)

        self.assertResourceCalled(
            'XmlConfig',
            'hdfs-client.xml',
            conf_dir=self.CONF_DIR,
            configurations=self.getConfig()['configurations']['hdfs-client'],
            configuration_attributes=self.getConfig()
            ['configuration_attributes']['hdfs-client'],
            group=self.GPADMIN,
            owner=self.GPADMIN,
            mode=0644)

        self.assertResourceCalled(
            'XmlConfig',
            'yarn-client.xml',
            conf_dir=self.CONF_DIR,
            configurations=self.getConfig()['configurations']['yarn-client'],
            configuration_attributes=self.getConfig()
            ['configuration_attributes']['yarn-client'],
            group=self.GPADMIN,
            owner=self.GPADMIN,
            mode=0644)

        self.assertResourceCalled(
            'XmlConfig',
            'hawq-site.xml',
            conf_dir=self.CONF_DIR,
            configurations=self.getConfig()['configurations']['hawq-site'],
            configuration_attributes=self.getConfig()
            ['configuration_attributes']['hawq-site'],
            group=self.GPADMIN,
            owner=self.GPADMIN,
            mode=0644)

        if self.COMPONENT_TYPE == 'master':
            self.assertResourceCalled(
                'File',
                self.CONF_DIR + 'hawq_check.cnf',
                content=self.getConfig()['configurations']['hawq-check-env']
                ['content'],
                owner=self.GPADMIN,
                group=self.GPADMIN,
                mode=0644)

            self.assertResourceCalled(
                'File',
                self.CONF_DIR + 'slaves',
                content=InlineTemplate(
                    'c6401.ambari.apache.org\nc6402.ambari.apache.org\nc6403.ambari.apache.org\n\n'
                ),
                group=self.GPADMIN,
                owner=self.GPADMIN,
                mode=0644)

        self.assertResourceCalled('Directory',
                                  '/data/hawq/' + self.COMPONENT_TYPE,
                                  group=self.GPADMIN,
                                  owner=self.GPADMIN,
                                  create_parents=True)

        self.assertResourceCalled('Execute',
                                  'chmod 700 /data/hawq/' +
                                  self.COMPONENT_TYPE,
                                  user='******',
                                  timeout=600)

        self.assertResourceCalled('Directory',
                                  '/data/hawq/tmp/' + self.COMPONENT_TYPE,
                                  group=self.GPADMIN,
                                  owner=self.GPADMIN,
                                  create_parents=True)
Beispiel #5
0
    def configureResourcesCalled(self):
        self.assertResourceCalled('Directory',
                                  '/var/log/ambari-infra-solr',
                                  owner='solr',
                                  group='hadoop',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/var/run/ambari-infra-solr',
                                  owner='solr',
                                  group='hadoop',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/opt/ambari_infra_solr/data',
                                  owner='solr',
                                  group='hadoop',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/opt/ambari_infra_solr/data/resources',
                                  owner='solr',
                                  group='hadoop',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/usr/lib/ambari-infra-solr',
                                  owner='solr',
                                  group='hadoop',
                                  create_parents=True,
                                  recursive_ownership=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/etc/ambari-infra-solr/conf',
                                  owner='solr',
                                  group='hadoop',
                                  create_parents=True,
                                  recursive_ownership=True,
                                  cd_access='a',
                                  mode=0755)

        self.assertResourceCalled(
            'File',
            '/var/log/ambari-infra-solr/solr-install.log',
            owner='solr',
            group='hadoop',
            mode=0644,
            content='')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-infra-solr/conf/infra-solr-env.sh',
            owner='solr',
            group='hadoop',
            mode=0755,
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['infra-solr-env']['content']))
        self.assertResourceCalled(
            'File',
            '/opt/ambari_infra_solr/data/solr.xml',
            owner='solr',
            group='hadoop',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['infra-solr-xml']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-infra-solr/conf/log4j.properties',
            owner='solr',
            group='hadoop',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['infra-solr-log4j']['content']))

        self.assertResourceCalled(
            'File',
            '/etc/ambari-infra-solr/conf/custom-security.json',
            owner='solr',
            group='hadoop',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['infra-solr-security-json']['content']),
            mode=0640)
        self.assertResourceCalled('File',
                                  '/etc/security/limits.d/infra-solr.conf',
                                  owner='root',
                                  group='root',
                                  content=Template('infra-solr.conf.j2'))

        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --create-znode --retry 30 --interval 5'
        )
        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --remove-admin-handlers --collection hadoop_logs --retry 5 --interval 10'
        )
        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --remove-admin-handlers --collection audit_logs --retry 5 --interval 10'
        )
        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --remove-admin-handlers --collection history --retry 5 --interval 10'
        )
        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --cluster-prop --property-name urlScheme --property-value http'
        )
        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --setup-kerberos-plugin'
        )
Beispiel #6
0
  def configureResourcesCalled(self):
    self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              recursive_ownership = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              recursive_ownership = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/solr_configsets',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              recursive_ownership = True,
                              cd_access = 'a',
                              mode = 0755
                              )

    self.assertResourceCalled('File', '/var/log/ambari-logsearch-portal/logsearch.out',
                              owner = 'logsearch',
                              group = 'hadoop',
                              mode = 0644,
                              content = ''
    )
    self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-portal/conf/logsearch.properties',
                              properties = {'logsearch.audit.logs.split.interval.mins': '1',
                                            'logsearch.auth.external_auth.enabled': 'false',
                                            'logsearch.auth.external_auth.host_url': 'http://c6401.ambari.apache.org:8080',
                                            'logsearch.auth.external_auth.login_url': '/api/v1/users/$USERNAME/privileges?fields=*',
                                            'logsearch.auth.file.enabled': 'true',
                                            'logsearch.auth.ldap.enabled': 'false',
                                            'logsearch.auth.simple.enabled': 'false',
                                            'logsearch.collection.audit.logs.numshards': '10',
                                            'logsearch.collection.audit.logs.replication.factor': '1',
                                            'logsearch.collection.history.replication.factor': '1',
                                            'logsearch.collection.service.logs.numshards': '10',
                                            'logsearch.collection.service.logs.replication.factor': '1',
                                            'logsearch.login.credentials.file': 'logsearch-admin.json',
                                            'logsearch.protocol': 'http',
                                            'logsearch.roles.allowed': 'AMBARI.ADMINISTRATOR',
                                            'logsearch.service.logs.split.interval.mins': '1',
                                            'logsearch.solr.audit.logs.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr',
                                            'logsearch.solr.collection.audit.logs': 'audit_logs',
                                            'logsearch.solr.collection.history': 'history',
                                            'logsearch.solr.collection.service.logs': 'hadoop_logs',
                                            'logsearch.solr.history.config.name': 'history',
                                            'logsearch.solr.metrics.collector.hosts': '',
                                            'logsearch.solr.jmx.port': '1',
                                            'logsearch.solr.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr'
                              }
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
                              owner = 'logsearch',
                              group='hadoop',
                              content = Template('HadoopServiceConfig.json.j2')
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/log4j.xml',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-log4j']['content'])
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-env']['content']),
                              mode = 0755,
                              owner = "logsearch",
                              group='hadoop'
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-admin.json',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-admin-json']['content'])
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-service_logs-solrconfig']['content'])
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-audit_logs-solrconfig']['content'])
                              )

    self.assertResourceCalled('Execute', 'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --check-znode --retry 5 --interval 10')
    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --download-config --config-dir /tmp/solr_config_hadoop_logs_0.[0-9]* --config-set hadoop_logs --retry 30 --interval 5')
    self.assertResourceCalledRegexp('^File$', '^/tmp/solr_config_hadoop_logs_0.[0-9]*',
                                    content=InlineTemplate(self.getConfig()['configurations']['logsearch-service_logs-solrconfig']['content']),
                                    only_if='test -d /tmp/solr_config_hadoop_logs_0.[0-9]*')
    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /tmp/solr_config_hadoop_logs_0.[0-9]* --config-set hadoop_logs --retry 30 --interval 5',
                                    only_if='test -d /tmp/solr_config_hadoop_logs_0.[0-9]*')

    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf --config-set hadoop_logs --retry 30 --interval 5',
                                    not_if='test -d /tmp/solr_config_hadoop_logs_0.[0-9]*')
    self.assertResourceCalledRegexp('^Directory$', '^/tmp/solr_config_hadoop_logs_0.[0-9]*',
                                    action=['delete'],
                                    create_parents=True)


    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --download-config --config-dir /tmp/solr_config_history_0.[0-9]* --config-set history --retry 30 --interval 5')
    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /etc/ambari-logsearch-portal/conf/solr_configsets/history/conf --config-set history --retry 30 --interval 5')
    self.assertResourceCalledRegexp('^Directory$', '^/tmp/solr_config_history_0.[0-9]*',
                                    action=['delete'],
                                    create_parents=True)

    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --download-config --config-dir /tmp/solr_config_audit_logs_0.[0-9]* --config-set audit_logs --retry 30 --interval 5')
    self.assertResourceCalledRegexp('^File$', '^/tmp/solr_config_audit_logs_0.[0-9]*',
                                    content=InlineTemplate(self.getConfig()['configurations']['logsearch-audit_logs-solrconfig']['content']),
                                    only_if='test -d /tmp/solr_config_audit_logs_0.[0-9]*')
    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /tmp/solr_config_audit_logs_0.[0-9]* --config-set audit_logs --retry 30 --interval 5',
                                    only_if='test -d /tmp/solr_config_audit_logs_0.[0-9]*')
    self.assertResourceCalledRegexp('^Execute$', '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf --config-set audit_logs --retry 30 --interval 5',
                                    not_if='test -d /tmp/solr_config_audit_logs_0.[0-9]*')
    self.assertResourceCalledRegexp('^Directory$', '^/tmp/solr_config_audit_logs_0.[0-9]*',
                                    action=['delete'],
                                    create_parents=True)
    self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/etc/ambari-logsearch-portal/conf/solr_configsets'),
                              sudo = True
    )
Beispiel #7
0
  def configureResourcesCalled(self):
    self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              recursive_ownership = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              recursive_ownership = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/solr_configsets',
                              owner = 'logsearch',
                              group = 'hadoop',
                              create_parents = True,
                              recursive_ownership = True,
                              cd_access = 'a',
                              mode = 0755
                              )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/keys',
                              owner = 'logsearch',
                              group = 'hadoop',
                              cd_access = 'a',
                              mode = 0755
                              )

    self.assertResourceCalled('File', '/var/log/ambari-logsearch-portal/logsearch.out',
                              owner = 'logsearch',
                              group = 'hadoop',
                              mode = 0644,
                              content = ''
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/keys/ks_pass.txt',
                              action = ['delete']
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/keys/ts_pass.txt',
                              action = ['delete']
    )
    self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-portal/conf/logsearch.properties',
                              properties = {'common-property': 'common-value',
                                            'hadoop.security.credential.provider.path': 'jceks://file/etc/ambari-logsearch-portal/conf/logsearch.jceks',
                                            'logsearch.audit.logs.split.interval.mins': '1',
                                            'logsearch.auth.external_auth.enabled': 'false',
                                            'logsearch.auth.external_auth.host_url': 'http://c6401.ambari.apache.org:8080',
                                            'logsearch.auth.external_auth.login_url': '/api/v1/users/$USERNAME/privileges?fields=*',
                                            'logsearch.auth.file.enabled': 'true',
                                            'logsearch.auth.ldap.enabled': 'false',
                                            'logsearch.auth.simple.enabled': 'false',
                                            'logsearch.collection.audit.logs.numshards': '10',
                                            'logsearch.collection.audit.logs.replication.factor': '1',
                                            'logsearch.collection.history.replication.factor': '1',
                                            'logsearch.collection.service.logs.numshards': '10',
                                            'logsearch.collection.service.logs.replication.factor': '1',
                                            'logsearch.config.zk_connect_string': 'c6401.ambari.apache.org:2181',
                                            'logsearch.login.credentials.file': 'logsearch-admin.json',
                                            'logsearch.protocol': 'http',
                                            'logsearch.roles.allowed': 'AMBARI.ADMINISTRATOR,CLUSTER.ADMINISTRATOR',
                                            'logsearch.service.logs.split.interval.mins': '1',
                                            'logsearch.solr.audit.logs.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr',
                                            'logsearch.solr.collection.audit.logs': 'audit_logs',
                                            'logsearch.solr.collection.history': 'history',
                                            'logsearch.solr.collection.service.logs': 'hadoop_logs',
                                            'logsearch.solr.history.config.name': 'history',
                                            'logsearch.solr.metrics.collector.hosts': '',
                                            'logsearch.solr.jmx.port': '1',
                                            'logsearch.solr.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr',
                                            'logsearch.spnego.kerberos.host': 'localhost'
                              }
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
                              owner = 'logsearch',
                              group='hadoop',
                              content = Template('HadoopServiceConfig.json.j2')
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/log4j.xml',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-log4j']['content'])
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-env']['content']),
                              mode = 0755,
                              owner = "logsearch",
                              group='hadoop'
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-admin.json',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-admin-json']['content'])
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-service_logs-solrconfig']['content'])
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
                              owner = 'logsearch',
                              group='hadoop',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-audit_logs-solrconfig']['content'])
                              )
    self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/etc/ambari-logsearch-portal/conf/solr_configsets'),
                              sudo = True
    )
    self.assertResourceCalled('Execute', 'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --check-znode --retry 30 --interval 5')
Beispiel #8
0
    def configureResourcesCalled(self):
        self.assertResourceCalled('Directory',
                                  '/var/log/ambari-logsearch-portal',
                                  owner='logsearch',
                                  group='logsearch',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/var/run/ambari-logsearch-portal',
                                  owner='logsearch',
                                  group='logsearch',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/usr/lib/ambari-logsearch-portal',
                                  owner='logsearch',
                                  group='logsearch',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/etc/ambari-logsearch-portal/conf',
                                  owner='logsearch',
                                  group='logsearch',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled(
            'Directory',
            '/etc/ambari-logsearch-portal/conf/solr_configsets',
            owner='logsearch',
            group='logsearch',
            create_parents=True,
            cd_access='a',
            mode=0755)

        self.assertResourceCalled(
            'File',
            '/var/log/ambari-logsearch-portal/logsearch.out',
            owner='logsearch',
            group='logsearch',
            mode=0644,
            content='')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/logsearch.properties',
            owner='logsearch',
            content=Template('logsearch.properties.j2'))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/log4j.xml',
            owner='logsearch',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logsearch-log4j']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logsearch-env']['content']),
            mode=0755,
            owner="logsearch")

        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/user_pass.json',
            owner='logsearch',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logsearch-admin-properties']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
            owner='logsearch',
            content=InlineTemplate(
                self.getConfig()['configurations']
                ['logsearch-service_logs-solrconfig']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
            owner='logsearch',
            content=InlineTemplate(
                self.getConfig()['configurations']
                ['logsearch-audit_logs-solrconfig']['content']))

        self.assertResourceCalledRegexp(
            '^Execute$',
            '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr-client/solrCloudCli.sh -z c6401.ambari.apache.org/logsearch --download-config -d /tmp/solr_config_hadoop_logs_0.[0-9]* -cs hadoop_logs -rt 5 -i 10'
        )
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr-client/solrCloudCli.sh -z c6401.ambari.apache.org/logsearch --upload-config -d /etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf -cs hadoop_logs -rt 5 -i 10'
        )

        self.assertResourceCalledRegexp(
            '^Execute$',
            '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr-client/solrCloudCli.sh -z c6401.ambari.apache.org/logsearch --download-config -d /tmp/solr_config_history_0.[0-9]* -cs history -rt 5 -i 10'
        )
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr-client/solrCloudCli.sh -z c6401.ambari.apache.org/logsearch --upload-config -d /etc/ambari-logsearch-portal/conf/solr_configsets/history/conf -cs history -rt 5 -i 10'
        )

        self.assertResourceCalledRegexp(
            '^Execute$',
            '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr-client/solrCloudCli.sh -z c6401.ambari.apache.org/logsearch --download-config -d /tmp/solr_config_audit_logs_0.[0-9]* -cs audit_logs -rt 5 -i 10'
        )
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr-client/solrCloudCli.sh -z c6401.ambari.apache.org/logsearch --upload-config -d /etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf -cs audit_logs -rt 5 -i 10'
        )

        self.assertResourceCalled(
            'Execute', ('chmod', '-R', 'ugo+r',
                        '/etc/ambari-logsearch-portal/conf/solr_configsets'),
            sudo=True)
Beispiel #9
0
  def configureResourcesCalled(self):
    self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'logsearch',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'logsearch',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal',
                              owner = 'logsearch',
                              group = 'logsearch',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf',
                              owner = 'logsearch',
                              group = 'logsearch',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
    )
    self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/solr_configsets',
                              owner = 'logsearch',
                              group = 'logsearch',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
                              )
    
    self.assertResourceCalled('File', '/var/log/ambari-logsearch-portal/logsearch.out',
                              owner = 'logsearch',
                              group = 'logsearch',
                              mode = 0644,
                              content = ''
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch.properties',
                              owner = 'logsearch',
                              content = Template('logsearch.properties.j2')
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/log4j.xml',
                              owner = 'logsearch',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-log4j']['content'])
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-env']['content']),
                              mode = 0755,
                              owner = "logsearch"
    )

    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/user_pass.json',
                              owner = 'logsearch',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-admin-properties']['content'])
                              )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
                              owner = 'logsearch',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-service_logs-solrconfig']['content'])
    )
    self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
                              owner = 'logsearch',
                              content = InlineTemplate(self.getConfig()['configurations']['logsearch-audit_logs-solrconfig']['content'])
                              )
    
    self.assertResourceCalledRegexp('^Execute$', '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd downconfig -confdir /tmp/solr_config_hadoop_logs_0.[0-9]* -confname hadoop_logs$',
                                    only_if = "^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd get /configs/hadoop_logs$"
    )
    self.assertResourceCalledRegexp('^Execute$', '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd upconfig -confdir /etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf -confname hadoop_logs$',
                                    not_if = "^test -d /tmp/solr_config_hadoop_logs_0.[0-9]*$"
    )

    self.assertResourceCalledRegexp('^Execute$', '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd downconfig -confdir /tmp/solr_config_history_0.[0-9]* -confname history$',
                                    only_if = "^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd get /configs/history$"
    )
    self.assertResourceCalledRegexp('^Execute$', '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd upconfig -confdir /etc/ambari-logsearch-portal/conf/solr_configsets/history/conf -confname history$',
                                  not_if = "^test -d /tmp/solr_config_history_0.[0-9]*$"
    )

    self.assertResourceCalledRegexp('^Execute$', '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd downconfig -confdir /tmp/solr_config_audit_logs_0.[0-9]* -confname audit_logs$',
                                    only_if = "^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd get /configs/audit_logs$"
    )
    self.assertResourceCalledRegexp('^Execute$', '^export JAVA_HOME=/usr/jdk64/jdk1.7.0_45 ; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:None/logsearch -cmd upconfig -confdir /etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf -confname audit_logs$',
                                    not_if = "^test -d /tmp/solr_config_audit_logs_0.[0-9]*$"
    )
    self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/etc/ambari-logsearch-portal/conf/solr_configsets'),
                              sudo=True
    )
Beispiel #10
0
 def configureResourcesCalled(self):
     self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-solr',
                               owner = 'solr',
                               group = 'hadoop',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-solr',
                               owner = 'solr',
                               group = 'hadoop',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/opt/logsearch_solr/data',
                               owner = 'solr',
                               group = 'hadoop',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/opt/logsearch_solr/data/resources',
                               owner = 'solr',
                               group = 'hadoop',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-solr',
                               owner = 'solr',
                               group = 'hadoop',
                               create_parents = True,
                               recursive_ownership = True,
                               cd_access = 'a',
                               mode = 0755
                               )
     self.assertResourceCalled('Directory', '/etc/ambari-logsearch-solr/conf',
                               owner = 'solr',
                               group = 'hadoop',
                               create_parents = True,
                               recursive_ownership = True,
                               cd_access = 'a',
                               mode = 0755
                               )
     
     self.assertResourceCalled('File', '/var/log/ambari-logsearch-solr/solr-install.log',
                               owner = 'solr',
                               group = 'hadoop',
                               mode = 0644,
                               content = ''
     )
     self.assertResourceCalled('File', '/etc/ambari-logsearch-solr/conf/logsearch-solr-env.sh',
                               owner = 'solr',
                               group='hadoop',
                               mode = 0755,
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-solr-env']['content'])
     )
     self.assertResourceCalled('File', '/opt/logsearch_solr/data/solr.xml',
                               owner = 'solr',
                               group='hadoop',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-solr-xml']['content'])
     )
     self.assertResourceCalled('File', '/etc/ambari-logsearch-solr/conf/log4j.properties',
                               owner = 'solr',
                               group='hadoop',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-solr-log4j']['content'])
     )
     self.assertResourceCalled('File', '/opt/logsearch_solr/data/zoo.cfg',
                               owner = 'solr',
                               group='hadoop',
                               content = Template('zoo.cfg.j2')
     )
     self.assertResourceCalled('Execute', 'export JAVA_HOME=/usr/jdk64/jdk1.7.0_45; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:2181 -cmd makepath /logsearch',
                               not_if = "export JAVA_HOME=/usr/jdk64/jdk1.7.0_45; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:2181/logsearch -cmd list",
                               user = "******"
     )
     self.assertResourceCalled('Execute', 'export JAVA_HOME=/usr/jdk64/jdk1.7.0_45; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:2181/logsearch -cmd clusterprop -name urlScheme -val http',
                               user = "******"
     )
     self.assertResourceCalled('Execute', 'export JAVA_HOME=/usr/jdk64/jdk1.7.0_45; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org:2181 -cmd put /logsearch/security.json \'{}\'',
                               user = "******"
                               )
  def configureResourcesCalled(self):
    self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-logfeeder',
                              create_parents=True,
                              cd_access='a',
                              mode=0755
                              )
    self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-logfeeder',
                              create_parents=True,
                              cd_access='a',
                              mode=0755
                              )
    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints',
                              create_parents=True,
                              cd_access='a',
                              mode=0755
                              )

    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder',
                              create_parents=True,
                              recursive_ownership=True,
                              cd_access='a',
                              mode=0755
                              )
    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf',
                              create_parents=True,
                              recursive_ownership=True,
                              cd_access='a',
                              mode=0755
                              )

    self.assertResourceCalled('File', '/var/log/ambari-logsearch-logfeeder/logfeeder.out',
                              mode=0644,
                              content=''
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/keys/ks_pass.txt',
                              action = ['delete']
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/keys/ts_pass.txt',
                              action = ['delete']
                              )
    self.assertResourceCalled('PropertiesFile', '/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder.properties',
                              properties={'cluster.name': 'c1',
                                          'common-property': 'common-value',
                                          'hadoop.security.credential.provider.path': 'jceks://file/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder.jceks',
                                          'logfeeder.checkpoint.folder': '/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints',
                                          'logfeeder.config.dir': '/usr/lib/ambari-logsearch-logfeeder/conf',
                                          'logfeeder.config.files': 'output.config.json,global.config.json',
                                          'logfeeder.metrics.collector.hosts': '',
                                          'logfeeder.metrics.collector.path': '/ws/v1/timeline/metrics',
                                          'logfeeder.metrics.collector.port': '',
                                          'logfeeder.metrics.collector.protocol': '',
                                          'logfeeder.solr.core.config.name': 'history',
                                          'logfeeder.solr.zk_connect_string': 'c6401.ambari.apache.org:2181/infra-solr',
                                          'logsearch.config.zk_connect_string': 'c6401.ambari.apache.org:2181'
                                         }
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
                              mode=0755,
                              content=InlineTemplate(self.getConfig()['configurations']['logfeeder-env']['content'])
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/log4j.xml',
                              content=InlineTemplate(self.getConfig()['configurations']['logfeeder-log4j']['content'])
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/grok-patterns',
                              content=InlineTemplate('GP'),
                              encoding='utf-8'
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/global.config.json',
                              content=Template('global.config.json.j2')
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/input.config-ambari.json',
                              content=InlineTemplate('ambari-grok-filter'),
                              encoding='utf-8'
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/output.config.json',
                              content=InlineTemplate('output-grok-filter'),
                              encoding='utf-8'
                              )
    self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf',
                              create_parents = True,
                              cd_access = 'a',
                              mode = 0755
                              )
    self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/input.config-logsearch.json',
                            mode=0644,
                            content = Template('input.config-logsearch.json.j2', extra_imports=[default])
                            )
Beispiel #12
0
 def configureResourcesCalled(self):
     self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-solr',
                               owner = 'solr',
                               group = 'solr',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/var/log/ambari-logsearch-solr',
                               owner = 'solr',
                               group = 'solr',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/var/run/ambari-logsearch-solr',
                               owner = 'solr',
                               group = 'solr',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/etc/ambari-logsearch-solr/conf',
                               owner = 'solr',
                               group = 'solr',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/opt/logsearch_solr/data',
                               owner = 'solr',
                               group = 'solr',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     self.assertResourceCalled('Directory', '/opt/logsearch_solr/data/resources',
                               owner = 'solr',
                               group = 'solr',
                               create_parents = True,
                               cd_access = 'a',
                               mode = 0755
     )
     
     self.assertResourceCalled('File', '/var/log/ambari-logsearch-solr/solr-install.log',
                               owner = 'solr',
                               group = 'solr',
                               mode = 0644,
                               content = ''
     )
     self.assertResourceCalled('File', '/etc/ambari-logsearch-solr/conf/logsearch-solr-env.sh',
                               owner = 'solr',
                               mode = 0755,
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-solr-env']['content'])
     )
     self.assertResourceCalled('File', '/opt/logsearch_solr/data/solr.xml',
                               owner = 'solr',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-solr-xml']['content'])
     )
     self.assertResourceCalled('File', '/etc/ambari-logsearch-solr/conf/log4j.properties',
                               owner = 'solr',
                               content = InlineTemplate(self.getConfig()['configurations']['logsearch-solr-log4j']['content'])
     )
     self.assertResourceCalled('File', '/opt/logsearch_solr/data/zoo.cfg',
                               owner = 'solr',
                               content = Template('zoo.cfg.j2')
     )
     self.assertResourceCalled('Execute', 'export JAVA_HOME=/usr/jdk64/jdk1.7.0_45; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org -cmd makepath /logsearch',
                               not_if = "export JAVA_HOME=/usr/jdk64/jdk1.7.0_45; /usr/lib/ambari-logsearch-solr/server/scripts/cloud-scripts/zkcli.sh -zkhost c6401.ambari.apache.org -cmd get /logsearch",
                               ignore_failures = True,
                               user = "******"
     )
Beispiel #13
0
    def configureResourcesCalled(self):
        self.assertResourceCalled('Directory',
                                  '/var/log/ambari-logsearch-portal',
                                  owner='logsearch',
                                  group='hadoop',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/var/run/ambari-logsearch-portal',
                                  owner='logsearch',
                                  group='hadoop',
                                  create_parents=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/usr/lib/ambari-logsearch-portal',
                                  owner='logsearch',
                                  group='hadoop',
                                  create_parents=True,
                                  recursive_ownership=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled('Directory',
                                  '/etc/ambari-logsearch-portal/conf',
                                  owner='logsearch',
                                  group='hadoop',
                                  create_parents=True,
                                  recursive_ownership=True,
                                  cd_access='a',
                                  mode=0755)
        self.assertResourceCalled(
            'Directory',
            '/etc/ambari-logsearch-portal/conf/solr_configsets',
            owner='logsearch',
            group='hadoop',
            create_parents=True,
            recursive_ownership=True,
            cd_access='a',
            mode=0755)

        self.assertResourceCalled(
            'File',
            '/var/log/ambari-logsearch-portal/logsearch.out',
            owner='logsearch',
            group='hadoop',
            mode=0644,
            content='')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/logsearch.properties',
            owner='logsearch',
            group='hadoop',
            content=Template('logsearch.properties.j2'))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
            owner='logsearch',
            group='hadoop',
            content=Template('HadoopServiceConfig.json.j2'))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/log4j.xml',
            owner='logsearch',
            group='hadoop',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logsearch-log4j']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logsearch-env']['content']),
            mode=0755,
            owner="logsearch",
            group='hadoop')
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/logsearch-admin.json',
            owner='logsearch',
            group='hadoop',
            content=InlineTemplate(self.getConfig()['configurations']
                                   ['logsearch-admin-json']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
            owner='logsearch',
            group='hadoop',
            content=InlineTemplate(
                self.getConfig()['configurations']
                ['logsearch-service_logs-solrconfig']['content']))
        self.assertResourceCalled(
            'File',
            '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
            owner='logsearch',
            group='hadoop',
            content=InlineTemplate(
                self.getConfig()['configurations']
                ['logsearch-audit_logs-solrconfig']['content']))

        self.assertResourceCalled(
            'Execute',
            'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --check-znode --retry 5 --interval 10'
        )
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --download-config --config-dir /tmp/solr_config_hadoop_logs_0.[0-9]* --config-set hadoop_logs --retry 30 --interval 5'
        )
        self.assertResourceCalledRegexp(
            '^File$',
            '^/tmp/solr_config_hadoop_logs_0.[0-9]*',
            content=InlineTemplate(
                self.getConfig()['configurations']
                ['logsearch-service_logs-solrconfig']['content']),
            only_if='test -d /tmp/solr_config_hadoop_logs_0.[0-9]*')
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /tmp/solr_config_hadoop_logs_0.[0-9]* --config-set hadoop_logs --retry 30 --interval 5',
            only_if='test -d /tmp/solr_config_hadoop_logs_0.[0-9]*')

        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf --config-set hadoop_logs --retry 30 --interval 5',
            not_if='test -d /tmp/solr_config_hadoop_logs_0.[0-9]*')
        self.assertResourceCalledRegexp(
            '^Directory$',
            '^/tmp/solr_config_hadoop_logs_0.[0-9]*',
            action=['delete'],
            create_parents=True)

        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --download-config --config-dir /tmp/solr_config_history_0.[0-9]* --config-set history --retry 30 --interval 5'
        )
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /etc/ambari-logsearch-portal/conf/solr_configsets/history/conf --config-set history --retry 30 --interval 5'
        )
        self.assertResourceCalledRegexp('^Directory$',
                                        '^/tmp/solr_config_history_0.[0-9]*',
                                        action=['delete'],
                                        create_parents=True)

        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --download-config --config-dir /tmp/solr_config_audit_logs_0.[0-9]* --config-set audit_logs --retry 30 --interval 5'
        )
        self.assertResourceCalledRegexp(
            '^File$',
            '^/tmp/solr_config_audit_logs_0.[0-9]*',
            content=InlineTemplate(
                self.getConfig()['configurations']
                ['logsearch-audit_logs-solrconfig']['content']),
            only_if='test -d /tmp/solr_config_audit_logs_0.[0-9]*')
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /tmp/solr_config_audit_logs_0.[0-9]* --config-set audit_logs --retry 30 --interval 5',
            only_if='test -d /tmp/solr_config_audit_logs_0.[0-9]*')
        self.assertResourceCalledRegexp(
            '^Execute$',
            '^ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181/infra-solr --upload-config --config-dir /etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf --config-set audit_logs --retry 30 --interval 5',
            not_if='test -d /tmp/solr_config_audit_logs_0.[0-9]*')
        self.assertResourceCalledRegexp(
            '^Directory$',
            '^/tmp/solr_config_audit_logs_0.[0-9]*',
            action=['delete'],
            create_parents=True)
        self.assertResourceCalled(
            'Execute', ('chmod', '-R', 'ugo+r',
                        '/etc/ambari-logsearch-portal/conf/solr_configsets'),
            sudo=True)