Ejemplo n.º 1
0
 def _read_metadata_for_org(self, org_id):
     sdir = self.get_org_spec_dir(org_id)
     if (not os.path.exists(sdir)):
         raise Exception("Service with org_id=%s is not initialized" %
                         (org_id))
     return OrganizationMetadata.from_file(
         sdir.joinpath("organization_metadata.json"))
Ejemplo n.º 2
0
    def metadata_add_asset_to_ipfs(self):
        metadata_file = self.args.metadata_file
        org_metadata = OrganizationMetadata.from_file(metadata_file)
        asset_file_ipfs_hash_base58 = publish_file_in_ipfs(self._get_ipfs_client(),
                                                                      self.args.asset_file_path)

        org_metadata.add_asset(asset_file_ipfs_hash_base58, self.args.asset_type)
        org_metadata.save_pretty(self.args.metadata_file)
Ejemplo n.º 3
0
 def metadata_add_contact(self):
     args = self.args.__dict__
     metadata_file = args["metadata_file"]
     contact_type = args.get("contact_type", None)
     phone = args.get("phone", None)
     email = args.get("email", None)
     if phone is None and email is None:
         self._printout("email and phone both can not be empty")
     else:
         org_metadata = OrganizationMetadata.from_file(metadata_file)
         org_metadata.add_contact(contact_type, phone, email)
         org_metadata.save_pretty(metadata_file)
Ejemplo n.º 4
0
 def metadata_add_description(self):
     description = self.args.description
     url = self.args.url
     short_description = self.args.short_description
     metadata_file = self.args.metadata_file
     org_metadata = OrganizationMetadata.from_file(metadata_file)
     if description:
         org_metadata.add_description(description)
     if short_description:
         org_metadata.add_short_description(short_description)
     if url:
         org_metadata.add_url(url)
     if description is None and url is None and short_description is None:
         raise Exception("No attributes are given")
     org_metadata.save_pretty(metadata_file)
Ejemplo n.º 5
0
 def open_init_channel_from_metadata(self):
     metadata = OrganizationMetadata.from_file(self.args.metadata_file)
     self._open_init_channel_from_metadata(metadata, {})
Ejemplo n.º 6
0
 def metadata_remove_all_contacts(self):
     metadata_file = self.args.metadata_file
     org_metadata = OrganizationMetadata.from_file(metadata_file)
     org_metadata.remove_all_contacts()
     org_metadata.save_pretty(metadata_file)
Ejemplo n.º 7
0
 def metadata_remove_contact_by_type(self):
     metadata_file = self.args.metadata_file
     contact_type = self.args.contact_type
     org_metadata = OrganizationMetadata.from_file(metadata_file)
     org_metadata.remove_contact_by_type(contact_type)
     org_metadata.save_pretty(metadata_file)
Ejemplo n.º 8
0
 def metadata_remove_assets_of_a_given_type(self):
     metadata_file = self.args.metadata_file
     org_metadata = OrganizationMetadata.from_file(metadata_file)
     org_metadata.remove_assets(self.args.asset_type)
     org_metadata.save_pretty(self.args.metadata_file)