aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-01-25 16:15:52 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2017-02-08 06:51:04 +0000
commitc6d584f5e050cf79eb640bae3d6ca36e2788890f (patch)
treebf4a69eb9f51e989947e80a7339a11429b9bf3b9 /api
parenta4241e6e9b121447a50fdfe0d79b322c2e2aaea9 (diff)
pylint fixes: remove redundant parens, fix comparison order
removed redundant parens in if and while clauses use var != constant, not constant != var. Python doesn't allow for assignment in if statements, so we don't have to use the old C workarounds remove unwanted commas use raw strings for regexps with backslashes, e.g. r'\s' instead of '\s' Change-Id: I7aad645dd3d7f4b4b62f4e4510a425611c9d28f2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'api')
-rw-r--r--api/resources/env_action.py2
-rw-r--r--api/utils/common.py2
-rw-r--r--api/utils/influx.py2
3 files changed, 3 insertions, 3 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index 8955f3cb6..917681c37 100644
--- a/api/resources/env_action.py
+++ b/api/resources/env_action.py
@@ -248,7 +248,7 @@ def _get_remote_rc_file(rc_file, installer_ip, installer_type):
cmd = [os_fetch_script, '-d', rc_file, '-i', installer_type,
'-a', installer_ip]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- p.communicate()[0]
+ p.communicate()
if p.returncode != 0:
logger.debug('Failed to fetch credentials from installer')
diff --git a/api/utils/common.py b/api/utils/common.py
index 1c800ce49..3e9bf8f8b 100644
--- a/api/utils/common.py
+++ b/api/utils/common.py
@@ -33,7 +33,7 @@ def get_command_list(command_list, opts, args):
command_list.append(args)
- command_list.extend(('--{}'.format(k) for k in opts if 'task-args' != k))
+ command_list.extend(('--{}'.format(k) for k in opts if k != 'task-args'))
task_args = opts.get('task-args', '')
if task_args:
diff --git a/api/utils/influx.py b/api/utils/influx.py
index 275c63a24..08996b9c9 100644
--- a/api/utils/influx.py
+++ b/api/utils/influx.py
@@ -24,7 +24,7 @@ def get_data_db_client():
try:
parser.read(conf.OUTPUT_CONFIG_FILE_PATH)
- if 'influxdb' != parser.get('DEFAULT', 'dispatcher'):
+ if parser.get('DEFAULT', 'dispatcher') != 'influxdb':
raise RuntimeError
return _get_client(parser)
olor: #f8f8f2 } /* Name.Property */ .highlight .nt { color: #f92672 } /* Name.Tag */ .highlight .nv { color: #f8f8f2 } /* Name.Variable */ .highlight .ow { color: #f92672 } /* Operator.Word */ .highlight .w { color: #f8f8f2 } /* Text.Whitespace */ .highlight .mb { color: #ae81ff } /* Literal.Number.Bin */ .highlight .mf { color: #ae81ff } /* Literal.Number.Float */ .highlight .mh { color: #ae81ff } /* Literal.Number.Hex */ .highlight .mi { color: #ae81ff } /* Literal.Number.Integer */ .highlight .mo { color: #ae81ff } /* Literal.Number.Oct */ .highlight .sa { color: #e6db74 } /* Literal.String.Affix */ .highlight .sb { color: #e6db74 } /* Literal.String.Backtick */ .highlight .sc { color: #e6db74 } /* Literal.String.Char */ .highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */ .highlight .sd { color: #e6db74 } /* Literal.String.Doc */ .highlight .s2 { color: #e6db74 } /* Literal.String.Double */ .highlight .se { color: #ae81ff } /* Literal.String.Escape */ .highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */ .highlight .si { color: #e6db74 } /* Literal.String.Interpol */ .highlight .sx { color: #e6db74 } /* Literal.String.Other */ .highlight .sr { color: #e6db74 } /* Literal.String.Regex */ .highlight .s1 { color: #e6db74 } /* Literal.String.Single */ .highlight .ss { color: #e6db74 } /* Literal.String.Symbol */ .highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #a6e22e } /* Name.Function.Magic */ .highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */ .highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */ .highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */ .highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */ .highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */ } @media (prefers-color-scheme: light) { .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
---
- hosts: all
  tasks:
    - name: Generate SSH key for stack if missing
      shell: test -e ~/.ssh/id_rsa || ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
    - name: Fix ssh key for stack
      shell: restorecon -r /home/stack
      become: yes
    - file:
        path: /home/stack/nics
        state: directory
        owner: stack
        group: stack
        mode: 0775
    - copy:
        src: /root/.ssh/id_rsa.pub
        dest: /home/stack/jumphost_id_rsa.pub
        owner: stack
        group: stack
        mode: 0644
    - copy:
        src: "{{ apex_temp_dir }}/{{ item }}.yaml"
        dest: "/home/stack/nics/{{ item }}.yaml"
        owner: stack
        group: stack
        mode: 0644
      with_items:
        - controller
        - compute
    - name: Copy container prep env file to undercloud
      copy:
        src: "{{ apex_temp_dir }}/containers-prepare-parameter.yaml"
        dest: "/home/stack/containers-prepare-parameter.yaml"
        owner: stack
        group: stack
        mode: 0644
    - lineinfile:
        path: /etc/sudoers
        regexp: 'Defaults\s*requiretty'
        state: absent
      become: yes
    - lineinfile:
        path: /etc/environment
        regexp: '^http_proxy'
        line: "http_proxy={{ http_proxy }}"
      become: yes
      when: http_proxy
    - lineinfile:
        path: /etc/environment
        regexp: '^https_proxy'
        line: "https_proxy={{ https_proxy }}"
      become: yes
      when: https_proxy
    - name: openstack-configs undercloud
      shell: openstack-config --set undercloud.conf DEFAULT {{ item }}
      with_items: "{{ undercloud_config }}"
    - name: openstack-configs undercloud network
      shell: openstack-config --set undercloud.conf ctlplane-subnet {{ item }}
      with_items: "{{ undercloud_network_config }}"
    - block:
        - name: undercloud install
          shell: openstack undercloud install &> apex-undercloud-install.log
          become: yes
          become_user: stack
      rescue:
        - name: undercloud install retry
          shell: openstack undercloud install >> apex-undercloud-install.log 2>&1
          become: yes
          become_user: stack
      always:
        - name: fetch undercloud log
          fetch:
            src: /home/stack/apex-undercloud-install.log
            dest: "{{ apex_temp_dir }}/"
            flat: yes
    - name: openstack-configs nova
      shell: openstack-config --set /var/lib/config-data/nova/etc/nova/nova.conf DEFAULT {{ item }}
      become: yes
      with_items: "{{ nova_config }}"
    - name: restart nova services
      shell: "docker restart {{ item }}"
      with_items:
        - nova_conductor
        - nova_compute
        - nova_api
        - nova_scheduler
      become: yes
    - name: openstack-configs neutron
      shell: openstack-config --set /var/lib/config-data/neutron/etc/neutron/neutron.conf DEFAULT {{ item }}
      become: yes
      with_items: "{{ neutron_config }}"
    - name: restart neutron services
      shell: "docker restart {{ item }}"
      with_items:
        - neutron_api
        - neutron_dhcp
      become: yes
    - name: openstack-configs ironic
      shell: openstack-config --set /var/lib/config-data/ironic/etc/ironic/ironic.conf {{ item }}
      become: yes
      with_items: "{{ ironic_config }}"
    - name: restart ironic services
      shell: "docker restart {{ item }}"
      with_items:
        - ironic_api
        - ironic_conductor
        - ironic_inspector
      become: yes
    - name: configure external network vlan ifcfg
      template:
        src: external_vlan_ifcfg.yml.j2
        dest: "/etc/sysconfig/network-scripts/ifcfg-vlan{{ external_network.vlan }}"
        owner: root
        group: root
        mode: 0644
      become: yes
      when:
        - external_network.vlan != "native"
        - external_network.enabled
    - name: bring up vlan ifcfg
      shell: "ifup vlan{{ external_network.vlan }}"
      become: yes
      when:
        - external_network.vlan != "native"
        - external_network.enabled
    - name: assign IP to native eth2
      shell: ip a a {{ external_network.ip }}/{{ external_network.prefix }} dev eth2
      become: yes
      when:
        - external_network.vlan == "native"
        - external_network.enabled
    - name: bring up eth2
      shell: ip link set up dev eth2
      when:
        - external_network.vlan == "native"
        - external_network.enabled
      become: yes
    - name: bring up eth0 if aarch64
      shell: ip link set up dev eth0
      when:
        - external_network.vlan == "native"
        - external_network.enabled
        - aarch64
      become: yes
    - block:
        - name: Undercloud NAT - MASQUERADE interface
          iptables:
            table: nat
            chain: POSTROUTING
            out_interface: eth0
            jump: MASQUERADE
        - name: Undercloud NAT - MASQUERADE interface with subnet
          iptables:
            table: nat
            chain: POSTROUTING
            out_interface: eth0
            jump: MASQUERADE
            source: "{{ nat_cidr }}"
        - name: Undercloud NAT - Allow Forwarding
          iptables:
            chain: FORWARD
            in_interface: eth2
            jump: ACCEPT
        - name: Undercloud NAT - Allow Stateful Forwarding
          iptables:
            chain: FORWARD
            in_interface: eth2
            jump: ACCEPT
            source: "{{ nat_cidr }}"
            ctstate: ESTABLISHED,RELATED
        - name: Undercloud NAT - Save iptables
          shell: service iptables save
      become: yes
      when:
        - not nat_network_ipv6
        - nat
    - name: fetch storage environment file
      fetch:
        src: /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
        dest: "{{ apex_temp_dir }}/"
        flat: yes
    - name: fetch sriov environment file
      fetch:
        src: /usr/share/openstack-tripleo-heat-templates/environments/services/neutron-opendaylight-sriov.yaml
        dest: "{{ apex_temp_dir }}/"
        flat: yes
    - name: Restorecon for root ssh
      shell: restorecon -r -v /root/.ssh
      become: yes

- include: undercloud_aarch64.yml
  when: aarch64