Skip to content
Snippets Groups Projects

Adding charms' libraries as Git submodules, in cases where the development is being done in a Git repository

1 file
+ 33
18
Compare changes
  • Side-by-side
  • Inline
+ 33
18
@@ -107,26 +107,41 @@ osm ns-create ... --config-file vars.yaml
This section will focus the attention on creating a Proxy charm to configure a workload.
Create a folder for the `samplecharm` in the VNFD directory, and create necessary files:
Create a folder for the `samplecharm` in the VNFD directory, and create necessary files (use one of the two following ways):
- Given that you are developing in your local machine:
```bash
mkdir -p charms/samplecharm/
cd charms/samplecharm/
mkdir hooks lib mod src
touch src/charm.py
touch actions.yaml metadata.yaml config.yaml
chmod +x src/charm.py
ln -s ../src/charm.py hooks/upgrade-charm
ln -s ../src/charm.py hooks/install
ln -s ../src/charm.py hooks/start
git clone https://github.com/canonical/operator mod/operator
git clone https://github.com/charmed-osm/charms.osm mod/charms.osm
ln -s ../mod/operator/ops lib/ops
ln -s ../mod/charms.osm/charms lib/charms
```
- Given that you are developing in a Git repository:
```bash
mkdir -p charms/samplecharm/
cd charms/samplecharm/
mkdir hooks lib mod src
touch src/charm.py
touch actions.yaml metadata.yaml config.yaml
chmod +x src/charm.py
ln -s ../src/charm.py hooks/upgrade-charm
ln -s ../src/charm.py hooks/install
ln -s ../src/charm.py hooks/start
git submodule add https://github.com/canonical/operator mod/operator
git submodule add https://github.com/charmed-osm/charms.osm mod/charms.osm
ln -s ../mod/operator/ops lib/ops
ln -s ../mod/charms.osm/charms lib/charms
```
> Go to [charms.osm](https://github.com/charmed-osm/charms.osm) if you want to learn more about how to use the charms.osm library.
```bash
mkdir -p charms/samplecharm/
cd charms/samplecharm/
mkdir hooks lib mod src
touch src/charm.py
touch actions.yaml metadata.yaml config.yaml
chmod +x src/charm.py
ln -s ../src/charm.py hooks/upgrade-charm
ln -s ../src/charm.py hooks/install
ln -s ../src/charm.py hooks/start
git clone https://github.com/canonical/operator mod/operator
git clone https://github.com/charmed-osm/charms.osm mod/charms.osm
ln -s ../mod/operator/ops lib/ops
ln -s ../mod/charms.osm/charms lib/charms
```
Include the following high level metadata in `metadata.yaml`:
```yaml
Loading