Revert "Treat ec2 collector data as immutable"

All CI jobs are timing out currently during NetworkDeployment
because 99-refresh-completed is not signaling to Heat due to
instance-id being detected as null by os-apply-config.

I suspect this patch is causing the issue.

This reverts commit 8717436db9.

Change-Id: Id0d122d7e855cd828a0742dabc5f7089fb6a913c
Closes-Bug: 1623754
This commit is contained in:
James Slagle 2016-09-14 16:02:00 +00:00
parent 8717436db9
commit 9ee07c96c2
5 changed files with 0 additions and 41 deletions

View File

@ -170,10 +170,6 @@ def collect_all(collectors, store=False, collector_kwargs_map=None):
except exc.SourceNotConfigured:
logger.debug('Source [%s] Not configured.' % collector)
continue
except exc.SourceAlreadyCollected:
logger.debug('Source [%s] Already collected and cached.'
% collector)
continue
if store:
for output_key, output_content in content:

View File

@ -13,12 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from oslo_config import cfg
from oslo_log import log
from os_collect_config import cache
from os_collect_config import common
from os_collect_config import exc
@ -63,8 +60,5 @@ class Collector(object):
return content
def collect(self):
cache_path = cache.get_path('ec2')
if os.path.exists(cache_path):
raise exc.Ec2MetadataAlreadyCollected()
root_url = '%s/' % (CONF.ec2.metadata_url)
return [('ec2', self._fetch_metadata(root_url, CONF.ec2.timeout))]

View File

@ -22,18 +22,10 @@ class SourceNotConfigured(RuntimeError):
"""The requested data source is not configured."""
class SourceAlreadyCollected(RuntimeError):
"""The requested data source is immutable and already cached."""
class Ec2MetadataNotAvailable(SourceNotAvailable):
"""The EC2 metadata service is not available."""
class Ec2MetadataAlreadyCollected(SourceAlreadyCollected):
"""The EC2 metadata has already been fetched and cached."""
class CfnMetadataNotAvailable(SourceNotAvailable):
"""The cfn metadata service is not available."""

View File

@ -447,10 +447,6 @@ class TestCollectAll(testtools.TestCase):
cache.commit(changed)
(changed_keys, paths2) = self._call_collect_all(store=True)
self.assertEqual(set(), changed_keys)
# check the second collect skips ec2, it has already been cached.
ec2_path = os.path.join(self.cache_dir.path, 'ec2.json')
paths.remove(ec2_path)
self.assertEqual(paths, paths2)
def test_collect_all_no_change_softwareconfig(self):
@ -481,10 +477,6 @@ class TestCollectAll(testtools.TestCase):
(changed_keys, paths2) = self._call_collect_all(
store=True, collector_kwargs_map=soft_config_map)
self.assertEqual(set(), changed_keys)
# check the second collect skips ec2, it has already been cached.
ec2_path = os.path.join(self.cache_dir.path, 'ec2.json')
paths.remove(ec2_path)
self.assertEqual(paths, paths2)
def test_collect_all_nostore(self):

View File

@ -13,12 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import os
import uuid
import fixtures
from oslo_config import cfg
import requests
import six.moves.urllib.parse as urlparse
import testtools
@ -117,15 +114,3 @@ class TestEc2(testtools.TestCase):
collect_ec2 = ec2.Collector(requests_impl=FakeFailRequests)
self.assertRaises(exc.Ec2MetadataNotAvailable, collect_ec2.collect)
self.assertIn('Forbidden', self.log.output)
def test_collect_ec2_collected(self):
collect.setup_conf()
cache_dir = self.useFixture(fixtures.TempDir())
self.addCleanup(cfg.CONF.reset)
cfg.CONF.set_override('cachedir', cache_dir.path)
ec2_path = os.path.join(cache_dir.path, 'ec2.json')
with open(ec2_path, 'w') as f:
json.dump(META_DATA, f)
collect_ec2 = ec2.Collector(requests_impl=FakeFailRequests)
self.assertRaises(exc.Ec2MetadataAlreadyCollected, collect_ec2.collect)