
# project
from cli_task import CliTask
from storage_account import StorageAccount
from data_collector import DataCollector
from logger import Logger
from exceptions import *
from container import Container

class ContainerTask(CliTask):
    def process(self):
        account = StorageAccount(self.account_name, self.config_file)
        self.container = Container(account)
        if self.command_args['list']:
            self.__list()
        elif self.command_args['content']:
            self.__content()
        else:
            raise AzureUnknownContainerCommand(self.command_args)

    def __list(self):
        result = DataCollector()
        result.add('containers', self.container.list())
        Logger.info(result.get())

    def __content(self):
        result = DataCollector()
        result.add('container_content', self.container.content(
            self.command_args['<name>'])
        )
        Logger.info(result.get())


# project
from cli_task import CliTask
from storage_account import StorageAccount
from data_collector import DataCollector
from logger import Logger
from exceptions import *
from container import Container

class ContainerTask(CliTask):
    def process(self):
        self.account = StorageAccount(self.account_name, self.config_file)
        self.container = Container(self.account)
        if self.command_args['list']:
            self.__list()
        elif self.command_args['content']:
            self.__content()
        else:
            raise AzureUnknownContainerCommand(self.command_args)

    def __list(self):
        result = DataCollector()
        result.add(
            'containers:' + self.account.get_name(),
            self.container.list()
        )
        Logger.info(result.get())

    def __content(self):
        result = DataCollector()
        result.add(
            'container_content:' + self.account.get_name(),
            self.container.content(self.command_args['<name>'])
        )
        Logger.info(result.get())

Add used storage account name in container info
Add used storage account name in container info

When calling e.g 'container list' you get all container names
but you don't know from which storage account name was used
One would need to look at the config file to check which
storage account name was configured which could be avoided
by just adding this information to the output

  
  # project
  from cli_task import CliTask
  from storage_account import StorageAccount
  from data_collector import DataCollector
  from logger import Logger
  from exceptions import *
  from container import Container
  
  class ContainerTask(CliTask):
      def process(self):
-         account = StorageAccount(self.account_name, self.config_file)
+         self.account = StorageAccount(self.account_name, self.config_file)
-         self.container = Container(account)
+         self.container = Container(self.account)
          if self.command_args['list']:
              self.__list()
          elif self.command_args['content']:
              self.__content()
          else:
              raise AzureUnknownContainerCommand(self.command_args)
  
      def __list(self):
          result = DataCollector()
-         result.add('containers', self.container.list())
+         result.add(
+             'containers:' + self.account.get_name(),
+             self.container.list()
+         )
          Logger.info(result.get())
  
      def __content(self):
          result = DataCollector()
-         result.add('container_content', self.container.content(
+         result.add(
+             'container_content:' + self.account.get_name(),
-             self.command_args['<name>'])
+             self.container.content(self.command_args['<name>'])
          )
          Logger.info(result.get())
  
Add used storage account name in container info
## Code Before:

# project
from cli_task import CliTask
from storage_account import StorageAccount
from data_collector import DataCollector
from logger import Logger
from exceptions import *
from container import Container

class ContainerTask(CliTask):
    def process(self):
        account = StorageAccount(self.account_name, self.config_file)
        self.container = Container(account)
        if self.command_args['list']:
            self.__list()
        elif self.command_args['content']:
            self.__content()
        else:
            raise AzureUnknownContainerCommand(self.command_args)

    def __list(self):
        result = DataCollector()
        result.add('containers', self.container.list())
        Logger.info(result.get())

    def __content(self):
        result = DataCollector()
        result.add('container_content', self.container.content(
            self.command_args['<name>'])
        )
        Logger.info(result.get())

## Instruction:
Add used storage account name in container info
## Code After:

# project
from cli_task import CliTask
from storage_account import StorageAccount
from data_collector import DataCollector
from logger import Logger
from exceptions import *
from container import Container

class ContainerTask(CliTask):
    def process(self):
        self.account = StorageAccount(self.account_name, self.config_file)
        self.container = Container(self.account)
        if self.command_args['list']:
            self.__list()
        elif self.command_args['content']:
            self.__content()
        else:
            raise AzureUnknownContainerCommand(self.command_args)

    def __list(self):
        result = DataCollector()
        result.add(
            'containers:' + self.account.get_name(),
            self.container.list()
        )
        Logger.info(result.get())

    def __content(self):
        result = DataCollector()
        result.add(
            'container_content:' + self.account.get_name(),
            self.container.content(self.command_args['<name>'])
        )
        Logger.info(result.get())
