def _init_reactive(self): basic.init_config_states() code_dir = os.getcwd() charm_dir = hookenv.charm_dir() for sub_path in ["reactive", "layer.yaml"]: source = os.path.join(code_dir, sub_path) target = os.path.join(charm_dir, sub_path) os.symlink(source, target)
def _init_reactive(self): self.loaded_modules = set(sys.modules.keys()) basic.init_config_states() code_dir = os.getcwd() charm_dir = hookenv.charm_dir() shutil.copytree( os.path.join(code_dir, "reactive"), os.path.join( self.fakes.fs.root.path, charm_dir.lstrip("/"), "reactive")) shutil.copytree( os.path.join(code_dir, "hooks"), os.path.join( self.fakes.fs.root.path, charm_dir.lstrip("/"), "hooks")) for sub_path in ["layer.yaml"]: source = os.path.join(code_dir, sub_path) target = os.path.join(charm_dir, sub_path) os.symlink(source, target) # We need to change the path passed to _load_module, so that # each test will be able to re-import the relation interfaces # they need. self.useFixture(Overlay( "charms.reactive.relations._load_module", self.fakes.fs._generic, self.fakes.fs._is_fake_path))
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys # Load modules from $CHARM_DIR/lib sys.path.append("lib") from charms.layer import basic basic.bootstrap_charm_deps() basic.init_config_states() import charmhelpers.core.hookenv as hookenv import charms_openstack.charm # import the trilio_wlm module to get the charm definitions created. import charm.openstack.trilio_dm # noqa def ghost_share(*args): """Ghost mount secondard TV deployment nfs-share """ secondary_nfs_share = hookenv.action_get("nfs-shares") with charms_openstack.charm.provide_charm_instance() as trilio_dm_charm: trilio_dm_charm.ghost_nfs_share(secondary_nfs_share)
#!/usr/bin/env python3 import sys sys.path.append('lib') # Make sure that reactive is bootstrapped and all the states are setup # properly from charms.layer import basic basic.bootstrap_charm_deps() basic.init_config_states() import charm.openstack.tempest as tempest import charms.reactive.relations as relations import charmhelpers.core.hookenv as hookenv if __name__ == '__main__': identity_int = relations.endpoint_from_flag('identity-admin.available') if identity_int is None: # The interface isn't connected, so we can't do this yet hookenv.action_fail( "The identity-admin interface is not available - bailing") else: tempest.render_configs([identity_int]) tempest.run_test('smoke')